ODrive Firmware Additions

Hello everyone!

My team and I are using ODrive for our robotics and to fufill our project’s requirements I’ve made some additions to the firmware. I’m considering cleaning up my work and making pull requests for these features. Please let me know if you guys think these would be useful additions! If so I’ll spend some time getting them to a more complete state.

Completed additions:

  1. Support for controlling an external brake through GPIO pins
  2. Python library for talking to ODrive over CAN
  3. Message when planned trajectory has completed (only over CAN for now)
  4. Unit conversion for input velocity and input position (ex: enter input pos in mm, ODrive converts to counts)
  5. Sensorless homing using force feedback (instead of endstop switch)
  6. e-stop triggering through GPIO pin (using an interrupt)

In progress additions:

  1. Off-axis encoder support using calibration table

Hope these features could help some people out, I’d also love some feedback to improve my implementations! I have pretty limited time right now but if these sound useful I’ll try my best to clean them up and publish them :grin:

@madcowswe @Wetmelon
If any of these conflict with something you guys have in progress, let me know! I can try to merge them.

2 Likes

Hey @kedvall looks like you have been busy! Nice work you sound competent :slight_smile:

Just my 2 cents!!

Sensorless homing/crash detection if done correctly could be a great general feature someone could enable. A good example for this is the prusa mk3s

EStop triggering could be cool but needs to work EVERY time if you offer it in the main feature set. Using an EStop in applications where you can just cut the power or have it go through a safety interlock will always be better. This could be labeled “Soft EStop.” This kind of already exists by resetting the Odrive by any means you want.

The other additions I see as kinda niche to add to the main branch but still valuable in your case obviously.

@Cam_Klein Thanks for the feedback!

Good to know sensorless homing sounds useful, I’ll work on cleaning that up first.

As for estop triggering, totally agree, a reliable failsafe should always be preferred and this is more of a “soft estop”. However, ODrive actually already has an estop_requested error flag built in but I don’t see any way to set it. Setting this flag (or any error flag) should disarm the motor, set the brake current to zero, and zero the phase voltages.
Having this available could be useful but, as you mentioned, should probably not be used for something safety critical. I more so wanted to provide a way to set this flag and thought an external signal might be a good way to do so.

The other additions are indeed rather niche which is why I wanted to see if people would find them useful before spending the time to integrate them :slightly_smiling_face: Anyways, all of this could be enabled or disabled in the config so people can choose what they want to use.

Just FYI, It’s easier for us if you can do each feature as a separate, self-contained, testable PR (new branch for each)

Yeah, I plan to clean up each feature and submit it as an independent PR. I’m relatively new to this, so if something looks weird just let me know and I’ll try my best to fix it!