mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-16 15:03:33 +08:00
fix(mixer_module): change MixingOutput to use float outputs (#26724)
* refactor(mixer_module): change MixingOutput to use float outputs MixingOutput now passes float values to output drivers instead of uint16_t. This removes the need for the 8192 offset encoding and allows reversible motors to receive negative values directly. * fix(mixer_module): fix float safety issues -EscClient and voxl2_io: replace outputs[i] with fabs(outputs[i]) > 0.fto fix compilation issues -GZMixingInterface: add explicit double cast to prevent compilation error -PWMSim: replaced unit16 cast with lroundf given that now motors outputs can be negative and casting a negative float to unit16 is undefinder behaviour -mixer_module: same fix of PWM (unit126 cast on negative float is undefined behaviour) * refactor(mixer_module): float rounding suggestions * fix(pwm_sim): fix inverted disarmed condition * fix(mixer_module): more float rounding improvements * fix(mixer_module_tests): use casting method which are now in drivers for rounding tests --------- Co-authored-by: Matthias Grob <maetugr@gmail.com>
This commit is contained in:
co-authored by
Matthias Grob
parent
26c9ca115f
commit
00b27c56a8
@@ -1090,8 +1090,7 @@ void UavcanNode::publish_node_statuses()
|
||||
}
|
||||
|
||||
#if defined(CONFIG_UAVCAN_OUTPUTS_CONTROLLER)
|
||||
bool UavcanMixingInterfaceESC::updateOutputs(uint16_t outputs[MAX_ACTUATORS], unsigned num_outputs,
|
||||
unsigned num_control_groups_updated)
|
||||
bool UavcanMixingInterfaceESC::updateOutputs(float outputs[MAX_ACTUATORS], unsigned num_outputs, unsigned num_control_groups_updated)
|
||||
{
|
||||
if (_esc_controller.initialized()) {
|
||||
// num_outputs is the maximum possible number of outputs (8)
|
||||
@@ -1135,8 +1134,7 @@ void UavcanMixingInterfaceESC::mixerChanged()
|
||||
_esc_controller.set_rotor_count(rotor_count);
|
||||
}
|
||||
|
||||
bool UavcanMixingInterfaceServo::updateOutputs(uint16_t outputs[MAX_ACTUATORS], unsigned num_outputs,
|
||||
unsigned num_control_groups_updated)
|
||||
bool UavcanMixingInterfaceServo::updateOutputs(float outputs[MAX_ACTUATORS], unsigned num_outputs, unsigned num_control_groups_updated)
|
||||
{
|
||||
_servo_controller.update_outputs(outputs, num_outputs);
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user