There is a lot of interest using ODrive controllers and brushless motors. And this post is just to start the thread in this channel.
Here is a similar thread in the odrive discourse server: Cool but would it work on a Corexy? - Support - ODrive Community
I visited the odrive site and the comments from the odrive experts are that step/dir is the lowest level denominator. And many thought it would be terrible for performance. I think this is because the people trying to connect the two were looking at a low level pin connection. But Kevin. You send velocity and acceleration to the controller.
queue_step oid=7 interval=7458 count=10 add=331
If I recall correctly these commands are meant to compress the info and give precise timings. But they can be converted to distance, velocity and acceleration. The only other comment from the odrive group. Is that they would prefer to receive the commands at regular intervals. I’m not certain that this is a huge issue since the accel odds included. But it would be simple to take those commands buffer them and emit equivalent commands at regular time intervals if needed. It’s only a matter of forwarding the command to odrive from the firmware.
Odrive has multiple protocols. The text for the ascii is nice, so I include the link here:ASCII Protocol | ODrive
At the end are the relevant commands in my opinion. Since Klipper is closest to the end user, it feels that it’s really the one better suited to send the appropriate commands to the ODrive. Since the firmware already does a few more things like LCD rendering. I think it would be best to support direct communication to ODrive through their protocols, if using a Raspberry Pi, and I assume command forwarding could also be convenient depending on what board is used for the firmware.
Motor Position command
For basic use where you send one setpoint at at a time, use the q
command. If you have a realtime controller that is streaming setpoints and tracking a trajectory, use the p
command.
q motor position velocity_lim torque_lim
-
q
for position -
motor
is the motor number,0
or1
. -
position
is the desired position, in [turns]. -
velocity_lim
is the velocity limit, in [turns/s] (optional). -
torque_lim
is the torque limit, in [Nm] (optional).
Example: q 0 -2 1 0.1
p motor position velocity_ff torque_ff
-
p
for position -
motor
is the motor number,0
or1
. -
position
is the desired position, in [turns]. -
velocity_ff
is the velocity feed-forward term, in [turns/s] (optional). -
torque_ff
is the torque feed-forward term, in [Nm] (optional).