From df3c565cd8fff44080e309ca05caeea1e93a9f0e Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 14 Aug 2014 14:09:09 +1000 Subject: [PATCH] AP_L1_Control: prevent another NaN in L1 --- libraries/AP_L1_Control/AP_L1_Control.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libraries/AP_L1_Control/AP_L1_Control.cpp b/libraries/AP_L1_Control/AP_L1_Control.cpp index 8ffc15acd5..965f65542d 100644 --- a/libraries/AP_L1_Control/AP_L1_Control.cpp +++ b/libraries/AP_L1_Control/AP_L1_Control.cpp @@ -169,6 +169,9 @@ void AP_L1_Control::update_waypoint(const struct Location &prev_WP, const struct // if too small if (AB.length() < 1.0e-6f) { AB = location_diff(_current_loc, next_WP); + if (AB.length() < 1.0e-6f) { + AB = Vector2f(cosf(_ahrs.yaw), sinf(_ahrs.yaw)); + } } AB.normalize();