From baa3e802ee1794ee5af5bbd6a0625ec73dcdb862 Mon Sep 17 00:00:00 2001 From: Jonathan Challinger Date: Mon, 2 Feb 2015 16:50:30 -0800 Subject: [PATCH] AC_WPNav: clean up atan2 --- libraries/AC_WPNav/AC_Circle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/AC_WPNav/AC_Circle.cpp b/libraries/AC_WPNav/AC_Circle.cpp index 0b09fe62d9..48accacea9 100644 --- a/libraries/AC_WPNav/AC_Circle.cpp +++ b/libraries/AC_WPNav/AC_Circle.cpp @@ -246,7 +246,7 @@ void AC_Circle::init_start_angle(bool use_heading) _angle = wrap_PI(_ahrs.yaw-PI); } else { // get bearing from circle center to vehicle in radians - float bearing_rad = ToRad(90) + fast_atan2(-(curr_pos.x-_center.x), curr_pos.y-_center.y); + float bearing_rad = fast_atan2(curr_pos.y-_center.y,curr_pos.x-_center.x); _angle = wrap_PI(bearing_rad); } }