Skip to content

Plane: Fix pitch stick mixing full override #29841

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions ArduPlane/Attitude.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,21 +300,17 @@ void Plane::stabilize_stick_mixing_fbw()
return;
}

// do FBW-A style pitch stick mixing. Scale the inputs up to the full pitch
// range, so that a complete override is always possible.
float pitch_input = channel_pitch->norm_input_dz();
if (pitch_input > 0.5f) {
pitch_input = (3*pitch_input - 1);
} else if (pitch_input < -0.5f) {
pitch_input = (3*pitch_input + 1);
}
if (fly_inverted()) {
pitch_input = -pitch_input;
}
if (pitch_input > 0) {
nav_pitch_cd += pitch_input * aparm.pitch_limit_max*100;
} else {
nav_pitch_cd += -(pitch_input * pitch_limit_min*100);
}
nav_pitch_cd = constrain_int32(nav_pitch_cd, pitch_limit_min*100, aparm.pitch_limit_max.get()*100);
const int32_t pitch_min_cd = pitch_limit_min * 100;
const int32_t pitch_max_cd = aparm.pitch_limit_max.get() * 100;
const float pitch_range_cd = pitch_max_cd - pitch_min_cd;
nav_pitch_cd += pitch_input * pitch_range_cd;
nav_pitch_cd = constrain_int32(nav_pitch_cd, pitch_min_cd, pitch_max_cd);
}


Expand Down
Loading