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

How can I visualize covariance data using ROS tools?

asked 2011-03-05 06:39:45 -0600

Are there any best practices for visualizing covariance data as uncertainty ellipses/ellipsoids using ROS tools, especially rviz? There's quite a few applications where this would be desirable (most notably gaussian position estimates of parametric filters).

Of course, one could write a conversion node that gets fed for example with PoseWithCovariance messages and outputs a MarkerArray containing a polygonal representation of the ellipse/ellipsoid, but that is a bit cumbersome IMHO.

Has anybody implemented code for this scenario? Is there anything planned in the short or long term for easing development of such visualizations (I'm thinking of rviz plugins, rviz2 etc here)?

edit retag flag offensive close merge delete


My roommate and I recently discussed this in the middle of our latest optimal control and estimation homework. We talked about how to visualize a 3x3 or even a 9x9 covariance matrix. I think an rviz plugin would be the best solution, but I haven't seen or heard of anything so far to do this.
William gravatar image William  ( 2011-03-05 08:36:56 -0600 )edit
Generally, the discussion was a deformed sphere for representing 3-dimension position data uncertainty. Representing pointing (roll/pitch/yaw) could then be a color map on the sphere. This only leaves one dimension of uncertainty out.
mjcarroll gravatar image mjcarroll  ( 2011-03-05 10:36:33 -0600 )edit
Indeed, this is also what came to my mind. A 2x2 or 3x3 covariance matrix could be visualized by computing the Eigenvectors and -values and then rotating and scaling a sphere marker accordingly. I did it similar for the 2D case here (non ROS):
Stefan Kohlbrecher gravatar image Stefan Kohlbrecher  ( 2011-03-05 18:34:42 -0600 )edit
Exactly what we were talking about. Perhaps it is time to add something like this into RVIZ's capabilities.
mjcarroll gravatar image mjcarroll  ( 2011-03-06 03:52:10 -0600 )edit
I did this also in Matlab, with 2D laser data, object separation with gaussian/ellipsoids.
szokei gravatar image szokei  ( 2011-03-11 02:51:34 -0600 )edit

3 Answers

Sort by » oldest newest most voted

answered 2011-03-07 01:54:46 -0600

joq gravatar image

This is an important feature that rviz does not handle, so I opened ticket #4857 to provide it.

If you are interested in helping to get this done, please add yourself to the CC: list for that ticket.

edit flag offensive delete link more

answered 2013-02-06 03:31:19 -0600

updated 2013-02-06 03:32:00 -0600

I recently implemented some code to visualize a 3x3 (x-y-z) covariance matrix, which might be useful.

It decomposes the matrix into 3 principal vectors using PCA, and visualizes them (+/- 3 sigma width) using rviz markers. It's assumed that the matrix also has a 3x1 vector associated with it, which sets the mean x-y-z position.

The code is here, relevant function is at line 218:


This is what 3 covariance matrices look like in rviz:

image description

edit flag offensive delete link more

answered 2013-02-06 02:48:50 -0600

updated 2013-02-06 02:51:20 -0600

This was already discussed here:

There I attatched a small piece of code to represent gaussian 3d poses that worked for me.

edit flag offensive delete link more

Question Tools



Asked: 2011-03-05 06:39:45 -0600

Seen: 5,776 times

Last updated: Feb 06 '13