Looking to Add Reversibility to DroneCAN (UAVCAN) Actuators

Hi all! I am looking to expand PX4’s current DroneCAN (UAVCAN) drivers in order to allow the full DroneCAN standard [-8191, 8192] output commands. From my understanding, the ESC control pipeline gets handed a value [-1, 1] ([0, 1] for throttle), which is grabbed by the UAVCAN ESC Mixer (_mxing_interface_esc), and turned into a DroneCAN throttle command. As it stands now, the UAVCAN driver only knows how to deal with positive throttle commands, and cannot output the [-8191, -1] range defined by the DroneCAN standard. I’ve tried changing the module.yaml file to make the standard_params include the negative values, but the generate_params.py script throws an error that module.yaml values must be positive. This appears to happen in the get_actuators_output_params function. Now, this makes sense for PWM actuator commands since we can’t make negative times, but limits DroneCAN as a result. I am looking for help to solve this issue in order to implement fully reversible DroneCAN commands. I have tried hard coding negative values to the outputs in the UAVCAN updateParams() function, and the output is correct (as viewed on the DroneCAN GUI).

I am very new to PX4 development, so there are definitely architectural concepts that I’ve yet to fully grasp that may make this problem super easy to solve. Thus, I am coming to this forum in search of assistance. Anything anyone can offer would be great, thank you!

Some possible (untested) solutions I have thought of:

Theoretically, we could update the mixer to accept values from [0, 16384] where 13192 represents 0 throttle, and the other extremes represent -1 and 1. This echoes how PWM protocols work with reversibility, but would be a bit strange to look at, specifically through QGroundControl (those familiar with DroneCAN would see a maximum of 16384 rather than the expected 8191). We could also keep the current setup, but break the 8191 in half to emulate the [-8191, 8192] range. This, obviously, would cut the resolution, giving less granularity between throttle steps.

Ttarget the generate_params.py script to allow us to input negative actuator values. This would probably need associated firmware work in order to deal with negative values moonlighting as uint16s.