Sensor fusion for GPS location estimation with Kalman filters

A sneak peek into how I'm using a Kalman filter to combine the GPS position with the vehicle speed to improve the location estimation accuracy.

The software I developed for the 5G-CORAL project (connected cars demo) acquires several parameters, among which the vehicle's speed from the OBD-II port and the position from the GNSS receiver.

This inspired me to better understand the topic of sensor fusion, in particular I wanted to know how I could improve the accuracy of the GPS location by exploiting the knowledge of the speed of the vehicle, measured from the wheels' RPM. The idea behind this is pretty simple and intuitive. Let me try to explain:
If, due to random noise, the GPS location of the car jumps by several meters in a short amount of time, that would correspond to a sudden acceleration and change of speed. Since the speed of the car can be measured, it is possible to cross check the accuracy of the GPS reading.
In other words, it is possible to estimate the velocity of a vehicle by taking two GPS readings, calculate the distance between them and then by dividing by the elapsed time. The speed obtained in this way can be compared to a direct measure of the vehicle's speed and therefore it is possible to tell if the two measurements agree or not. If they don't, it means that the GPS position (which is considered to be more noisy) is inaccurate and the estimated position should be picked as a weighted average between the GPS position and the position predicted using the knowledge of the path of the vehicle up to that point and its current state (e.g. speed).
This logic is typically implemented using a Kalman Filter or its derivatives, such as the EKF (Extended Kalman Filter) or the UKF (Unscented Kalman Filter) which are used to deal with non linearities in the system or in the measurement.

I started the project with the development of a little Python game where you can drive a car around on the screen and simulate the Kalman filtering for location improvement.
The program samples the ground-truth (simulated) location and speed and adds noise to it. The samples are then sent to the Kalman filter which then estimates the position and velocity.
The NEES (normalized estimation error squared) and NIS (normalized innovation error squared) are used as KPIs for the filter performance.

The Kalman filter simulator I developed to showcase the improvements in accuracy achieved with data fusion
The Kalman filter simulator I developed to showcase the improvements in accuracy achieved with data fusion.
Yellow: ground truth; Green: measured location; White: estimated location

This is still a work in progress and the next steps will be to use the IMU (accelerometer and gyroscope) readings to better improve the location estimate by means of sensor fusion. Also, the currently used single-track bicycle model can be improved. In addition to this, I might consider using and adaptive filtering approach where more than one model is used for the state prediction and the best performing one is picked dynamically at runtime.