ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

"process_noise_covariance" and "initial_estimate_covariance" in EKF-global and EKF-local

asked 2021-11-23 03:12:11 -0500

Delbina gravatar image

hi everyone,

in EKF-global and EKF-local related to the robot-localization package, there are two parameters: "process_noise_covariance" and "initial_estimate_covariance". how can i tune "process_noise_covariance" and "initial_estimate_covariance" for a 4wheel differential robot. the values on the diagonal are based on what? I would be grateful if someone explain to me these two parameters.


edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2021-11-23 17:27:40 -0500

osilva gravatar image

updated 2021-11-23 17:30:29 -0500

Hi @Masoum, the following are definitions from the robot_localization package

The estimate covariance, commonly denoted P or R, defines the error in the current state estimate. The parameter allows users to set the initial value for the matrix, which will affect how quickly the filter converges. For example, if users set the value at position [0,0] to a very small value, e.g., 1e-12, and then attempt to fuse measurements of X position with a high variance value for X, then the filter will be very slow to “trust” those measurements, and the time required for convergence will increase. Again, users should take care with this parameter. When only fusing velocity data (e.g., no absolute pose information), users will likely not want to set the initial covariance values for the absolute pose variables to large numbers. This is because those errors are going to grow without bound (owing to the lack of absolute pose measurements to reduce the error), and starting them with large values will not benefit the state estimate.

The process noise covariance, commonly denoted Q, is used to model uncertainty in the prediction stage of the filtering algorithms. It can be difficult to tune, and has been exposed as a parameter for easier customization. This parameter can be left alone, but you will achieve superior results by tuning it. In general, the larger the value for Q relative to the variance for a given variable in an input message, the faster the filter will converge to the value in the measurement.

There are many methods to initialize the covariances. As stated in the robot_localization package, one approach is to use trial and error, others call it engineer's intuition. You can start by working with very small values and measure the results based on time to converge. For the process noise covariance, you can tune by starting 'high' and lowering until you are satisfied. The disadvantage of this method is that is time consuming and there are many combinations possible. You will be optimizing one parameter at the time.

If you are looking for a systematic approach, you can use the proposed method in this paper: The paper proposes for example to use the ratio of Q/R looking for smallest SME (square mean error) to find the best performance, rather than optimizing one parameter at the time. But it's not the only proposed approach in this paper, there are more. I'd highly recommend reading it.

Another approach I have seen is to use PSO (Particle Swarm Optimization) for EKF tuning with great results: This is a more consistent approach to finding parameters, however is more complex to implement.

edit flag offensive delete link more


Thanks a lot, @osilva, one more question, what would happen if these two parameters are not set properly? I mean what is the impact in the result that we can say it is because of these two parameters!

Delbina gravatar image Delbina  ( 2021-11-24 03:41:37 -0500 )edit

Glad it helped. Pls accept the answer so we can close the cycle.

Regarding your last question. With respect to R if not properly ser it can quickly get out of bounds and will not converge. Q will affect the time of convergence

osilva gravatar image osilva  ( 2021-11-24 04:19:08 -0500 )edit

hi @osilva, what are the values in the diagonal of "process_noise_covariance" and "initial_estimate_covariance" indicative of? and we have defined a number of odometry information, in ekf-se-map, i mean odometry of GPS, wheel odometer, imu, and odometry information from my slam. so i want to know process_noise_covariance" and "initial_estimate_covariance" are related to which of these information?


Delbina gravatar image Delbina  ( 2022-02-10 17:25:06 -0500 )edit

Question Tools



Asked: 2021-11-23 03:12:11 -0500

Seen: 960 times

Last updated: Nov 23 '21