maddevsio / mad-location-manager

Mad Location Manager is a library for GPS and Accelerometer data "fusion" with Kalman filter
MIT License
533 stars 154 forks source link

Old device without sensors TYPE_ROTATION_VECTOR, TYPE_LINEAR_ACCELERATION #127

Closed daniel-costaa closed 1 year ago

daniel-costaa commented 1 year ago

Hello! Before anything, I would like to thank you for all the ideas and effort put into this library.

I'm trying to adapt it for use on relatively old devices, and I saw that you left a comment saying that using just the TYPE_ACCELEROMETER sensor with a high pass filter should work.

I would like to know if you have any working example with this approach, because I have been trying to implement it for a few days, but without any success.

Lezh1k commented 1 year ago

Hello @daniel-costaa

Unfortunately I did not save any example related to high pass filters.

Here are some ideas that might be helpful.

  1. If you don't have TYPE_ROTATION_VECTOR - you can use madgwick filter. here is an implementation. Also take a look at lib_cpp branch - it can be helpful too. There are implementations of quaternion, vector rotation and madgwick filter.
  2. If you don't have TYPE_LINEAR_ACCELERATION - please see this . There is an example of how to implement high-pass filter.
daniel-costaa commented 1 year ago

This specific device doesn't have any of the sensors, only TYPE_ACCELEROMETER. I had already seen that high pass implementation doc in Android's official site, but didn't understand how should I pass linear_acceleration values to the rest of the code you implemented. Should I replicate what was done in TYPE_LINEAR_ACCELERATION switch case at onSensorChanged, but with the new values?

Lezh1k commented 1 year ago

I believe with only accelerometer (without magnetometer) it's not possible to calculate position of phone and impossible to connect accelerometer data to GPS data.

daniel-costaa commented 1 year ago

Got it, thanks for the help!