MultirotorMixer: hotfix [-1,1] scaling

After it was mistakenly rescaled in
26bac78eaf274cf58aacbc239cc8f2e865ba864c#diff-899d35a48340c6065702d4fa77b70f0d
#15563
This commit is contained in:
Matthias Grob
2020-08-26 21:13:02 +02:00
committed by Daniel Agar
parent d4296dbd3f
commit 16776ff6fb
2 changed files with 8 additions and 3 deletions

View File

@@ -93,7 +93,7 @@ MultirotorMixer::MultirotorMixer(ControlCallback control_cb, uintptr_t cb_handle
_tmp_array(new float[_rotor_count])
{
for (unsigned i = 0; i < _rotor_count; ++i) {
_outputs_prev[i] = 0.f;
_outputs_prev[i] = -1.f;
}
}
@@ -356,7 +356,7 @@ MultirotorMixer::mix(float *outputs, unsigned space)
_thrust_factor));
}
outputs[i] = math::constrain(outputs[i], 0.f, 1.f);
outputs[i] = math::constrain((2.f * outputs[i] - 1.f), -1.f, 1.f);
}
// Slew rate limiting and saturation checking
@@ -370,7 +370,7 @@ MultirotorMixer::mix(float *outputs, unsigned space)
// clipping if airmode==roll/pitch), since in all other cases thrust will
// be reduced or boosted and we can keep the integrators enabled, which
// leads to better tracking performance.
if (outputs[i] < 0.01f) {
if (outputs[i] < -0.99f) {
if (_airmode == Airmode::disabled) {
clipping_low_roll_pitch = true;
clipping_low_yaw = true;

View File

@@ -108,6 +108,11 @@ int main(int argc, char *argv[])
return -1;
}
// Account for MultirotorMixer outputing [-1,1] and python script [0,1]
for (unsigned i = 0; i < rotor_count; i++) {
actuator_outputs[i] = (actuator_outputs[i] + 1.f) * .5f;
}
// read expected outputs
count = 0;
float expected_output[output_max];