mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-02 04:31:37 +08:00
MultirotorMixer: hotfix [-1,1] scaling
After it was mistakenly rescaled in 26bac78eaf274cf58aacbc239cc8f2e865ba864c#diff-899d35a48340c6065702d4fa77b70f0d #15563
This commit is contained in:
committed by
Daniel Agar
parent
d4296dbd3f
commit
16776ff6fb
@@ -93,7 +93,7 @@ MultirotorMixer::MultirotorMixer(ControlCallback control_cb, uintptr_t cb_handle
|
|||||||
_tmp_array(new float[_rotor_count])
|
_tmp_array(new float[_rotor_count])
|
||||||
{
|
{
|
||||||
for (unsigned i = 0; i < _rotor_count; ++i) {
|
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));
|
_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
|
// 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
|
// clipping if airmode==roll/pitch), since in all other cases thrust will
|
||||||
// be reduced or boosted and we can keep the integrators enabled, which
|
// be reduced or boosted and we can keep the integrators enabled, which
|
||||||
// leads to better tracking performance.
|
// leads to better tracking performance.
|
||||||
if (outputs[i] < 0.01f) {
|
if (outputs[i] < -0.99f) {
|
||||||
if (_airmode == Airmode::disabled) {
|
if (_airmode == Airmode::disabled) {
|
||||||
clipping_low_roll_pitch = true;
|
clipping_low_roll_pitch = true;
|
||||||
clipping_low_yaw = true;
|
clipping_low_yaw = true;
|
||||||
|
|||||||
@@ -108,6 +108,11 @@ int main(int argc, char *argv[])
|
|||||||
return -1;
|
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
|
// read expected outputs
|
||||||
count = 0;
|
count = 0;
|
||||||
float expected_output[output_max];
|
float expected_output[output_max];
|
||||||
|
|||||||
Reference in New Issue
Block a user