Converting from UAVCAN to CANSimple

I have ArduRover v4.4.0 firmware installed on Pixhawk 6C flight controller.
We are planning to send navigating information with the use of CAN bus. But the ODrive utilizes CANSimple while Ardupilot utilizes the UAVCAN implementation. So basically I have to write a program that translates between the 2 protocols, I need to convert from UAVCAN to CANSimple. Do you have ideas how can I start the implementation? How can I test/debug the program whether it would run or not?

Hi @Bence_Nagy-Toth,

I had a peek at ODrive and their CAN protocol is documented here.

I guess ODrive is mostly an indoor skid-steering robotics kit so you need to send motor outputs to it? If that’s the case then I think you could write it in Lua and you might find some useful examples in the “examples”, “applets” or “drivers” folders of this directory.

In particular the CAN_ready/write/logger examples are probably a good place to start.


Hi @rmackay9

Thank you for your reply. Yes, we want to control the 4 wheels of the vehicle with the use of ODrive-modules.
We would like to have Pixhawk control the wheels using CAN protocol, so the Pixhawk 6C (the ArduRover, which would tell the vehicle where to go) and the 4 ODrive-modules are connected to a CAN-bus.

Yes, we also thought about writing a Lua script to convert between DroneCAN and CANSimple, so I think I will dive deeper into this topic because you have also recommended the same.

Thank you for your help again, it is much appreciated.
Have a nice day!

You don’t need to convert anything other than a scaled throttle output percentage (-1.0 to 1.0, derived by SRV_Channels:get_output_scaled()) on a “dummy” output.

Take that percentage as an input to your CANSimple driver, and output the correct message format at 10-20Hz.


SRV_Channels:get_output_scaled() for me looks problematic since we cannot define exactly the minimum and maximum values.

I think I have an idea on how to solve this issue.
I am reading the PWM values using SRV_Channels:get_output_pwm() of the throttle (70) and ground steering (26) functions while in AUTO mode because we know the min and the max values (1000 and 2000), so scaling can work perfectly.
My question is, would it work in practice if we send these scaled PWM values (being between -1.0 and +1.0) from the Ardupilot to the CAN bus the ODrive modules are connected to?

steering-throttle-scale.lua (1.4 KB)
This is the Lua script I am working with.