Skip to content

Commit

Permalink
AC_Circle: fix initial angle
Browse files Browse the repository at this point in the history
  • Loading branch information
jschall committed Apr 19, 2016
1 parent 73e0852 commit fbc082a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
8 changes: 1 addition & 7 deletions libraries/AC_WPNav/AC_Circle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ void AC_Circle::init(const Vector3f& center)

// initialise angular velocity
_angular_vel = 0;

// set starting angle to current heading - 180 degrees
_angle = wrap_PI(_ahrs.yaw-PI);
}

/// init - initialise circle controller setting center using stopping point and projecting out based on the copter's heading
Expand Down Expand Up @@ -97,9 +94,6 @@ void AC_Circle::init()

// initialise angular velocity
_angular_vel = 0;

// set starting angle to current heading - 180 degrees
_angle = wrap_PI(_ahrs.yaw-PI);
}

/// update - update circle controller
Expand Down Expand Up @@ -245,7 +239,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 = fast_atan2(curr_pos.y-_center.y,curr_pos.x-_center.x);
float bearing_rad = atan2f(curr_pos.y-_center.y,curr_pos.x-_center.x);
_angle = wrap_PI(bearing_rad);
}
}
Expand Down
1 change: 1 addition & 0 deletions libraries/AC_WPNav/AC_Circle.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class AC_Circle

/// set_circle_center in cm from home
void set_center(const Vector3f& center) { _center = center; }
void get_center(Vector3f& center) { center = _center; }

/// get_circle_center in cm from home
const Vector3f& get_center() const { return _center; }
Expand Down

0 comments on commit fbc082a

Please sign in to comment.