# POS message and Secondary GPS

From what I’ve heard, the POS message contains the most reliable estimate of the vehicle’s position which is calculated from GPS and Accelerometer data. The POS data is used in the CAM message whenever the signal is sent to the camera to take a picture.

My question is, does the POS message use just the GPS1 Data? If I use a secondary GPS, Can I make sure that the GPS2 Data is used instead for the POS messages?

Or, How exactly is the POS message calculated? Can I Do the same math later by analysing the logs?

Thanks

1 Like

I’m not a dev, so I hope I have this right:

Short answer: POS is the estimate of position from the best available estimation-filter. It is difficult to reproduce this estimate by-math, but possible.

Longer answer: The POS message gets data from the call: ahrs.get_position(). What exactly the “ahrs” is depends on the available amount of computation and version of the firmware. On a fully-capable hardware platform (PixHawk) it’s the highest-complexity (read “best”) estimation filter, unless that filter hits some math error, in which case it’s second choice is the solution from a lower-complexity (simpler = not-as-good, but better than nothing!) estimation filter. I think with Plane 3.8 that NavEKF3 becomes the “best filter”, but with Plane 3.7 and earlier NavEKF2 was the best.

The GPS measurement is one of the key (arguably THE most important) measurement that drives the filter’s estimate. So the filter’s estimate will largely agree with GPS, but should not be identical. If you want the “2nd” GPS used instead of the first always, you need to make it GPS1, and make the other one GPS2. Alternatively, you can use GPS_AUTO_SWITCH to have the estimation filter use whichever GPS has the best quality solution.

If you want to reproduce the POS message by-math in post-processing, you’d need to implement the same Kalman Filter on the same data at the same timing. I expect that would be hard, although not impossible.

1 Like