Plane: quadplane: fix wp_dist reporting for VTOL landings

After hitting the approach stage of a VTOL landing in auto, nav_controller_output sends zero as the distance to waypoint.
This commit is contained in:
Bob Long 2021-08-30 20:14:34 -04:00 committed by Andrew Tridgell
parent db6490818f
commit f2d32fc800
2 changed files with 4 additions and 1 deletions

View File

@ -181,7 +181,7 @@ void GCS_MAVLINK_Plane::send_nav_controller_output() const
targets.y * 1.0e-2f,
targets.z * 1.0e-2f,
wp_nav_valid ? quadplane.wp_nav->get_wp_bearing_to_destination() : 0,
wp_nav_valid ? MIN(quadplane.wp_nav->get_wp_distance_to_destination(), UINT16_MAX) : 0,
wp_nav_valid ? MIN(quadplane.wp_nav->get_wp_distance_to_destination() * 1.0e-2f, UINT16_MAX) : 0,
(plane.control_mode != &plane.mode_qstabilize) ? quadplane.pos_control->get_pos_error_z_cm() * 1.0e-2f : 0,
plane.airspeed_error * 100,
wp_nav_valid ? quadplane.wp_nav->crosstrack_error() : 0);

View File

@ -3371,6 +3371,9 @@ bool QuadPlane::using_wp_nav(void) const
if (plane.control_mode == &plane.mode_qrtl && poscontrol.get_state() >= QPOS_POSITION2) {
return true;
}
if (plane.control_mode == &plane.mode_auto && poscontrol.get_state() > QPOS_APPROACH) {
return true;
}
return false;
}