From ae6220aace831c5d5eeaa3fc03e4059cb0091304 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 10 Jun 2021 11:22:51 +1000 Subject: [PATCH] Plane: cope with zero distance to target in QPOS_POSITION1 --- ArduPlane/quadplane.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ArduPlane/quadplane.cpp b/ArduPlane/quadplane.cpp index 1d71066b44..737cac0c43 100644 --- a/ArduPlane/quadplane.cpp +++ b/ArduPlane/quadplane.cpp @@ -2801,7 +2801,10 @@ void QuadPlane::vtol_position_controller(void) // run fixed wing navigation plane.nav_controller->update_waypoint(plane.current_loc, loc); - Vector2f target_speed_xy = diff_wp.normalized() * target_speed; + Vector2f target_speed_xy; + if (distance > 0.1) { + target_speed_xy = diff_wp.normalized() * target_speed; + } pos_control->set_vel_desired_xy_cms(target_speed_xy * 100); // reset position controller xy target to current position