Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working on Android API 22 #65

Open
dziry opened this issue Apr 20, 2020 · 2 comments
Open

Not working on Android API 22 #65

dziry opened this issue Apr 20, 2020 · 2 comments

Comments

@dziry
Copy link

dziry commented Apr 20, 2020

Description: I've tested the example "Sensor Data Collector" on both Android API 29 and API 25. It works perfectly.

But for Android API 22 it seems not workig as it should be : Calibration is always 0.000000% when trying to calibrate and when starting to track nothing shows on the map.

The log file in SendDataCollector folder contains data about GPS, KalmanAlloc but no a single line for abs acc

Expected behavior:

  • Click on Start Calibration : Progression from 0 to 100%
  • Click on Start Tracking : Shows the current location and one or more routes

Source code:

  • getCompletePercentage() always returns 0.0
  • locationChanged(Location location) never triggered

Android API version: 22

Device: Emulator.

@dziry
Copy link
Author

dziry commented Apr 20, 2020

Nvm, I figured out reading the issues #11 and #38 that problem is probably happening because the sensors TYPE_LINEAR_ACCELERATION and TYPE_ROTATION_VECTOR are not available.

So, i will reformulate my question :

  1. Does anyone tried to solve this using other sensors like the accelerometer or the magnetometer in order to detarminate acceleration and oriontation?
  2. Otherwise, could you give us some big guidlines (classes/functions/lines to edit) so we can improve your library in order to handle this case.
  3. How much time this task may take?
  4. Is it worth it (accuracy)?

Thank you

@Lezh1k
Copy link
Collaborator

Lezh1k commented Apr 21, 2020

Hello, @dziry .
Thank you for interest in our library. Unfortunately it's kind of rusty now and need to be refactored. So I'll just try to answer your questions above :) So:

  1. Yes, I've tried to solve this using raw accelerometer, gyroscope and magnetometer data. I've used Madgwick filter. It works perfectly, but you need to know, that on some devices X,Y and Z axis are rotated. I mean, that when I tested results from ROTATION_VECTOR_SENSOR and results from Madgwick filter I saw, that Y == X and X == -Y . Maybe this is related to wrong implementation of that filter, but I tried on raw sensors (with STM32) and there was no error. So you need to keep in mind, that this is possible.

  2. To improve this I was planning to do next things:

  • Make some ISensorDataCollector interface with 2 methods: Start() and Stop(). All sensor data providers should implement that interface.
  • Make some interface IOrientationProvider. This one should return quaternion with current orientation.
  • Implement several IOrientationProviders, based on ROTATION_VECTOR, Madgwick filter, alpha-beta filter and, maybe, something else (some custom implementation of sensor fusion with Kalman filter, for example).
  • Then this one should be as data source for Kalman filter. I don't think that we need to improve Kalman filter, but I wanted to try to implement extended Kalman filter and see if it's better or not.
  1. I don't think that it will take much time. I know, that this code isn't perfect and should be refactored and redesigned. So, in current implementation it will take from 1 to 2 weeks, I guess.

  2. I'm pretty sure, that Madgwick filter works fine in our case. The main problem we will have on smartphones without Magnetometer. I don't know how to deal with it right now.

Hope it will help you. Also I hope that I'll get more free time and return to this project. Thank you one more time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants