
As you can see there:
http://www.ros.org/doc/api/geometry_msgs/html/msg/PoseWithCovariance.html
the covariance is a float[36] a 6x6 matrix. diagonal terms are the trust you have in your sensor for each Dof. You have 6 Dof, position (x, y, z) and orientation (x, y, z) even if you can see the orientation in Quaternion.
You can estimate your sensor or algorithm accuracy with experiment. If you see your data are good for 1cm in translation and 0.1 radian in rotation you can use this matrix:
[0.01 0.0 0.0 0.0 0.0 0.0,
0.0 0.01 0.0 0.0 0.0 0.0,
0.0 0.0 0.01 0.0 0.0 0.0,
0.0 0.0 0.0 0.1 0.0 0.0,
0.0 0.0 0.0 0.0 0.1 0.0,
0.0 0.0 0.0 0.0 0.0 0.1]
If you have no information for one Dof you can put a huge value.
Originally posted by jep31 with karma: 411 on 2013-06-11
This answer was ACCEPTED on the original site
Post score: 2
Original comments
Comment by barrybear on 2013-06-11:
Cool.. thanks! I understand it a little better now..so how do I implement it in the codes? Do I implement in the robot_pose_ekf library or the ROSARIA/viso2?
Comment by jep31 on 2013-06-11:
I don't know how works viso2, do it send directly a nav_msgs::Odometry of your robot without covariance ? If it does, you can write a new node which reads the topic from viso2, add the covariance and publish the whole msg to robot_pose_ekf. Avoid as much as you can modify an existing package.
Comment by barrybear on 2013-06-11:
Yeah viso2 and RosAria sends out the nav_msgs::Odometry without covariance if im not wrong. Oh alright, do you happen to have any sample that I may refer to in writing that extra new node? Still a bit unclear and not farmilar with the tutorial..
Comment by Johannes Meyer on 2013-06-11:
The covariance matrix contains the variance of the vector components on its diagonal, not their standard deviation. In jep31's example, either the diagonal entries of the covariance matrix should be squared, or you have to take the variance from your data, which would have the units m² and radian².