Browse Source

mixer_multirotor: use reduce_only instead of -1000 for yaw thrust reduction

This is more accurate, because if we use -1000 as lower bound, a very large
yaw command can reduce thrust more than needed.

The difference can be seen in the following example
(with roll/pitch airmode):
p_dot_sp = -1.0 # roll acceleration
q_dot_sp = 0.9 # pitch acceleration
r_dot_sp = -0.9 # yaw acceleration
sbg
Beat Küng 6 years ago
parent
commit
cfad556a16
  1. 3
      src/lib/mixer/mixer_multirotor.cpp
  2. 5
      src/lib/mixer/mixer_multirotor.py

3
src/lib/mixer/mixer_multirotor.cpp

@ -339,7 +339,8 @@ void MultirotorMixer::mix_yaw(float yaw, float *outputs) @@ -339,7 +339,8 @@ void MultirotorMixer::mix_yaw(float yaw, float *outputs)
_tmp_array[i] = _rotors[i].thrust_scale;
}
minimize_saturation(_tmp_array, outputs, _saturation_status, -1000.f);
// reduce thrust only
minimize_saturation(_tmp_array, outputs, _saturation_status, 0.f, 1.f, true);
}
unsigned

5
src/lib/mixer/mixer_multirotor.py

@ -92,7 +92,10 @@ def mix_yaw(m_sp, u, P, u_min, u_max): @@ -92,7 +92,10 @@ def mix_yaw(m_sp, u, P, u_min, u_max):
u_r_dot = P[:,2]
u_pp = minimize_sat(u_p, u_min, u_max+0.15, u_r_dot)
u_T = P[:, 3]
u_ppp = minimize_sat(u_pp, -1000, u_max, u_T)
u_ppp = minimize_sat(u_pp, 0, u_max, u_T)
# reduce thrust only
if (u_ppp > (u_pp)).any():
u_ppp = u_pp
return u_ppp
def airmode_rp(m_sp, P, u_min, u_max):

Loading…
Cancel
Save