Ask Your Question

calculate NavSatFix covariance

asked 2011-06-18 21:07:00 -0600

Vaibhav Bajpai gravatar image

This is with reference to:

I am wondering how can I see the code behind position_covariance data structure filled in this message and how the four different parameters -


change the position_covariance values respectively.

Would appreciate some pointer link to where I can see the actual code. I am not able to find it.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2011-06-19 08:32:22 -0600

Chad Rockey gravatar image

Hi Vaibhav,

This message is part of sensor_msgs, these are designed to be output by "drivers" that communication with varying hardware and output a ROS unified message. An example of this would be LaserScan. It doesn't matter whether you're using a Hokuyo, a SICK, or even a Neato XV-11 laser, the responsibility of the driver is to talk to the sensor and publish the appropriate sensor_msg.

We're still going pretty slowly on actually providing code that uses any GPS signals, but I'll explain use cases for each of these definitions. It should be noted that these do NOT affect the actual covariance numbers, but are guidelines for how they should be used and trusted by a sensor fusion algorithm.


This is to be used when your GPS does not provide any quality estimation or you do not know to model the reported precision in SI units (m^2). Filtering algorithms will assume large possible errors with this case and some safety applications may outright reject this.


There are multiple use cases for this one, and for low cost GPS sensors, this will be the most used. The first would be for use cases like Android Location Services. This only returns a single float (in meters, so don't forget to square!) when you call getAccuracy(). One safe way to use the data would be to approximate the covariance as a diagonal matrix with the accuracy squared for each axis you wish to report.

Another use case would be for when your receiver outputs Dilution of Precision. If you only get one value, as above, you would take the dilution of precision value (somewhere between 1 [ideal] and >20 [really bad]) and multiply this by the ideal measurement error (usually a few meters, let's say 1.5m for now). So an HDOP (horizontal) dilution of precision of 2.3 would yield a 1.5m * 2.3 = 3.45m standard deviation and thus a variance of 11.90m^2 for latitude and longitude. Doing the same with height and HDOP should yield similar results.


This one is useful for high end GPS receivers that actually output variances or standard deviations for every measurement. Example: Our Novatel Propak HP-V3 outputs latitude deviation, longitude deviation, and height deviation. We simply have to square these values and plug them into the diagonal of the covariance matrix, leaving the other elements zero.


Represents what should be reported if the GPS receiver actually outputs the 3x3 covariance matrix as a set of 9 numbers. I expect these receivers to be fairly expensive and complicated. This set will be fully trusted by filtering algorithms as accurate, so don't report this if your receiver does not support full covariance matrices.

edit flag offensive delete link more

answered 2011-06-19 00:52:37 -0600

joq gravatar image

I don't know any example of code.

But, you might find the API review discussion helpful.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2011-06-18 21:07:00 -0600

Seen: 3,244 times

Last updated: Jun 19 '11