diff --git a/src/modules/ekf2/EKF2.cpp b/src/modules/ekf2/EKF2.cpp index f3590e3d4ced..a40289f7b340 100644 --- a/src/modules/ekf2/EKF2.cpp +++ b/src/modules/ekf2/EKF2.cpp @@ -2408,9 +2408,9 @@ void EKF2::UpdateGpsSample(ekf2_timestamps_s &ekf2_timestamps) if (fabsf(_param_ekf2_gps_yaw_off.get()) > 0.f) { if (!PX4_ISFINITE(vehicle_gps_position.heading_offset) && PX4_ISFINITE(vehicle_gps_position.heading)) { // Apply offset - float raw_yaw_offset = matrix::wrap_pi(math::radians(_param_ekf2_gps_yaw_off.get())); - vehicle_gps_position.heading_offset = raw_yaw_offset; - vehicle_gps_position.heading = matrix::wrap_pi(vehicle_gps_position.heading - raw_yaw_offset); + float yaw_offset = matrix::wrap_pi(math::radians(_param_ekf2_gps_yaw_off.get())); + vehicle_gps_position.heading_offset = yaw_offset; + vehicle_gps_position.heading = matrix::wrap_pi(vehicle_gps_position.heading - yaw_offset); } }