2.9 KiB
Warning: this protocol has been replaced. It's still operational but for new applications it's recommended to use the new protocol.
Command set
The most accurate way to understand the commands is to read the code that parses the commands. Also you can have a look at the ODrive Arduino library that makes it easy to use the UART interface on Arduino. You can also look at it as an implementation example of how to talk to the ODrive over UART.
UART framing
USB communicates with packets, so it is easy to frame a command as one command per packet. However, UART doesn't have any packeting, so we need a way to frame the commands. The start-of-packet symbol is $ and the end-of-packet symbol is !, that is, something like this: $command!. An example of a valid UART position command:
$p 0 10000 0 0!
Motor Position command
p motor position velocity_ff current_ff
pfor positionmotoris the motor number,0or1.positionis the desired position, in encoder counts.velocity_ffis the velocity feed-forward term, in counts/s.current_ffis the current feed-forward term, in A.
Note that if you don't know what feed-forward is or what it's used for, simply set it to 0.
Motor Velocity command
v motor velocity current_ff
vfor velocitymotoris the motor number,0or1.velocityis the desired velocity in counts/s.current_ffis the current feed-forward term, in A.
Note that if you don't know what feed-forward is or what it's used for, simply set it to 0.
Motor Current command
c motor current
cfor currentmotoris the motor number,0or1.currentis the desired current in A.
Variable getting and setting
g type index
s type index value
gfor get,sfor settypeis the data type as follows: **0is float **1is int **2is boolindexis the index in the corresponding exposed variable table.
For example
g 0 12will return the phase resistance of M0s 0 8 10000.0will set the velocity limit on M0 to 10000 counts/sg 1 3will return the error status of M0g 1 7will return the error status of M1
The error status corresponds to the Error_t enum in low_level.h.
Note that the links in this section are to a specific commits to make sure that the line numbers are accurate. That is, they don't link to the newest master, but to an old version. Please check the corresponding lines in the code you are using. This is especially important to get the correct indicies in the exposed variable tables, and the error enum values.
Continous monitoring of variables
You can set up variables in monitoring slots, and then have them (or a subset of them) repeatedly printed upon request. Please see the code for this.