Copter: Fix zero throttle flip issue Stabilize

The problem is that the init_targets is intended to ensure the
controller doesn't build up the I term when the throttle is low. Because
it is poorly named (or used) it have been written to do something else.
Here I change it to do what the code is trying to use it to do.
This commit is contained in:
lthall 2014-05-21 23:55:05 +09:30 committed by Randy Mackay
parent 105382bf21
commit 1bdde31f6b
1 changed files with 2 additions and 11 deletions

View File

@ -72,18 +72,9 @@ void AC_AttitudeControl::set_dt(float delta_sec)
// init_targets - resets target angles to current angles // init_targets - resets target angles to current angles
void AC_AttitudeControl::init_targets() void AC_AttitudeControl::init_targets()
{ {
// set earth frame angle targets to current lean angles // ensure zero error in body frame rate controllers
_angle_ef_target.x = _ahrs.roll_sensor;
_angle_ef_target.y = _ahrs.pitch_sensor;
_angle_ef_target.z = _ahrs.yaw_sensor;
// clear body frame angle errors
_angle_bf_error.zero();
// clear earth-frame and body-frame feed forward rates
const Vector3f& gyro = _ins.get_gyro(); const Vector3f& gyro = _ins.get_gyro();
_rate_bf_desired = gyro * AC_ATTITUDE_CONTROL_DEGX100; _rate_bf_target = gyro * AC_ATTITUDE_CONTROL_DEGX100;
frame_conversion_bf_to_ef(_rate_bf_desired,_rate_ef_desired);
} }
// //