This documention is in the process of being updated for ODrive Pro
odrivetool is the accompanying PC program for the ODrive. It’s main purpose is to provide an interactive shell to control the device manually, as well as some supporting functions like firmware update.
Refer to the Getting Started guide.
odrivetool --help to see what features are available.
odrivetool will connect to any ODrive it finds.
If this is not what you want, you can select a specific ODrive.
To find the serial number of your ODrive, run
odrivetool, connect exactly one ODrive and power it up.
You should see this:
Connected to ODrive 306A396A3235 as odrv0 In :
306A396A3235 is the serial number of this particular ODrive.
If you want
odrivetool to ignore all other devices you would close it and then run:
odrivetool --serial-number 306A396A3235
My ODrive is stuck in DFU mode, can I still find the serial number?
Yes, the serial number is part of the USB descriptors. In Linux you can find it by running:
(sudo lsusb -d 1209:0d32 -v; sudo lsusb -d 0483:df11 -v) 2>/dev/null | grep iSerial
This should output something like:
iSerial 3 385F324D3037 iSerial 3 306A396A3235
Here, two ODrives are connected.
The ODrive Tool console provides aliases and wrappers for various entities in the
odrive Python package. These are optimized for interactive use. When you write your own Python script that does
import odrive, these wrappers are not available.
- shell.status(config: odrive.config.MachineConfig)
- shell.apply(config: odrive.config.MachineConfig)
- shell.calibrate(config: odrive.config.MachineConfig)
Dictionary of all currently connected ODrives
Liveplotter is used for the graphical plotting of odrive parameters (i.e. position) in real time. To start liveplotter, close any other instances of liveplotter and run
from a new anaconda prompt window. By default two parameters are plotted on startup; the encoder position of axis 1 and axis 2.
In the below example the motors are running in
closed_loop_control while they are being forced off position by hand.
To change what parameters are plotted open odrivetool (located in
ODrive-master\tools) with a text editor and modify the liveplotter function:
# If you want to plot different values, change them here. # You can plot any number of values concurrently. cancellation_token = start_liveplotter(lambda: [ odrv0.encoder_estimator0.pos_estimate, odrv0.encoder_estimator0.pos_estimate, ])
For example, to plot the approximate motor torque [Nm] and the velocity [RPM] of axis0, you would modify the function to read:
# If you want to plot different values, change them here. # You can plot any number of values concurrently. cancellation_token = start_liveplotter(lambda: [ ((odrv0.encoder_estimator0.vel_estimate*60), # turns/s to rpm ((odrv0.axis0.motor.current_control.Iq_setpoint * my_odrive.axis0.motor.config.torque_constant), # Torque [Nm] ])
In the example below the motor is forced off axis by hand and held there. In response the motor controller increases the torque (orange line) to counteract this disturbance up to a peak of 500 N.cm at which point the motor current limit is reached. When the motor is released it returns back to its commanded position very quickly as can be seen by the spike in the motor velocity (blue line).
To change the scale and sample rate of the plot modify the following parameters located at the beginning of utils.py (located in
data_rate = 100 plot_rate = 10 num_samples = 1000
For more examples on how to interact with the plotting functionality refer to these Matplotlib examples.
Liveplotter from Interactive
You can also run
start_liveplotter(...) directly from the interactive odrivetool prompt.
This is useful if you want to issue commands or otherwise keep interacting with the odrive while plotting.
For example you can type the following directly into the interactive prompt:
Just like the examples above, you can list several parameters to plot separated by comma in the square brackets. In general, you can plot any variable that you are able to read like normal in odrivetool.