Home / Blog / Car Mileage: Why Do GLONASS and Odometer Differ? Part 4. Speed ​​and Course

Car Mileage: Why Do GLONASS and Odometer Differ? Part 4. Speed ​​and Course

In this article, we will analyze the methods for calculating the speed and direction of movement in transport telematics, and compare their accuracy on real data.

Car Mileage: Why Do GLONASS and Odometer Differ? Part 4. Speed ​​and Course

This publication could be titled similarly: “Car speed: why do the value in the navigator and the speedometer needle diverge?”

We cannot ignore the topic of speed in our series of articles, as we have previously found out that the odometer of a vehicle calculates the mileage based on the speed of movement. The direction or course of movement is a less important parameter, which is often used only to visualize the object marker on the map background. 

Speed

The driver can see the speed value thanks to the speedometer on the dashboard. The speedometer in any car (regardless of its brand, model, price) not only can, but must “lie”, and necessarily in the direction of overspeeding. Otherwise, it will be considered faulty. These requirements are defined by documents regulating the production of cars (or rather, speedometers for them). And the car manufacturers themselves always play it safe, based on standard engineering considerations. 

Figure 1. Typical car speedometer.
Figure 1. Typical car speedometer.

The requirement for introducing a speedometer correction that overstates the speed for global manufacturers is determined by UNECE requirement No. 39, which has been in operation in Russia for many years under the guise of GOST R41.39-99, and after 2019, this requirement was determined by GOST 12936-2017. The specific value of the speedometer overstatement is established by technical standards, but on average, manufacturers set the overstatement value at up to 10% of the actual speed. Moreover, the dependence is not linear, and as the speed increases, the overstatement value also increases.

The speedometer can hardly be called an accurate measuring device, but it is a must-have tool for a driver. In any case, in the tasks of transport monitoring and analytics, satellite data and software methods are relied upon. Getting the speed via CAN is also possible, as well as the odometer readings, but we already know that reading the CAN bus is an additional option in transport monitoring, so data via CAN is not always available. 

Figure 2. Visualization of the relationship between speed, time and distance.
Figure 2. Visualization of the relationship between speed, time and distance.

The most obvious way to calculate speed is to calculate it based on the change in coordinates. If two consecutive positions and a time interval between them are available, then the distance can be calculated, for example, using the  haversine formula . And knowing the distance traveled and the time of movement, it is easy to calculate the average, i.e. straight-line and uniform, speed.

Figure 3. Dragy Performance Meter (DRG70) GPS logger.
Figure 3. Dragy Performance Meter (DRG70) GPS logger.

The speed can be adjusted by additional sensors from the inertial unit (IMU). Car trackers equipped with IMU additionally use an accelerometer to determine acceleration, which allows calculating speed more accurately during moments of rapid movement changes, as well as reducing “unwinding” during stops. For example, a professional GPS logger for measuring car acceleration Dragy uses all sorts of technical means to obtain the most accurate result, which also affects its final cost.

Figure 4. Pseudorange and pseudospeed.
Figure 4. Pseudorange and pseudospeed.

In satellite navigation, there is a concept of pseudo-speed, defined as the derivative of pseudo-range with respect to time, where pseudo-range is the distance between the satellite and the receiver, calculated based on the signal propagation time without correction for the discrepancy between the clocks of the satellite and the receiver.

In simple terms, pseudo-velocity is the rate of change of distance between the satellite and the receiver, determined without taking into account the difference in frequency in the receiver from the nominal frequency values ​​on the satellite. It is used to determine the velocity vector of the satellite receiver. 

Figure 5. Algorithm of operation of navigation equipment.
Figure 5. Algorithm of operation of navigation equipment.

Pseudovelocity can be determined in real time without the need to accurately determine the current coordinates of the object. Using the Doppler shift, the GNSS receiver calculates the relative velocity for each visible satellite. The resulting velocity is the vector sum of all velocities calculated relative to the satellites.

The Doppler shift is based on  the Doppler effect : the frequency of the signal emitted by a satellite changes depending on the relative speed between the satellite and the receiver. The navigation receiver measures the difference between the expected and received frequency of the satellite signal and calculates the relative speed of the object.

For high accuracy, the pseudo-velocity must be refined using coordinate change data and other sensor readings. As a result, this combined approach of the formula  speed = distance / time , inertial unit with acceleration sensors and Doppler shift provides high accuracy, up to ±0.1 km/h.

Most modern car trackers use the method of determining speed using GPS coordinates, as well as correction using an inertial unit. If you have a CAN bus reader, you can additionally receive speed from the car, for example, to use these readings in areas of poor or absent satellite signal. Using the Doppler shift is only available in high-precision receivers and expensive professional trackers, such as Dragy, which was mentioned above. Below is a table of various methods used to determine the speed of an object:

MethodAccuracyPeculiarities
Speedometer+5–10%Overstatement according to GOST
CAN (speed sensor)±0.5–1%Depends on the technical condition of the vehicle
GNSS±0.1–1 km/hDepends on the stability of the signal
IMU (accelerometer)High (±0.1 km/h)Correction of sudden accelerations
Pseudovelocity (Doppler)High (±0.1 km/h)Real time, no coordinates

Unfortunately, our dataset does not include the CAN speed. But we can compare the speed calculated by the GPS tracker with the speed we calculate ourselves using the formula  speed = path / time  for each consecutive pair of points. First, let’s look at all the GPS speed readings for the same object that we used to analyze the heights  in the previous article :

And let’s look separately at speeds greater than zero, since parking for vehicles is a fairly typical condition. For example, for a light personal vehicle, the parking condition in most cases can exceed 90% of the total time (travel mode “work / home”). For commercial vehicles, in particular trucks, this figure usually fluctuates around 50%. If we exclude all points with zero speed, the result will be as follows:

A very typical picture for a car, given the speed limits in the traffic rules. But let’s take a larger sample, say 50 random vehicles from the dataset. This is about 20 million points:

The picture hasn’t changed much. Half the time the cars are stationary, and the other half they are mostly moving at speeds up to 60 km/h. And the limit of 90 km/h on the highway with an increase of 19 km/h before receiving a fine from cameras is also visible on the graph 😉 Below is a table of percentiles by speed with a step of 0.05 for the entire dataset:

Now let’s write a SQL query that allows us to calculate the speed based on the distance and time between pairs of points in our table. To calculate the distances, we use the PostGIS function ST_Distance, which we learned about in the previous article. Here we use two CTE queries to first collect pairs of neighboring points, then calculate the distance between them, and then in the main query, using the formula  speed = path / time,  we calculate the average speed in km/h:

Now let’s transfer the query to Jupyter and look at the deviations and correlation:

The result is a very high correlation and minimal deviation, which means that the speed calculation in this GPS tracker is very close to our calculation. This tracker uses the SimCom SIM868E module, which updates GNSS data at a frequency of 1 Hz (once per second), and the interaction is carried out via the NMEA (National Marine Electronics Association) protocol with RMC (Recommended Minimum Specific GNSS Data) text messages.

It would be interesting to add the CAN speed to this comparison, perhaps we will do so in one of the articles outside the scope of this series, but even without this, we can conclude that the GNSS speed readings are quite accurate, provided there is a stable satellite signal and a good component base of the receiver itself.

Well

The course indicates the direction of the object’s movement relative to the geographic north.  The geographic azimuth (direction angle)  is a horizontal angle measured on a plane clockwise from 0° to 360° between the northern direction of the axial meridian of the rectangular coordinate zone (the grid line of the topographic map) and the direction to the landmark. 

In navigation equipment, the course is calculated based on successive coordinates using trigonometric formulas and is updated only during movement. If the object is stationary, the tracker can return the course of the last movement. At low speeds (less than 5 km / h), the course can be unstable due to minor changes in coordinates.

In a similar way to speed, we will try to calculate the direction of movement programmatically and compare it with the values ​​received from the tracker itself. We will use the built-in PostGIS function ST_Azimuth:

The ST_Azimuth function calculates the azimuth between two points on a spherical surface using spherical trigonometry. It is based on the  azimuth formula  for spherical coordinates. If the coordinates of the points coincide, the function returns an empty value (NULL). Now let’s transfer this SQL query to Jupyter and visualize the data:

The graphs show that there are 2 types of areas. In one area, the data is very close and there is virtually no noise, in the other, there is maximum spread and no correlation. Let’s find the transition area from one type of area to another and take a closer look:

I also derived the speed, because everything is quite obvious. At points where the speed is zero, i.e. the object does not move, software calculation of the azimuth is impossible, but the GPS azimuth is present, because the navigation terminal continues to record the direction. As previously indicated, this is either just the last known direction, or its corrected value using the same inertial unit with an accelerometer.

This particular tracker does not have an acceleration sensor and the course during parking fluctuates in the entire range from 0 to 360 degrees. Therefore, if it is impossible to correct the course on the side of the navigation equipment, at a minimum, it is worth cutting off the direction of movement under the condition of zero or better near-zero (less than 5 km/h) speed.


We have considered methods for calculating speed and direction of movement in satellite navigation and transport telematics. It is shown that the speed by GNSS has high accuracy with a stable signal. The use of additional sensors allows you to adjust the readings during sharp accelerations. Doppler shift is an excellent way to calculate speed, but is only available in expensive professional equipment. Software calculation of azimuth requires taking into account parking, where the data becomes incorrect.  

And  in the next article  we will analyze the validity flag, which is determined by the internal algorithms of the tracker, the number of visible satellites when solving the navigation problem and the value of the horizontal dilution of precision (HDOP).