How do I calculate process noise covariance matrix Q and measurement noise covariance matrix R in kalman filter?

594 Views Asked by At

I am working on fusing GPS and IMU sensor measurement to calculate position in x and y direction. In this process I am not able to figure out how to calculate Q and R matrix values for kalman filtering.

Some details of implementation

  • GPS coordinate are converted from geodetic to local NED coordinates
  • IMU sensor data (Accelerometer, Gyroscope and Magnetometer) values are fused using AHRS filter to get roll, pitch and yaw angles
  • IMU sensor measurement (acceleration) is converted from body coordinate to NED coordinate using rotation matrix

I am getting IMU and GPS sensor values from my mobile phone. I am stuck at a point getting a method to calculate correct Q and R matrix values.

As of now, I am using constant values Q = diag[0.001,0.001] and R = diag[2000000,4000000] (this looks weird) using these values I am getting somewhat fused position estimates. When value of R is set to low value for example [10,20] the estimated position follows exactly GPS coordinates, there is no influence of IMU sensor measurements.

I trying to figure out why high value for measurement noise matrix works, I assume since I am converting GPS coordinate from geodetic to local NED values, so the need for higher values. But anyway I am sure this is not the right way to calculate this.

2

There are 2 best solutions below

0
imuengine.io On

As you've discovered, in most cases it is the ratio of R to Q that determines the estimator behavior.

The Kalman filter time-update equations, measurement-update equations, and the sampling time will say something about the units of Q and R.

0
ali mobini On

For calculating the Q it depends on dynamic of your system and accurecy of your GPS or Data that you have if the dynamic of the system is slow and accuracy of your data high you can set the Q lower and if dynamic of the system is fast and accuracy of the GPS is low you should consider increasing the Q and use higher value for your Q