Copter: add roll-pitch slew for auto modes

Added reporting of roll, pitch inputs for ACRO, AUTO
This commit is contained in:
Randy Mackay 2013-02-18 15:26:17 +09:00 committed by rmackay9
parent e297ba7d18
commit d6ff5ae261
3 changed files with 13 additions and 6 deletions

View File

@ -1609,6 +1609,9 @@ void update_roll_pitch_mode(void)
{
switch(roll_pitch_mode) {
case ROLL_PITCH_ACRO:
// copy user input for reporting purposes
control_roll = g.rc_1.control_in;
control_pitch = g.rc_2.control_in;
#if FRAME_CONFIG == HELI_FRAME
if(g.axis_enabled) {
@ -1651,9 +1654,13 @@ void update_roll_pitch_mode(void)
break;
case ROLL_PITCH_AUTO:
// copy user input for reporting purposes
control_roll = g.rc_1.control_in;
control_pitch = g.rc_2.control_in;
// copy latest output from nav controller to stabilize controller
nav_roll = auto_roll;
nav_pitch = auto_pitch;
nav_roll += constrain_int32(wrap_180(auto_roll - nav_roll), -g.auto_slew_rate.get(), g.auto_slew_rate.get()); // 40 deg a second
nav_pitch += constrain_int32(wrap_180(auto_pitch - nav_pitch), -g.auto_slew_rate.get(), g.auto_slew_rate.get()); // 40 deg a second
get_stabilize_roll(nav_roll);
get_stabilize_pitch(nav_pitch);
@ -1697,8 +1704,8 @@ void update_roll_pitch_mode(void)
}
// copy latest output from nav controller to stabilize controller
nav_roll = auto_roll;
nav_pitch = auto_pitch;
nav_roll += constrain_int32(wrap_180(auto_roll - nav_roll), -g.auto_slew_rate.get(), g.auto_slew_rate.get()); // 40 deg a second
nav_pitch += constrain_int32(wrap_180(auto_pitch - nav_pitch), -g.auto_slew_rate.get(), g.auto_slew_rate.get()); // 40 deg a second
get_stabilize_roll(nav_roll);
get_stabilize_pitch(nav_pitch);
break;

View File

@ -444,7 +444,7 @@ const AP_Param::Info var_info[] PROGMEM = {
// @DisplayName: Auto Slew Rate
// @Description: This restricts the rate of change of the roll and pitch attitude commanded by the auto pilot
// @Units: Degrees/Second
// @Range: 1 45
// @Range: 1 90
// @Increment: 1
// @User: Advanced
GSCALAR(auto_slew_rate, "AUTO_SLEW", AUTO_SLEW_RATE),

View File

@ -968,7 +968,7 @@
#endif
#ifndef AUTO_SLEW_RATE
# define AUTO_SLEW_RATE 30 // degrees/sec
# define AUTO_SLEW_RATE 45 // degrees/sec
#endif
#ifndef AUTO_YAW_SLEW_RATE