Skip to content
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

MC mixer: prioritize roll/pitch over yaw for full airmode #12295

Merged
merged 1 commit into from
Jun 17, 2019
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion src/lib/mixer/mixer.h
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,8 @@ class MultirotorMixer : public Mixer
* Mix roll, pitch, yaw, thrust and set the outputs vector.
*
* Desaturation behavior: full airmode for roll/pitch/yaw:
* thrust is increased/decreased as much as required to meet demanded the roll/pitch/yaw.
* thrust is increased/decreased as much as required to meet demanded the roll/pitch/yaw,
* while giving priority to roll and pitch over yaw.
*/
inline void mix_airmode_rpy(float roll, float pitch, float yaw, float thrust, float *outputs);

Expand Down
8 changes: 8 additions & 0 deletions src/lib/mixer/mixer_multirotor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,14 @@ void MultirotorMixer::mix_airmode_rpy(float roll, float pitch, float yaw, float
}

minimize_saturation(_tmp_array, outputs, _saturation_status);

// Unsaturate yaw (in case upper and lower bounds are exceeded)
// to prioritize roll/pitch over yaw.
for (unsigned i = 0; i < _rotor_count; i++) {
_tmp_array[i] = _rotors[i].yaw_scale;
}

minimize_saturation(_tmp_array, outputs, _saturation_status);
}

void MultirotorMixer::mix_airmode_disabled(float roll, float pitch, float yaw, float thrust, float *outputs)
Expand Down
8 changes: 7 additions & 1 deletion src/lib/mixer/mixer_multirotor.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,13 @@ def airmode_rpy(m_sp, P, u_min, u_max):
# Use thrust to unsaturate the outputs if needed
u_T = P[:, 3]
u_prime = minimize_sat(u, u_min, u_max, u_T)
return (u, u_prime)

# Unsaturate yaw (in case upper and lower bounds are exceeded)
# to prioritize roll/pitch over yaw.
u_T = P[:, 2]
u_prime_yaw = minimize_sat(u_prime, u_min, u_max, u_T)

return (u, u_prime_yaw)


def normal_mode(m_sp, P, u_min, u_max):
Expand Down