diff --git a/src/main/navigation/navigation_fixedwing.c b/src/main/navigation/navigation_fixedwing.c index 68232ed7e0b..ff38b2e17e5 100755 --- a/src/main/navigation/navigation_fixedwing.c +++ b/src/main/navigation/navigation_fixedwing.c @@ -401,6 +401,8 @@ static void updatePositionHeadingController_FW(timeUs_t currentTimeUs, timeDelta if (isWaypointNavTrackingActive()) { /* Calculate cross track error */ + posControl.wpDistance = calculateDistanceToDestination(&posControl.activeWaypoint.pos); + fpVector3_t virtualCoursePoint; virtualCoursePoint.x = posControl.activeWaypoint.pos.x - posControl.wpDistance * cos_approx(CENTIDEGREES_TO_RADIANS(posControl.activeWaypoint.bearing));