From 50e6d67a66da47e7fe3c94ff97b788404ad32542 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 18 Jun 2021 11:20:26 +1000 Subject: [PATCH] Plane: update for new double precision position APIs --- ArduPlane/quadplane.cpp | 6 +++--- ArduPlane/quadplane.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ArduPlane/quadplane.cpp b/ArduPlane/quadplane.cpp index 7560530314..11a0f41b5b 100644 --- a/ArduPlane/quadplane.cpp +++ b/ArduPlane/quadplane.cpp @@ -2547,7 +2547,7 @@ void QuadPlane::update_land_positioning(void) poscontrol.target_vel_cms = Vector3f(-pitch_in, roll_in, 0) * speed_max_cms; poscontrol.target_vel_cms.rotate_xy(ahrs_view->yaw); - poscontrol.target_cm += poscontrol.target_vel_cms * dt; + poscontrol.target_cm += (poscontrol.target_vel_cms * dt).topostype(); poscontrol.pilot_correction_active = (!is_zero(roll_in) || !is_zero(pitch_in)); if (poscontrol.pilot_correction_active) { @@ -3091,7 +3091,7 @@ void QuadPlane::setup_target_position(void) if (!loc.same_latlon_as(last_auto_target) || plane.next_WP_loc.alt != last_auto_target.alt || now - last_loiter_ms > 500) { - wp_nav->set_wp_destination(poscontrol.target_cm); + wp_nav->set_wp_destination(poscontrol.target_cm.tofloat()); last_auto_target = loc; } last_loiter_ms = now; @@ -3500,7 +3500,7 @@ bool QuadPlane::verify_vtol_land(void) if (poscontrol.pilot_correction_done) { reached_position = !poscontrol.pilot_correction_active; } else { - const float dist = (inertial_nav.get_position() - poscontrol.target_cm).xy().length() * 0.01; + const float dist = (inertial_nav.get_position().topostype() - poscontrol.target_cm).xy().length() * 0.01; reached_position = dist < descend_dist_threshold; } if (reached_position && diff --git a/ArduPlane/quadplane.h b/ArduPlane/quadplane.h index d91f6bf098..24d2567d11 100644 --- a/ArduPlane/quadplane.h +++ b/ArduPlane/quadplane.h @@ -478,7 +478,7 @@ private: uint32_t time_since_state_start_ms() const { return AP_HAL::millis() - last_state_change_ms; } - Vector3f target_cm; + Vector3p target_cm; Vector3f target_vel_cms; bool slow_descent:1; bool pilot_correction_active;