Browse Source

Copter: use fast tan for accel to lean angle calcs

Committed on behalf of Leonard
master
Randy Mackay 12 years ago
parent
commit
a1926441da
  1. 4
      libraries/AC_WPNav/AC_WPNav.cpp

4
libraries/AC_WPNav/AC_WPNav.cpp

@ -585,8 +585,8 @@ void AC_WPNav::get_loiter_acceleration_to_lean_angles(float accel_lat, float acc @@ -585,8 +585,8 @@ void AC_WPNav::get_loiter_acceleration_to_lean_angles(float accel_lat, float acc
accel_right = -accel_lat*_sin_yaw + accel_lon*_cos_yaw;
// update angle targets that will be passed to stabilize controller
_desired_roll = constrain_float((accel_right*_cos_pitch/(-z_accel_meas))*(18000/M_PI), -_lean_angle_max, _lean_angle_max);
_desired_pitch = constrain_float((-accel_forward/(-z_accel_meas))*(18000/M_PI), -_lean_angle_max, _lean_angle_max);
_desired_roll = constrain_float(fast_atan(accel_right*_cos_pitch/(-z_accel_meas))*(18000/M_PI), -_lean_angle_max, _lean_angle_max);
_desired_pitch = constrain_float(fast_atan(-accel_forward/(-z_accel_meas))*(18000/M_PI), -_lean_angle_max, _lean_angle_max);
}
// get_bearing_cd - return bearing in centi-degrees between two positions

Loading…
Cancel
Save