# Why decrease EKF2\_GPS\_V\_NOISE and EKF2\_GPS\_P\_NOISE Parameters when using RTK GPS

**URL:** <https://discuss.px4.io/t/why-decrease-ekf2-gps-v-noise-and-ekf2-gps-p-noise-parameters-when-using-rtk-gps/19746>\
**Category:** PX4 Autopilot\
**Created:** [November 24, 2020, 8:46am UTC](https://discuss.px4.io/t/why-decrease-ekf2-gps-v-noise-and-ekf2-gps-p-noise-parameters-when-using-rtk-gps/19746 "2020-11-24T08:46:44Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![sofa03](https://discuss.px4.io/user_avatar/discuss.px4.io/sofa03/32/15668_2.png) [@sofa03](https://discuss.px4.io/u/sofa03)\
**Post date:** [November 24, 2020, 8:46am UTC](https://discuss.px4.io/t/why-decrease-ekf2-gps-v-noise-and-ekf2-gps-p-noise-parameters-when-using-rtk-gps/19746/1 "2020-11-24T08:46:44Z")

</div>

Hello,  
as desribed at [https://docs.px4.io/master/en/gps\_compass/rtk\_gps.html](https://docs.px4.io/master/en/gps_compass/rtk_gps.html) one should decrease those two parameters when using the RTK GPS. In my understanding this is due to the fact, that the RTK GPS is way more accurate than a normal one and therefore the Pixhawk shouldn’t assume such a big noise.

My question is where exactly are these parameter changes taken into account? Meaning how does the PX4 act different when using a smaller noise in comparison to a bigger one?  
And how much should I decrease this parameters when using the RTK?

Thanks a lot.  
Best regards,  
Fabian

---

<div class="post-metadata">

**Author:** ![bresch](https://discuss.px4.io/user_avatar/discuss.px4.io/bresch/32/2343_2.png) [@bresch](https://discuss.px4.io/u/bresch)\
**Post date:** [November 25, 2020, 6:33pm UTC](https://discuss.px4.io/t/why-decrease-ekf2-gps-v-noise-and-ekf2-gps-p-noise-parameters-when-using-rtk-gps/19746/2 "2020-11-25T18:33:43Z")

</div>

Hi @sofa03 ,

PX4 fuses the GPS position and velocity data in an extended Kalman filter (named [ekf2](https://docs.px4.io/master/en/advanced_config/tuning_the_ecl_ekf.html)), weighting each measurement with its expected noise. In case of GPS, the receiver also reports an estimated accuracy (eph, epv) and are used by the filter. However, to prevent fusing incorrect data from an over-optimistic receiver, the minimum reported noise is limited using two parameters: [EKF2\_GPS\_P\_NOISE](https://dev.px4.io/master/en/advanced/parameter_reference.html#EKF2_GPS_P_NOISE) and [EKF2\_GPS\_V\_NOISE](https://dev.px4.io/master/en/advanced/parameter_reference.html#EKF2_GPS_V_NOISE) for the position and velocity measurements, respectively.  
Their default values are good for most common GNSS receivers, but are too large when having additional RTK correction. For this reason, you can reduce those parameters depending of the level of accuracy of your receiver to get better results.

---

<div class="post-metadata">

**Author:** ![sofa03](https://discuss.px4.io/user_avatar/discuss.px4.io/sofa03/32/15668_2.png) [@sofa03](https://discuss.px4.io/u/sofa03)\
**Post date:** [November 26, 2020, 8:03am UTC](https://discuss.px4.io/t/why-decrease-ekf2-gps-v-noise-and-ekf2-gps-p-noise-parameters-when-using-rtk-gps/19746/3 "2020-11-26T08:03:49Z")

</div>

Hi @bresch,

First of all thanks for your answer. The GPS receiver reports the accuracy, but isn’t the estimated accuracy the fields h\_acc and v\_acc of Mavlink message GPS\_RAW\_INT #24 instead of eph and epv? Because eph and epv just give me an idea reagarding the constellation of satellites, right?  
Or do you know, if h\_acc and v\_acc are calculated by taking epv and eph into account?  
Thanks.

---

<div class="post-metadata">

**Author:** ![bresch](https://discuss.px4.io/user_avatar/discuss.px4.io/bresch/32/2343_2.png) [@bresch](https://discuss.px4.io/u/bresch)\
**Post date:** [November 26, 2020, 8:27am UTC](https://discuss.px4.io/t/why-decrease-ekf2-gps-v-noise-and-ekf2-gps-p-noise-parameters-when-using-rtk-gps/19746/4 "2020-11-26T08:27:38Z")

</div>

Yes and no, the issue here is that there is a really annoying error in that MAVLink message ([https://github.com/mavlink/mavlink/issues/1063](https://github.com/mavlink/mavlink/issues/1063)):

| Description | PX4 | MAVLink |
| --- | --- | --- |
| Position accuracy (m) | eph, epv | h\_acc, v\_acc |
| Dilution of precision (-) | hdop, vdop | eph, epv |
| Speed accuracy (m/s) | s\_variance\_m\_s | vel\_acc |

(MAVLink uses `eph`, `epv` incorrectly and in PX4, `s_variance_m_s` is actually a standard deviation and not a variance)

So, when I said eph, epv, I actually meant “position accuracy” (h\_acc, v\_acc in MAVLink).

MAVLink msg: [https://mavlink.io/en/messages/common.html#GPS\_RAW\_INT](https://mavlink.io/en/messages/common.html#GPS_RAW_INT)  
PX4 msg: [https://github.com/PX4/PX4-Autopilot/blob/master/msg/vehicle\_gps\_position.msg](https://github.com/PX4/PX4-Autopilot/blob/master/msg/vehicle_gps_position.msg)

---

<div class="post-metadata">

**Author:** ![sofa03](https://discuss.px4.io/user_avatar/discuss.px4.io/sofa03/32/15668_2.png) [@sofa03](https://discuss.px4.io/u/sofa03)\
**Post date:** [November 27, 2020, 12:33pm UTC](https://discuss.px4.io/t/why-decrease-ekf2-gps-v-noise-and-ekf2-gps-p-noise-parameters-when-using-rtk-gps/19746/5 "2020-11-27T12:33:54Z")

</div>

One more question that came to my mind today:  
In my understanding the RTCM messages providing the correction by the RTK base are processed by the GPS module itself and therefore the h\_acc(eph) and v\_acc (epv) are already calculated using the corrected position?

This would result in the ekf2 of PX4 not taking the RTCM messages as input, as they have already been merged into the GPS Position by the GNSS.

Concluding the h\_acc and v\_acc only provide an accuracy estimation before the ekf2. Is there a way to get some kind of accuracy estimation following the ekf2?

---

<div class="post-metadata">

**Author:** ![bresch](https://discuss.px4.io/user_avatar/discuss.px4.io/bresch/32/2343_2.png) [@bresch](https://discuss.px4.io/u/bresch)\
**Post date:** [November 30, 2020, 8:48am UTC](https://discuss.px4.io/t/why-decrease-ekf2-gps-v-noise-and-ekf2-gps-p-noise-parameters-when-using-rtk-gps/19746/6 "2020-11-30T08:48:44Z")

</div>

> [@sofa03](#):
>
> In my understanding the RTCM messages providing the correction by the RTK base are processed by the GPS module itself and therefore the h\_acc(eph) and v\_acc (epv) are already calculated using the corrected position?

Yes

> [@sofa03](#):
>
> This would result in the ekf2 of PX4 not taking the RTCM messages as input, as they have already been merged into the GPS Position by the GNSS.

Correct

> [@sofa03](#):
>
> Concluding the h\_acc and v\_acc only provide an accuracy estimation before the ekf2. Is there a way to get some kind of accuracy estimation following the ekf2?

Yes, the accuracy of the state estimate can be found in:

- MAVLink: [GLOBAL\_POSITION\_INT\_COV](https://mavlink.io/en/messages/common.html#GLOBAL_POSITION_INT_COV) and [LOCAL\_POSITION\_NED\_COV](https://mavlink.io/en/messages/common.html#LOCAL_POSITION_NED_COV) (covariance field).
- uORB: [vehicle\_global\_position](https://github.com/PX4/PX4-Autopilot/blob/aa80167b476957f546a33b4626752958e9d30518/msg/vehicle_global_position.msg#L20-L21) and [vehicle\_local\_position](https://github.com/PX4/PX4-Autopilot/blob/aa80167b476957f546a33b4626752958e9d30518/msg/vehicle_local_position.msg#L56-L59)

---

<div class="post-metadata">

**Author:** ![sofa03](https://discuss.px4.io/user_avatar/discuss.px4.io/sofa03/32/15668_2.png) [@sofa03](https://discuss.px4.io/u/sofa03)\
**Post date:** [December 1, 2020, 8:58am UTC](https://discuss.px4.io/t/why-decrease-ekf2-gps-v-noise-and-ekf2-gps-p-noise-parameters-when-using-rtk-gps/19746/7 "2020-12-01T08:58:57Z")

</div>

> [@bresch](#):
>
> > [@sofa03](#):
> >
> > In my understanding the RTCM messages providing the correction by the RTK base are processed by the GPS module itself and therefore the h\_acc(eph) and v\_acc (epv) are already calculated using the corrected position?
> 
> Yes
> 
> > [@sofa03](#):
> >
> > This would result in the ekf2 of PX4 not taking the RTCM messages as input, as they have already been merged into the GPS Position by the GNSS.
> 
> Correct
> 
> > [@sofa03](#):
> >
> > Concluding the h\_acc and v\_acc only provide an accuracy estimation before the ekf2. Is there a way to get some kind of accuracy estimation following the ekf2?

Okay, thanks a lot.

> [@bresch](#):
>
> Yes, the accuracy of the state estimate can be found in:
> 
> - MAVLink: [GLOBAL\_POSITION\_INT\_COV](https://mavlink.io/en/messages/common.html#GLOBAL_POSITION_INT_COV) and [LOCAL\_POSITION\_NED\_COV](https://mavlink.io/en/messages/common.html#LOCAL_POSITION_NED_COV) (covariance field).
> - uORB: [vehicle\_global\_position](https://github.com/PX4/PX4-Autopilot/blob/aa80167b476957f546a33b4626752958e9d30518/msg/vehicle_global_position.msg#L20-L21) and [vehicle\_local\_position](https://github.com/PX4/PX4-Autopilot/blob/aa80167b476957f546a33b4626752958e9d30518/msg/vehicle_local_position.msg#L56-L59)

I can receive and process the MAVLink message using my Mission Software, so thats the message I wll work with. As my experience with covariance is very limited, which element of the array in the covariance field acutally holds the estimated accuracy value?
