uavcan: esc: fix uavcan ESC control

This fixes a number of issues with uavcan ESC control.

- Motor Testing when using a CANnode as a PWM expander now works by allowing the FunctionMotors class to perform prearm control

- The esc.RawCommand message is now always published for configured uavcan ESC outputs. Previously prior to arming the message would be published empty, which causes certain ESCs to enter an error state.

- Useless and redundant code has been removed and small name changes have been applied.
This commit is contained in:
Jacob Dahl
2025-07-11 08:53:52 -06:00
committed by Alex Klimaj
parent 572a06b2f3
commit 6a1cefd7a6
7 changed files with 45 additions and 63 deletions
-12
View File
@@ -602,18 +602,6 @@ UavcanNode::init(uavcan::NodeID node_id, UAVCAN_DRIVER::BusEvent &bus_events)
PX4_DEBUG("sensor bridge '%s' init ok", br->get_name());
}
#if defined(CONFIG_UAVCAN_OUTPUTS_CONTROLLER)
// Ensure we don't exceed maximum limits and assumptions. FIXME: these should be static assertions
if (UavcanEscController::max_output_value() >= UavcanEscController::DISARMED_OUTPUT_VALUE
|| UavcanEscController::max_output_value() > (int)UINT16_MAX) {
PX4_ERR("ESC max output value assertion failed");
return -EINVAL;
}
_mixing_interface_esc.mixingOutput().setAllDisarmedValues(UavcanEscController::DISARMED_OUTPUT_VALUE);
#endif
/* Set up shared service clients */
_param_getset_client.setCallback(GetSetCallback(this, &UavcanNode::cb_getset));
_param_opcode_client.setCallback(ExecuteOpcodeCallback(this, &UavcanNode::cb_opcode));