Skip to content

Commit

Permalink
WP Mission Landing Elevation Setting (#6822)
Browse files Browse the repository at this point in the history
* Initial build

* Fix p1 error + change cm to meters

* Update navigation.c

Add correction if absolute SL landing elevation used (related PR #6662)
  • Loading branch information
breadoven committed May 3, 2021
1 parent 8547325 commit 40f2344
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/navigation/navigation.c
Original file line number Diff line number Diff line change
Expand Up @@ -1875,6 +1875,13 @@ static fpVector3_t * rthGetHomeTargetPosition(rthTargetMode_e mode)
break;

case RTH_HOME_FINAL_LAND:
// if WP mission p2 > 0 use p2 value as landing elevation (in meters !) (otherwise default to takeoff home elevation)
if (FLIGHT_MODE(NAV_WP_MODE) && posControl.waypointList[posControl.activeWaypointIndex].action == NAV_WP_ACTION_LAND && posControl.waypointList[posControl.activeWaypointIndex].p2 != 0) {
posControl.rthState.homeTmpWaypoint.z = posControl.waypointList[posControl.activeWaypointIndex].p2 * 100; // 100 -> m to cm
if (waypointMissionAltConvMode(posControl.waypointList[posControl.activeWaypointIndex].p3) == GEO_ALT_ABSOLUTE) {
posControl.rthState.homeTmpWaypoint.z -= posControl.gpsOrigin.alt; // correct to relative if absolute SL altitude datum used
}
}
break;
}

Expand Down

0 comments on commit 40f2344

Please sign in to comment.