Plane: added ACRO_LOCKING parameter

this enables/disables the attitude locking in acro mode, allowing acro
to be a pure rate controller
This commit is contained in:
Andrew Tridgell 2013-10-04 22:15:53 +10:00
parent 5abf060c41
commit 081510d37a
3 changed files with 13 additions and 6 deletions

View File

@ -257,7 +257,7 @@ static void stabilize_acro(float speed_scaler)
/*
check for special roll handling near the pitch poles
*/
if (roll_rate == 0) {
if (g.acro_locking && roll_rate == 0) {
/*
we have no roll stick input, so we will enter "roll locked"
mode, and hold the roll we had when the stick was released
@ -284,7 +284,7 @@ static void stabilize_acro(float speed_scaler)
channel_roll->servo_out = rollController.get_rate_out(roll_rate, speed_scaler);
}
if (pitch_rate == 0) {
if (g.acro_locking && pitch_rate == 0) {
/*
user has zero pitch stick input, so we lock pitch at the
point they release the stick
@ -308,11 +308,9 @@ static void stabilize_acro(float speed_scaler)
}
/*
call the normal yaw stabilize for now. This allows for manual
rudder input, plus automatic coordinated turn handling. For
knife-edge we'll need to do something quite different
manual rudder for now
*/
stabilize_yaw(speed_scaler);
channel_rudder->servo_out = channel_rudder->control_in;
}
/*

View File

@ -115,6 +115,7 @@ public:
k_param_flybywire_climb_rate,
k_param_acro_roll_rate,
k_param_acro_pitch_rate,
k_param_acro_locking,
//
// 130: Sensor parameters
@ -350,6 +351,7 @@ public:
AP_Int16 alt_offset;
AP_Int16 acro_roll_rate;
AP_Int16 acro_pitch_rate;
AP_Int8 acro_locking;
// Misc
//

View File

@ -518,6 +518,13 @@ const AP_Param::Info var_info[] PROGMEM = {
// @User: Standard
GSCALAR(acro_pitch_rate, "ACRO_PITCH_RATE", 180),
// @Param: ACRO_LOCKING
// @DisplayName: ACRO mode attitude locking
// @Description: Enable attitude locking when sticks are released
// @Values: 0:Disabled,1:Enabled
// @User: Standard
GSCALAR(acro_locking, "ACRO_LOCKING", 0),
// @Param: TRIM_AUTO
// @DisplayName: Automatic trim adjustment
// @Description: Set RC trim PWM levels to current levels when switching away from manual mode. When this option is enabled and you change from MANUAL to any other mode then the APM will take the current position of the control sticks as the trim values for aileron, elevator and rudder. It will use those to set RC1_TRIM, RC2_TRIM and RC4_TRIM. This option is disabled by default as if a pilot is not aware of this option and changes from MANUAL to another mode while control inputs are not centered then the trim could be changed to a dangerously bad value. You can enable this option to assist with trimming your plane, by enabling it before takeoff then switching briefly to MANUAL in flight, and seeing how the plane reacts. You can then switch back to FBWA, trim the surfaces then again test MANUAL mode. Each time you switch from MANUAL the APM will take your control inputs as the new trim. After you have good trim on your aircraft you can disable TRIM_AUTO for future flights.