Simple implementation of GPS position filtering ( cheap pseudo Kalman )
As told by Menion, Locus does not currently use filtration of GPS position. Such filtering ( ala GPS averaging ) could be useful for geocaching or terrain surveying for OSM mapping.
I got idea of optional use of such filtering, eventually triggered by speed limit, similarly as magnetic compass is.
I suggest very simple filtering, using weighted average of the measured position and the position predicted from previous 2 filtered positions - a kind of a cheap pseudo Kalman filter. Prediction supposes you are moving without acceleration, with initial position, direction and speed given by last 2 filtered positions.
N is an index of position timeline
X is weighting factor, the higher means stronger filtration. 0 means zero filtration, >>1 means very strong filtration
Note that such filtering will apply to altitude as well, as part of 3D position.
As first 2 filtered positions would be trivially taken 2 subsequent measured positions.
Edit: As a waist shoot, values X=1-4 could be a good trial values.
- FilteredPosition(n+1)=(MeasuredPosition(n+1,GPS) + X * PredictedPosition(n+1))/(X+1)
- PredictedPosition(n+1)= 2 * FilteredPosition(n) - FilteredPosition(n-1)
Hm, perhaps a static initial state FilteredPosition(2)=FilteredPosition(1) would be better, as otherwise initial state could be too "jumpy".
Hm, perhaps a static initial state FilteredPosition(2)=FilteredPosition(1) would be better, as otherwise initial state could be too "jumpy".
For low enough speed would be probably better ..
PredictedPosition(n+1)= FilteredPosition(n)
And generally the true Kalman filter.
For low enough speed would be probably better ..
PredictedPosition(n+1)= FilteredPosition(n)
And generally the true Kalman filter.
I would need this filter to "smoothen" the speed value.
I would need this filter to "smoothen" the speed value.
I suppose so as well. a good solution would be double exponential smoothing,
I suppose so as well. a good solution would be double exponential smoothing,
ALFA and BETA are smoothing time constants for both position and velocity, respectively.
Both have value from 0 - total filtering - unusable till 1 - zero filtering.
Generally , the lower the ratio of speed/GPS error is, the stronger the filtering should be.
Seems like ALFA is good 0.2-0.6, BETA 0.05-0.2
ALFA and BETA are smoothing time constants for both position and velocity, respectively.
Both have value from 0 - total filtering - unusable till 1 - zero filtering.
Generally , the lower the ratio of speed/GPS error is, the stronger the filtering should be.
Seems like ALFA is good 0.2-0.6, BETA 0.05-0.2
NewEstimatedVelocity = BETA * ( NewEstimatedPosition - PreviousEstimatedPosition ) + ( 1-BETA)*PreviousEstimatedVelocity
NewEstimatedVelocity = BETA * ( NewEstimatedPosition - PreviousEstimatedPosition ) + ( 1-BETA)*PreviousEstimatedVelocity
Hi guys,
I'm just uploading on Google Play new Beta version of Locus Map application 3.26.2.9.
In this version is added a new horizontal filter for GPS locations! Needs testing anyway. To enable it, choose its strength in expert settings. After that, the best is to start track recording (with 1s/1m setup). On the map will be drawn line created by track recording service and also dashed line created from original locations!! So you may really easily compare the difference.
Let me know if this feature makes any difference for you and if set strength is usable on your devices. Thanks
Hi guys,
I'm just uploading on Google Play new Beta version of Locus Map application 3.26.2.9.
In this version is added a new horizontal filter for GPS locations! Needs testing anyway. To enable it, choose its strength in expert settings. After that, the best is to start track recording (with 1s/1m setup). On the map will be drawn line created by track recording service and also dashed line created from original locations!! So you may really easily compare the difference.
Let me know if this feature makes any difference for you and if set strength is usable on your devices. Thanks
Zkoušel jsem na Xiaomi MI A2 / Android 9 lehký a střední filtr. Oba dávají hladkou křivku, ale lehký filtr se mi zdá neklidný a při chůzi má tendenci ke střednědobými fluktuacím. ( úseky desítek sekund70-100 m,chůze)). Střední se zdá stabilní, silný bych asi ani nevyužil.
Zkoušel jsem na Xiaomi MI A2 / Android 9 lehký a střední filtr. Oba dávají hladkou křivku, ale lehký filtr se mi zdá neklidný a při chůzi má tendenci ke střednědobými fluktuacím. ( úseky desítek sekund70-100 m,chůze)). Střední se zdá stabilní, silný bych asi ani nevyužil.
First test. Samsung A3, android 8, recording settings: 7/2/45. Walking 7 km. Filtering: weak.
The filter has greatly counseled the weaker signal after the GPS restart with Auto-off. See scr autooff.jpg.
He creates sharp angles in the corners, but at the same time he is well advised to filter the GPS failure after entering the church. See scr kostel.jpg
CZ: První test. Samsung A3, android 8, nastavení záznamu: 7/2/45. Chůze 7 km. Filtrování: slabé.
Filtr si skvěle poradil se slabším signálem po restartu GPS pomocí Auto-off. Viz scr autooff.jpg.
V zatáčkách vytváří ostré úhly, ale současně si výborně poradil filtorváním výpadku GPS po vstupu do kostela. Viz scr kostel.jpg
First test. Samsung A3, android 8, recording settings: 7/2/45. Walking 7 km. Filtering: weak.
The filter has greatly counseled the weaker signal after the GPS restart with Auto-off. See scr autooff.jpg.
He creates sharp angles in the corners, but at the same time he is well advised to filter the GPS failure after entering the church. See scr kostel.jpg
CZ: První test. Samsung A3, android 8, nastavení záznamu: 7/2/45. Chůze 7 km. Filtrování: slabé.
Filtr si skvěle poradil se slabším signálem po restartu GPS pomocí Auto-off. Viz scr autooff.jpg.
V zatáčkách vytváří ostré úhly, ale současně si výborně poradil filtorváním výpadku GPS po vstupu do kostela. Viz scr kostel.jpg
Josef, thanks for tests. It looks maybe too good in your case :).
Libor, it is possible (Xiaomi). Also in case of enabled "Google Services assisted location" (in Locus GPS settings), Google most probably also apply some filtering on computed location. Anyway, generally light or medium filter seems to give usable results. Thanks.
And Andrew, no need to sorry. Btw. filtering is using Kalman filter, not exponential smoothing suggested by Libor some time ago.
Josef, thanks for tests. It looks maybe too good in your case :).
Libor, it is possible (Xiaomi). Also in case of enabled "Google Services assisted location" (in Locus GPS settings), Google most probably also apply some filtering on computed location. Anyway, generally light or medium filter seems to give usable results. Thanks.
And Andrew, no need to sorry. Btw. filtering is using Kalman filter, not exponential smoothing suggested by Libor some time ago.
Kolísání záznamu při použití filtrace.
I používat nastavení restartovat GPS po 10 minutách auto-off, pak se změní záznam a Kalmanův filtr opraví správně. Všiml jsem si však, že záznam trasy je pak v nadmořské výšce fluktuace. Pokud se filtr vypne, nejsou tam žádné výkyvy. Přikládám SCR a GPX.
CZ: Výkyvy v záznamu při použití filtrace. Používám nastavení auto-off k restartu GPS po 10 minutách, v těchto místech pak dojde k rozkolísání záznamu a Kalman filtr to správně zkoriguje. Všiml jsem si ale, že v záznamu trasy je pak v těchto místech výkyv v nadmořské výšce. Pokud filtraci vypnu tak tam výkyvy nejsou. Přikládám SCR a GPX.
Kolísání záznamu při použití filtrace.
I používat nastavení restartovat GPS po 10 minutách auto-off, pak se změní záznam a Kalmanův filtr opraví správně. Všiml jsem si však, že záznam trasy je pak v nadmořské výšce fluktuace. Pokud se filtr vypne, nejsou tam žádné výkyvy. Přikládám SCR a GPX.
CZ: Výkyvy v záznamu při použití filtrace. Používám nastavení auto-off k restartu GPS po 10 minutách, v těchto místech pak dojde k rozkolísání záznamu a Kalman filtr to správně zkoriguje. Všiml jsem si ale, že v záznamu trasy je pak v těchto místech výkyv v nadmořské výšce. Pokud filtraci vypnu tak tam výkyvy nejsou. Přikládám SCR a GPX.
One comment from derived from a hike across the alps 2 years ago - yes, in serpentines, or tight corners the track was off and filtering could have improved the track. But what was completely off and I didn't even bother attempting to correct is the z-axis adjustment. This needs definitely some filtering. Sometimes I was wondering if a manual input of a known elevation would be advised. Anyway, what I am suggesting is to have the option to apply different filter settings to x/y coordinates compared to elevation filtering.
One comment from derived from a hike across the alps 2 years ago - yes, in serpentines, or tight corners the track was off and filtering could have improved the track. But what was completely off and I didn't even bother attempting to correct is the z-axis adjustment. This needs definitely some filtering. Sometimes I was wondering if a manual input of a known elevation would be advised. Anyway, what I am suggesting is to have the option to apply different filter settings to x/y coordinates compared to elevation filtering.
Replies have been locked on this page!