diff options
author | Anton Babushkin <anton.babushkin@me.com> | 2014-05-22 19:04:04 +0200 |
---|---|---|
committer | Anton Babushkin <anton.babushkin@me.com> | 2014-05-22 19:04:04 +0200 |
commit | 635a7533b487389bed27e429fb6baf936f7bb3b8 (patch) | |
tree | 7898073811d0af0db0eddf0b7469ed89513848e9 /src/modules/systemlib/mixer | |
parent | 1ce1ece0bb7433d1c8498adc5cd4426f5400d20e (diff) | |
download | px4-firmware-635a7533b487389bed27e429fb6baf936f7bb3b8.tar.gz px4-firmware-635a7533b487389bed27e429fb6baf936f7bb3b8.tar.bz2 px4-firmware-635a7533b487389bed27e429fb6baf936f7bb3b8.zip |
mc mixer: additional safe limiting of mixed out
Diffstat (limited to 'src/modules/systemlib/mixer')
-rw-r--r-- | src/modules/systemlib/mixer/mixer_multirotor.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/modules/systemlib/mixer/mixer_multirotor.cpp b/src/modules/systemlib/mixer/mixer_multirotor.cpp index 4ad21d818..092c0e2b0 100644 --- a/src/modules/systemlib/mixer/mixer_multirotor.cpp +++ b/src/modules/systemlib/mixer/mixer_multirotor.cpp @@ -351,9 +351,9 @@ MultirotorMixer::mix(float *outputs, unsigned space) scale_out = 1.0f; } - /* scale outputs to range _idle_speed..1 */ + /* scale outputs to range _idle_speed..1, and do final limiting */ for (unsigned i = 0; i < _rotor_count; i++) { - outputs[i] = _idle_speed + (outputs[i] * (1.0f - _idle_speed) * scale_out); + outputs[i] = constrain(_idle_speed + (outputs[i] * (1.0f - _idle_speed) * scale_out), _idle_speed, 1.0f); } return _rotor_count; |