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

Speed values and Q matrix #50

Open
thxmxx opened this issue Sep 2, 2019 · 12 comments
Open

Speed values and Q matrix #50

thxmxx opened this issue Sep 2, 2019 · 12 comments

Comments

@thxmxx
Copy link
Contributor

thxmxx commented Sep 2, 2019

Can someone tell me why rebuildQ is in function of m_predictCount since the accDev does not change over time?

Also, do you have some clue on why the speed readings are so wrong?

Thank you

@Pstoppani
Copy link

Pstoppani commented Sep 2, 2019 via email

@thxmxx
Copy link
Contributor Author

thxmxx commented Sep 2, 2019

@Pstoppani I'm also using a similar approach:

private void rebuildQ(double dtUpdate, double accDev) {
        double velDev = accDev * dtUpdate;
        double posDev = (accDev * dtUpdate * dtUpdate) / 2.0;
        double covDev = velDev * posDev;

        double posSig = posDev * posDev;
        double velSig = velDev * velDev;

        double Q[] = {
                posSig, 0.0, covDev, 0.0,
                0.0, posSig, 0.0, covDev,
                covDev, 0.0, velSig, 0.0,
                0.0, covDev, 0.0, velSig
        };
        m_kf.Q.setData(Q);
    }

I'm working on android btw, there was also a wrong size of B matrix and u vector. They should be (4x2) and (2x1) respectively.

Btw, now it seems the vectors (east, north) from accelerometer are not on the same orientation as the gps speed vectors.

@thxmxx
Copy link
Contributor Author

thxmxx commented Sep 2, 2019

I think it's also a mistake to use the orientation from the gps on update cause we have this data more accurate from magnetometer.

@Pstoppani
Copy link

Pstoppani commented Sep 2, 2019 via email

@farfromrefug
Copy link

@thxmxx @Pstoppani can you elaborate on what you changed for gps orientation?

@Pstoppani
Copy link

Pstoppani commented Sep 16, 2019 via email

@farfromrefug
Copy link

@Pstoppani thanks! Will test it on my side. I ported the code to JS as i use it within Nativescript cross platform environment.
Thanks

@thxmxx
Copy link
Contributor Author

thxmxx commented Sep 24, 2019

@farfromrefug Instead of using loc.getBearing() on the SensorGpsDataItem (used on update step), I used the magnetometer reading.
I did that because the GPS reading can be 0 in case the bearing is not delivered...

https://developer.android.com/reference/android/location/Location.html#getBearing()

@farfromrefug
Copy link

@thxmxx thanks a lot! will use that too.
Now did you get the speed to be accurate? That s actually the reason why i am looking at this lib.
My client find the GPS speed to not be accurate and responsive enough. So i look here.
Now i have to lib working correctly except for the speed. The reading are wrong.
I have looked at both rebuildQ implementations here but i dont get a correct result.
Well it see wrong result with my JS port. Need to test android version with your implementation to see what i get

@thxmxx
Copy link
Contributor Author

thxmxx commented Sep 24, 2019

@farfromrefug you should also use this #51
It's already merged btw

@thxmxx
Copy link
Contributor Author

thxmxx commented Sep 24, 2019

Now did you get the speed to be accurate?

I'm getting the error of +-5Km/h. But I'm still working on that, since I'm using GPS speed on updates and the predict results are still bad.

@farfromrefug
Copy link

farfromrefug commented Sep 25, 2019

@thxmxx Thanks for the infos!
I added the bearing from sensors as you mentioned (Also reported in test app for easier debug). You can see it here :
https://github.com/farfromrefug/mad-location-manager
Now what i am seeing is a lot more accurate speed reading from the GPS right now.

My question is this. When updating the Kalman filter with the GPS location, what we are doing is using GPS speed as a reference for the Kalman Filter to "predict" it afterwards based on Linear ACceleration, right? I am not that familiar with the Kalman Filter
But if it is so shouldn't we "reset" the Q matrix on new Location update?

What i am seeing when outside is that the GPS speed pretty quickly goes to 0 when i stop walking. But the Filtered speed does not want to go to 0. It just slowly goes down.
Also Do you use the m_useGpsSpeed of the GPSKalmanFilter? I am not sure what it does.
Thanks

EDIT: found out that article. And i think it is the inspiration for that repo
http://scottlobdell.me/2017/01/gps-accelerometer-sensor-fusion-kalman-filter-practical-walkthrough
And the output that i have is exactly what a comment is talking about
http://scottlobdell.me/2017/01/gps-accelerometer-sensor-fusion-kalman-filter-practical-walkthrough/#comment-3733623833

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

3 participants