Speed Calculation

Neil Romig7 years ago

I am looking to start using maxSpeed filtering but struggling to understand the "speed" value stored in the database. Some examples:

id         protocol     deviceid servertime             devicetime             fixtime              valid  latitude      longitude  altitude speed course address attributes
7155508    teltonika    50       2018-03-24 13:21:06    2018-03-24 13:20:35    2018-03-24 13:20:35    1    50.5790323    -3.6626038    43    0       0    NULL    {"priority":0,"sat":15,"event":0,"io199":0,"distance":11.76,"totalDistance":5478340.61,"motion":false}
7155478    teltonika    50       2018-03-24 13:20:09    2018-03-24 13:19:35    2018-03-24 13:19:35    1    50.5789435    -3.6626938    20    0       278  NULL    {"priority":0,"sat":7,"event":0,"io199":0,"distance":44607.42,"totalDistance":5478328.85,"motion":false}
7155464    teltonika    50       2018-03-24 13:19:21    2018-03-24 13:18:57    2018-03-24 13:18:57    1    50.9650813    -3.49334    -1757   52.3758 275  NULL    {"priority":0,"sat":4,"event":0,"io199":0,"distance":1545.53,"totalDistance":5433721.43,"motion":true}
7155462    teltonika    50       2018-03-24 13:18:57    2018-03-24 13:18:32    2018-03-24 13:18:32    1    50.9570655    -3.511338   -2535   58.3154 278  NULL    {"priority":0,"sat":5,"event":0,"io199":0,"distance":43416.64,"totalDistance":5432175.9,"motion":true}
7155461    teltonika    50       2018-03-24 13:18:57    2018-03-24 13:18:18    2018-03-24 13:18:18    1    50.5789788    -3.6627046    39    0       0    NULL    {"priority":0,"sat":16,"event":0,"io199":0,"distance":0.0,"totalDistance":5388759.26,"motion":false}

I know the vehicle was stationary, so the fixes at 13:18:32, 13:18:57 & 13:19:35 contain bad data. Where the speed is shown as 58.3154, I might think this is the speed as reported by the tracker at the moment of GPS fix. I am puzzled why the "io199" attribute (which is the distance in metres reported by the tracker) remains at zero throughout.

If "speed" column does contain the value reported by the tracker then I am also puzzled why the "io24" attribute (the speed reported by the tracker) does not match exactly the value stored by Traccar. Sometimes the io24 value is a little higher, sometimes a little lower, and not always by the same margin of error. Occasionally they are very different.

I tried a brief test with maxSpeed set to 70. Very quickly (despite none of our vehicles being capable of exceeding 60knots) I saw a filter result in the logs:

2018-04-13 16:26:50 DEBUG: [1250D052: 5027 < 81.19.181.2] HEX: 00000000000000f7080600000162bf9a2c9800fdca60f71e1713530022001e1000180
00301ef010118001901c7000000000000000162bf9a3c3800fdca5d111e170f050021001c10001a000301ef010118001a01c7000001810000000162bf9a440800fdc
bc8ea1e17115500200060050033000301ef010118002701c7000000000000000162bf9b269800fdca5d111e170f050021001c10001a000301ef010118001a01c7000
000000000000162bf9bf1b800fdcc3ea61e1710ec001f004613002afd0503ef01fd03fe180118002b01c7000003690000000162bf9cdc1800fdcced701e1746a8003
1003f110001000301ef010118000401c70000017a00060000baa5
2018-04-13 16:26:50 DEBUG: [1250D052: 5027 > 81.19.181.2] HEX: 00000006
2018-04-13 16:26:50  INFO: [1250D052] id: 356173069223258, time: 2018-04-13 16:22:55, lat: 50.48288, lon: -3.70686, speed: 13.0, course: 30.0
2018-04-13 16:26:50  INFO: [1250D052] id: 356173069223258, time: 2018-04-13 16:22:59, lat: 50.48277, lon: -3.70696, speed: 14.0, course: 28.0
2018-04-13 16:26:50  INFO: Position filtered by MaxSpeed filters from device: 356173069223258 with id: 35
2018-04-13 16:26:50  INFO: [1250D052] id: 356173069223258, time: 2018-04-13 16:23:59, lat: 50.48277, lon: -3.70696, speed: 14.0, course: 28.0
2018-04-13 16:26:50  INFO: [1250D052] id: 356173069223258, time: 2018-04-13 16:24:51, lat: 50.48281, lon: -3.69463, speed: 22.7, course: 70.0
2018-04-13 16:26:50  INFO: [1250D052] id: 356173069223258, time: 2018-04-13 16:25:51, lat: 50.48419, lon: -3.69015, speed: 0.5, course: 63.0

I can't see that the vehicle exceeded 70 knots.

Can you help me understand what is going on here?

Anton Tananaev7 years ago

Traccar doesn't use IO values. Speed in the position is GPS speed, not OBD if that's what you are thinking of. If you see positions being filtered, it means that reported speed exceeded the limit. If it shouldn't happen it's either device issue reporting wrong value or you misconfigured the limit.

Neil Romig7 years ago

So is it possible to isolate the source of the problem? In my maxSpeed test there was no record of the speed being over 70 knots.

Anton Tananaev7 years ago

Why would it be impossible? It's totally possible. Someone just needs to do it and look at your configuration and decode messages in question.

Neil Romig7 years ago

Apologies for being slow, but that means my HEX message at 16:26:50 contained 6 records, one of which was filtered?

Anton Tananaev7 years ago

Looks like it.

Neil Romig7 years ago

Thanks for not being too sarcastic with me.

Neil Romig7 years ago

I have decoded the HEX message and the speed reported was 51km/h (27.5 knots) in the 3rd (filtered) record. I had set MaxSpeed to 70 so surely it shouldn't have been filtered?
The record broken up by data element is :

00000162bf9a4408
00
fdcbc8ea
1e171155
0020
0060
05
0033 (speed 51 km/h)
00
03
01
ef
01
01
18
0027
01
c7
00000000
00
Anton Tananaev7 years ago

For max speed filtering speed is calculated from distance and time.

Neil Romig7 years ago

OK thanks, after more decoding the calculated speed value for the 3rd record would have been 641 knots.

Xiao Zhou5 years ago

I have a question in the attribute column. What's the distance and total distance are measuring, using the first person's data as an example? What's the default unit?