# Covariance matrix for the PoseWithCovariance in Odometry.msg To disclaim, I do not have a solid understanding of covariance matrices. I'm also still using electric.

The Odometry.msg includes a geometry_msgs/PoseWithCovariance, which itself includes a geometry_msgs/Pose and a 6x6 covariance matrix. If the Point has three variables and the Quaternion has four variables, why isn't the covariance matrix 7x7?

Also, are the comments in the PoseWithCovariance.msg file inaccurate when they refer to the roll, pitch and yaw instead of to a quaternion?

edit retag close merge delete

Sort by » oldest newest most voted The reason the covariance is 6x6 and not 7x7 even though the quaternion has four variables is because the covariance is specified for the 3 angles that the quaternion represents, roll, pitch and yaw, not the individual components of the quaternion. That is the reason that the comments refer to roll, pitch and yaw instead of the quaternion components. If you wanted to apply those error estimates to the quaternion, you would have to either do some error propogation to get estimates for the quaternion components or (more commonly) extract the roll, pitch and yaw angles from the quaternion.

Usually we have estimates for each of those angles individually (along with their covariance) and then generate a quaternion from the three angles in order to have an unambiguous representation of the rotation. By keeping the covariance relative to roll, pitch and yaw instead of quaternion components, there is no need to do any complicated error propogation through the math that creates a quaternion from RPY.

See http://answers.ros.org/question/9446/how-do-i-compute-the-covariance-matrix-for-an/ for some discussion of how to compute the covariance.

more