mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
Plane: use origin-relative altitudes rather than home-relative
This commit is contained in:
parent
4b49b80ef2
commit
03e4843764
@ -2821,7 +2821,7 @@ void QuadPlane::vtol_position_controller(void)
|
|||||||
if (plane.control_mode == &plane.mode_guided || vtol_loiter_auto) {
|
if (plane.control_mode == &plane.mode_guided || vtol_loiter_auto) {
|
||||||
plane.ahrs.get_location(plane.current_loc);
|
plane.ahrs.get_location(plane.current_loc);
|
||||||
int32_t target_altitude_cm;
|
int32_t target_altitude_cm;
|
||||||
if (!plane.next_WP_loc.get_alt_cm(Location::AltFrame::ABOVE_HOME,target_altitude_cm)) {
|
if (!plane.next_WP_loc.get_alt_cm(Location::AltFrame::ABOVE_ORIGIN,target_altitude_cm)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (poscontrol.slow_descent &&
|
if (poscontrol.slow_descent &&
|
||||||
@ -2829,7 +2829,7 @@ void QuadPlane::vtol_position_controller(void)
|
|||||||
// gradually descend as we approach target
|
// gradually descend as we approach target
|
||||||
plane.auto_state.wp_proportion = plane.current_loc.line_path_proportion(plane.prev_WP_loc, plane.next_WP_loc);
|
plane.auto_state.wp_proportion = plane.current_loc.line_path_proportion(plane.prev_WP_loc, plane.next_WP_loc);
|
||||||
int32_t prev_alt;
|
int32_t prev_alt;
|
||||||
if (plane.prev_WP_loc.get_alt_cm(Location::AltFrame::ABOVE_HOME,prev_alt)) {
|
if (plane.prev_WP_loc.get_alt_cm(Location::AltFrame::ABOVE_ORIGIN,prev_alt)) {
|
||||||
target_altitude_cm = linear_interpolate(prev_alt,
|
target_altitude_cm = linear_interpolate(prev_alt,
|
||||||
target_altitude_cm,
|
target_altitude_cm,
|
||||||
plane.auto_state.wp_proportion,
|
plane.auto_state.wp_proportion,
|
||||||
|
Loading…
Reference in New Issue
Block a user