maddevsio / mad-location-manager

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

Kalman location service started location random coords #130

Open isamirkhaan1 opened 11 months ago

isamirkhaan1 commented 11 months ago

Hey,

I am using the Kalman Service to draw a route, in parallel, I'm also using the fucedlocation to draw another route. The purpose is to compare both paths and see which is more accurate. For the last few hours, I've been getting weird random locations from the Kalman Service, which can be seen below.

Screenshot 2023-10-05 at 16 02 00

Here is the implementation

internal class MadLocationManager(
    private val context: Context
) : LocationServiceInterface {
    private lateinit var geoHashRTFilter: GeohashRTFilter

    init {
        ServicesHelper.addLocationServiceInterface(this)
    }

    override fun locationChanged(location: Location?) {
        location ?: return
        Log.i(TAG, "locationChanged: $location")

            RxBus.send(location)
        }

}

edit: The issue doesn't happen on default settings. But if I change onlyGpsSensor from true to false and set provider to Settings.LocationProvider.FUSED

Settings(
        /* accelerationDeviation = */ Utils.ACCELEROMETER_DEFAULT_DEVIATION,
        /* gpsMinDistance = */ LOCATION_UPDATE_MIN_DISTANCE,
        /* gpsMinTime = */ X,
        /* positionMinTime = */ Utils.SENSOR_POSITION_MIN_TIME,
        /* geoHashPrecision = */ Utils.GEOHASH_DEFAULT_PREC,
        /* geoHashMinPointCount = */ Utils.GEOHASH_DEFAULT_MIN_POINT_COUNT,
        /* sensorFrequencyHz = */ Utils.SENSOR_DEFAULT_FREQ_HZ,
        /* logger = */ null,
        /* filterMockGpsCoordinates = */ true,
        /* onlyGpsSensor = */ true,
        /* useGpsSpeed = */ false,
        /* velFactor = */ Utils.DEFAULT_VEL_FACTOR,
        /* posFactor = */ Utils.DEFAULT_POS_FACTOR,
        /* provider = */ Settings.LocationProvider.GPS
    )
Lezh1k commented 10 months ago

Hello there. Actually there is an error in java version now. I recommend to try out version in lib_cpp branch (lib folder). But there is only C++ version of filter for now (with a quite simple API) .

gfrancischini commented 4 weeks ago

Hi @Lezh1k. We are experiencing (maybe) a similar issue. Most of our users does not seems to have this error but on couple of Samsung devices we see wrong coordinates in the middle of nowhere (like in the middle of the ocean)

Do. you think that it is related to the bug mentioned in your comment? is there a new version with this bug fixed?