|
|
|
@ -77,9 +77,9 @@ static void stabilize_roll(float speed_scaler)
@@ -77,9 +77,9 @@ static void stabilize_roll(float speed_scaler)
|
|
|
|
|
if (control_mode == STABILIZE && channel_roll->control_in != 0) { |
|
|
|
|
disable_integrator = true; |
|
|
|
|
} |
|
|
|
|
channel_roll->servo_out = g.rollController.get_servo_out(nav_roll_cd - ahrs.roll_sensor, |
|
|
|
|
speed_scaler, |
|
|
|
|
disable_integrator); |
|
|
|
|
channel_roll->servo_out = rollController.get_servo_out(nav_roll_cd - ahrs.roll_sensor, |
|
|
|
|
speed_scaler, |
|
|
|
|
disable_integrator); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* |
|
|
|
@ -94,9 +94,9 @@ static void stabilize_pitch(float speed_scaler)
@@ -94,9 +94,9 @@ static void stabilize_pitch(float speed_scaler)
|
|
|
|
|
if (control_mode == STABILIZE && channel_pitch->control_in != 0) { |
|
|
|
|
disable_integrator = true; |
|
|
|
|
} |
|
|
|
|
channel_pitch->servo_out = g.pitchController.get_servo_out(demanded_pitch - ahrs.pitch_sensor, |
|
|
|
|
speed_scaler, |
|
|
|
|
disable_integrator); |
|
|
|
|
channel_pitch->servo_out = pitchController.get_servo_out(demanded_pitch - ahrs.pitch_sensor, |
|
|
|
|
speed_scaler, |
|
|
|
|
disable_integrator); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* |
|
|
|
@ -265,16 +265,16 @@ static void stabilize_acro(float speed_scaler)
@@ -265,16 +265,16 @@ static void stabilize_acro(float speed_scaler)
|
|
|
|
|
nav_roll_cd = ahrs.roll_sensor + roll_error_cd; |
|
|
|
|
// try to reduce the integrated angular error to zero. We set |
|
|
|
|
// 'stabilze' to true, which disables the roll integrator |
|
|
|
|
channel_roll->servo_out = g.rollController.get_servo_out(roll_error_cd, |
|
|
|
|
speed_scaler, |
|
|
|
|
true); |
|
|
|
|
channel_roll->servo_out = rollController.get_servo_out(roll_error_cd, |
|
|
|
|
speed_scaler, |
|
|
|
|
true); |
|
|
|
|
} else { |
|
|
|
|
/* |
|
|
|
|
aileron stick is non-zero, use pure rate control until the |
|
|
|
|
user releases the stick |
|
|
|
|
*/ |
|
|
|
|
acro_state.locked_roll = false; |
|
|
|
|
channel_roll->servo_out = g.rollController.get_rate_out(roll_rate, speed_scaler); |
|
|
|
|
channel_roll->servo_out = rollController.get_rate_out(roll_rate, speed_scaler); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (pitch_rate == 0) { |
|
|
|
@ -289,15 +289,15 @@ static void stabilize_acro(float speed_scaler)
@@ -289,15 +289,15 @@ static void stabilize_acro(float speed_scaler)
|
|
|
|
|
// try to hold the locked pitch. Note that we have the pitch |
|
|
|
|
// integrator enabled, which helps with inverted flight |
|
|
|
|
nav_pitch_cd = acro_state.locked_pitch_cd; |
|
|
|
|
channel_pitch->servo_out = g.pitchController.get_servo_out(nav_pitch_cd - ahrs.pitch_sensor, |
|
|
|
|
speed_scaler, |
|
|
|
|
false); |
|
|
|
|
channel_pitch->servo_out = pitchController.get_servo_out(nav_pitch_cd - ahrs.pitch_sensor, |
|
|
|
|
speed_scaler, |
|
|
|
|
false); |
|
|
|
|
} else { |
|
|
|
|
/* |
|
|
|
|
user has non-zero pitch input, use a pure rate controller |
|
|
|
|
*/ |
|
|
|
|
acro_state.locked_pitch = false; |
|
|
|
|
channel_pitch->servo_out = g.pitchController.get_rate_out(pitch_rate, speed_scaler); |
|
|
|
|
channel_pitch->servo_out = pitchController.get_rate_out(pitch_rate, speed_scaler); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* |
|
|
|
@ -345,9 +345,9 @@ static void stabilize()
@@ -345,9 +345,9 @@ static void stabilize()
|
|
|
|
|
// we are low, with no climb rate, and zero throttle, and very |
|
|
|
|
// low ground speed. Zero the attitude controller |
|
|
|
|
// integrators. This prevents integrator buildup pre-takeoff. |
|
|
|
|
g.rollController.reset_I(); |
|
|
|
|
g.pitchController.reset_I(); |
|
|
|
|
g.yawController.reset_I(); |
|
|
|
|
rollController.reset_I(); |
|
|
|
|
pitchController.reset_I(); |
|
|
|
|
yawController.reset_I(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -386,7 +386,7 @@ static void calc_nav_yaw(float speed_scaler, float ch4_inf)
@@ -386,7 +386,7 @@ static void calc_nav_yaw(float speed_scaler, float ch4_inf)
|
|
|
|
|
if (control_mode == STABILIZE && channel_rudder->control_in != 0) { |
|
|
|
|
disable_integrator = true; |
|
|
|
|
} |
|
|
|
|
channel_rudder->servo_out = g.yawController.get_servo_out(speed_scaler, disable_integrator); |
|
|
|
|
channel_rudder->servo_out = yawController.get_servo_out(speed_scaler, disable_integrator); |
|
|
|
|
|
|
|
|
|
// add in rudder mixing from roll |
|
|
|
|
channel_rudder->servo_out += channel_roll->servo_out * g.kff_rudder_mix; |
|
|
|
|