mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-22 08:38:36 -04:00
Plane: limit roll and pitch to Q_ANGLE_MAX in Q modes
planes often have large LIM_ROLL_CD
This commit is contained in:
parent
b1b73e2d99
commit
40db90cebe
@ -737,13 +737,14 @@ void Plane::update_flight_mode(void)
|
||||
case QLAND:
|
||||
case QRTL: {
|
||||
// set nav_roll and nav_pitch using sticks
|
||||
nav_roll_cd = channel_roll->norm_input() * roll_limit_cd;
|
||||
nav_roll_cd = constrain_int32(nav_roll_cd, -roll_limit_cd, roll_limit_cd);
|
||||
int16_t roll_limit = MIN(roll_limit_cd, quadplane.aparm.angle_max);
|
||||
nav_roll_cd = channel_roll->norm_input() * roll_limit;
|
||||
nav_roll_cd = constrain_int32(nav_roll_cd, -roll_limit, roll_limit);
|
||||
float pitch_input = channel_pitch->norm_input();
|
||||
if (pitch_input > 0) {
|
||||
nav_pitch_cd = pitch_input * aparm.pitch_limit_max_cd;
|
||||
nav_pitch_cd = pitch_input * MIN(aparm.pitch_limit_max_cd, quadplane.aparm.angle_max);
|
||||
} else {
|
||||
nav_pitch_cd = -(pitch_input * pitch_limit_min_cd);
|
||||
nav_pitch_cd = pitch_input * MIN(-pitch_limit_min_cd, quadplane.aparm.angle_max);
|
||||
}
|
||||
nav_pitch_cd = constrain_int32(nav_pitch_cd, pitch_limit_min_cd, aparm.pitch_limit_max_cd.get());
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user