# How to estimate good values for the covariance matrices of imu and wheel odometry?

There is almost no (accessible) information on this topic. (I think) I understand intuitively their purpose. However, quantitatively not so much. Assuming a differential drive robot, with wheel encoders and an IMU with gyros, accelerometers, magnetic compass:

1. How do you find some reasonable values for a differential drive robot wheel odometry, starting from real parameters (encoder resolution or similar specs)?
2. How do you find some reasonable values for an IMU (again starting from physical specs, that you can find in the datasheet or measure)?
3. How accurate the covariance matrices have to be, for the purpose of EKF? a)Do you have to "tweak" the covariance so the EKF favors some source of measurement over the other (say when you get v_yaw from both wheel odometry and gyro)? b)If the covariance values are more qualitative, what would be some "typical" matrices to start with?
4. Finally the values that I use now, without having too much of an appreciation of their validity, are they "plausible"?

For wheel/encoder odometry:

odom_msg.pose.covariance[0] = 0.001;
odom_msg.pose.covariance[7] = 0.001;
odom_msg.pose.covariance[14] = 1000000;
odom_msg.pose.covariance[21] = 1000000;
odom_msg.pose.covariance[28] = 1000000;
odom_msg.pose.covariance[35] = 1000;

odom_msg.twist.covariance[0] = 0.001;
odom_msg.twist.covariance[7] = 0.001;
odom_msg.twist.covariance[14] = 0.001;
odom_msg.twist.covariance[21] = 1000000;
odom_msg.twist.covariance[28] = 1000000;
odom_msg.twist.covariance[35] = 1000;


For IMU:

msg.orientation_covariance = [
0.02 , 0    , 0,
0    , 0.02 , 0,
0    , 0    , 0.02
]

msg.angular_velocity_covariance = [
0.02, 0   , 0,
0   , 0.02, 0,
0   , 0   , 0.02
]

msg.linear_acceleration_covariance = [
0.04 , 0   , 0,
0    , 0.04, 0,
0    , 0   , 0.04
]


I'm trying (unsuccessfully) to improve the wheel odometry of my robot, and I'm preparing the details for another question, but the covariances are the biggest black spot for me, so I'm trying to clarify this subject first.

Originally posted by vane on ROS Answers with karma: 35 on 2020-06-02

Post score: 0

Comment by Tom Moore on 2020-06-29:
Re-tagged.

I found this https://answers.ros.org/question/346629/odometry-noise-estimation/. Maybe someone could tag it with "covariance", since it does not appear as a tag or in the title, so the search does not pick it.

Originally posted by vane with karma: 35 on 2020-06-03

This answer was ACCEPTED on the original site

Post score: 0