# Number of diagonal elements in the pose covariance matrix

The control.yaml file inside the husky_gazebo package defines the value of the pose_covariance_diagonal parameter as [0.001, 0.001, 0.001, 0.001, 0.001, 0.03].

A pose is made up of 7 elements - [x, y, z,q_x, q_y, q_z, q_w]. So, shouldn't the number of elements in the pose_covariance_diagonal parameter be 7?

The quaternion part [q_x, q_y, q_z, q_w] has four numbers but is a representation of 3D orientation, which has 3 degrees of freedom. Another common representation for orientation is the matrix Lie group $$\mathrm{SO}(3)$$, which is the group of $$3\times 3$$ rotation matrices (9 numbers, but only 3 degrees of freedom). Neither the quaternion nor the rotation matrix are minimal representations (i.e., they take more numbers than the degrees of freedom), but they do not suffer the issues associated with, e.g., Euler angles (gimbal lock, ambiguity, etc.).

So, there are only 6 uncertainty values in pose_covariance_diagonal because there are only 6 degrees of freedom in a 3D pose (i.e., the matrix Lie group $$\mathrm{SE}(3)$$). These are uncertainties for each translation axis, and each rotation axis. See the PoseWithCovariance msg docs for more info.

• Makes sense. Thanks :-) Aug 12 at 15:50

Adding to Parker's answer, the quaternion is avoided many cases due to its complexity in getting a closed-form Jacobian. Also, it unnecessarily increases the number of optimization states. Due to these problems rotation vector (3x1) is usually preferred and that's why you see it as 3x1. Note that the rotation vector is different from Euler angles and does not have the gimbal lock and ambiguity problem.

Also, in terms of rotation uncertainty representation, the rotation vector is more intuitive than quaternion.