Warning

This documention is in the process of being updated for ODrive Pro

ODrive Reference

class ODrive
test_function(delta) int
Parameters

delta (int) –

get_adc_voltage(gpio) float

Reads the ADC voltage of the specified GPIO. The GPIO should be in GPIO_MODE_ANALOG_IN.

Parameters

gpio (int) –

save_configuration() bool
erase_configuration()
reboot()
enter_dfu_mode()
get_interrupt_status(irqn) int

Returns information about the specified interrupt number.

Parameters

irqn (int) – -12…-1: processor interrupts, 0…239: NVIC interrupts

get_dma_status(stream_num) int

Returns information about the specified DMA stream.

Parameters

stream_num (int) – 0…7: DMA1 streams, 8…15: DMA2 streams

get_gpio_states() int

Returns the logic states of all GPIOs. Bit i represents the state of GPIOi.

set_gpio(num, status) bool

Sets the state of the specified GPIO.

Parameters
get_drv_fault() int
clear_errors()

Clear all the errors of this device including all contained submodules.

get_raw(address) int
Parameters

address (int) –

error: Property[ODrive.Error]
vbus_voltage: Float32Property

Voltage on the DC bus as measured by the ODrive.

ibus: Float32Property

Current on the DC bus as calculated by the ODrive.

A positive value means that the ODrive is consuming power from the power supply, a negative value means that the ODrive is sourcing power to the power supply.

This value is equal to the sum of the motor currents and the brake resistor currents. The motor currents are measured, the brake resistor current is calculated based on config.brake_resistance.

ibus_report_filter_k: Float32Property

Filter gain for the reported ibus. Set to a value below 1.0 to get a smoother line when plotting ibus. Set to 1.0 to disable. This filter is only applied to the reported value and not for internal calculations.

serial_number: Uint64Property
hw_version_major: Uint8Property
hw_version_minor: Uint8Property
hw_version_variant: Uint8Property
fw_version_major: Uint8Property
fw_version_minor: Uint8Property
fw_version_revision: Uint8Property
commit_hash: Uint32Property
fw_version_unreleased: Uint8Property

0 for official releases, 1 otherwise

brake_resistor_armed: BoolProperty
brake_resistor_saturated: BoolProperty

Indicates if the brake resistor reached saturation. This flag is latching and needs to be reset by the client before it can indicate another saturation event.

n_evt_sampling: Uint32Property

Number of input sampling events since startup (modulo 2^32)

n_evt_control_loop: Uint32Property

Number of control loop iterations since startup (modulo 2^32)

task_timers_armed: BoolProperty

Set by a profiling application to trigger sampling of a single control iteration. Cleared by the device as soon as the sampling is complete.

task_times: ODrive.TaskTimes
system_stats: ODrive.SystemStats
user_config_loaded: Uint32Property
misconfigured: BoolProperty

If this property is true, something is bad in the configuration. The ODrive can still be used in this state but the user should investigate which setting is problematic. This variable does not cover all misconfigurations.

Possible causes:
  • A GPIO was set to a mode that it doesn’t support

  • A GPIO was set to a mode for which the corresponding feature was not enabled. Example: GPIO_MODE_UART_A was used without enabling config.enable_uart_a.

  • A feature was enabled which is not supported on this hardware. Example: config.enable_uart_c set to true on ODrive v3.x.

  • A GPIO was used as an interrupt input for two internal components or two GPIOs that are mutually exclusive in their interrupt capability were both used as interrupt input. Example: Axis:config.step_gpio_pin of both axes were set to the same GPIO.

oscilloscope: ODrive.Oscilloscope
can: ODrive.Can
test_property: Uint32Property
n_issues: Uint32Property

Counts the number of internal issues that occurred since startup or clear_errors(). A non-zero issue count can indicate a bug in the firmware.

reboot_required: BoolProperty

Can be used by support software to indicate that a reboot is required.

amt21_encoder_group0: ODrive.Amt21EncoderGroup0
class ODrive.Error
CONTROL_ITERATION_MISSED = 1 (0x1)
DC_BUS_UNDER_VOLTAGE = 2 (0x2)
DC_BUS_OVER_VOLTAGE = 4 (0x4)
DC_BUS_OVER_REGEN_CURRENT = 8 (0x8)
DC_BUS_OVER_CURRENT = 16 (0x10)
BRAKE_DEADTIME_VIOLATION = 32 (0x20)
BRAKE_DUTY_CYCLE_NAN = 64 (0x40)
INVALID_BRAKE_RESISTANCE = 128 (0x80)
class ODrive.TaskTimes
sampling: ODrive.TaskTimer
encoder_update: ODrive.TaskTimer
control_loop_misc: ODrive.TaskTimer
control_loop_checks: ODrive.TaskTimer
current_sense_wait: ODrive.TaskTimer
dc_calib_wait: ODrive.TaskTimer
class ODrive.SystemStats
uptime: Uint32Property
min_heap_space: Uint32Property
max_stack_usage_axis: Uint32Property
max_stack_usage_usb: Uint32Property
max_stack_usage_uart: Uint32Property
max_stack_usage_can: Uint32Property
max_stack_usage_startup: Uint32Property
stack_size_axis: Uint32Property
stack_size_usb: Uint32Property
stack_size_uart: Uint32Property
stack_size_startup: Uint32Property
stack_size_can: Uint32Property
prio_axis: Int32Property
prio_usb: Int32Property
prio_uart: Int32Property
prio_startup: Int32Property
prio_can: Int32Property
usb: ODrive.SystemStats.Usb
i2c: ODrive.SystemStats.I2C
class ODrive.Amt21EncoderGroup0
config: ODrive.Amt21EncoderGroup0.Config
class ODrive.Config
enable_uart_a: BoolProperty

Enables/disables UART_A.

You also need to set the corresponding GPIOs to GPIO_MODE_UART_A. Refer to [interfaces](interfaces.md) to see which pins support UART_A. Changing this requires a reboot.

enable_uart_b: BoolProperty

Enables/disables UART_B.

You also need to set the corresponding GPIOs to GPIO_MODE_UART_B. Refer to [interfaces](interfaces.md) to see which pins support UART_B. Changing this requires a reboot.

enable_uart_c: BoolProperty

Not supported on ODrive v3.x.

uart_a_baudrate: Uint32Property

Defines the baudrate used on the UART interface.

Some baudrates will have a small timing error due to hardware limitations.

Here’s an (incomplete) list of baudrates for ODrive v3.x:

Configured | Actual | Error [%]

————-|---------------|———–

1.2 KBps | 1.2 KBps | 0 2.4 KBps | 2.4 KBps | 0 9.6 KBps | 9.6 KBps | 0 19.2 KBps | 19.195 KBps | 0.02 38.4 KBps | 38.391 KBps | 0.02 57.6 KBps | 57.613 KBps | 0.02 115.2 KBps | 115.068 KBps | 0.11 230.4 KBps | 230.769 KBps | 0.16 460.8 KBps | 461.538 KBps | 0.16 921.6 KBps | 913.043 KBps | 0.93 1.792 MBps | 1.826 MBps | 1.9 1.8432 MBps | 1.826 MBps | 0.93

For more information refer to Section 30.3.4 and Table 142 (the column with f_PCLK = 42 MHz) in the [STM datasheet](https://www.st.com/content/ccc/resource/technical/document/reference_manual/3d/6d/5a/66/b4/99/40/d4/DM00031020.pdf/files/DM00031020.pdf/jcr:content/translations/en.DM00031020.pdf).

uart_b_baudrate: Uint32Property

Defines the baudrate used on the UART interface.

See uart_a_baudrate for details.

uart_c_baudrate: Uint32Property

Not supported on ODrive v3.x.

enable_can_a: BoolProperty

Enables CAN. Changing this setting requires a reboot.

enable_i2c_a: BoolProperty

Enables I2C. The I2C pins on ODrive v3.x are in conflict with CAN. This setting has no effect if enable_can_a is also true. This setting has no effect on ODrive v3.2 or earlier. Changing this setting requires a reboot.

usb_cdc_protocol: Property[ODrive.StreamProtocolType]

The protocol that’s being run on the device’s virtual COM port on USB. Note that the ODrive has two independent interfaces on USB: One is the virtual COM port (affected by this option) and the other one is a vendor specific interface which always runs Fibre. So changing this option does not affect the working of odrivetool.

uart0_protocol: Property[ODrive.StreamProtocolType]
uart1_protocol: Property[ODrive.StreamProtocolType]
uart2_protocol: Property[ODrive.StreamProtocolType]
max_regen_current: Float32Property
brake_resistance: Float32Property

Value of the brake resistor connected to the ODrive.

Note that there may be some extra resistance in your wiring and in the screw terminals, so if you are getting issues while braking you may want to increase this parameter by around 0.05 ohm.

If you set this to a lower value than the true brake resistance then the ODrive will not meed the max_regen_current constraint during braking, that is it will sink more than max_regen_current into the power supply. Some power supplies don’t like this.

If you set this to a higher value than the true brake resistance then the ODrive will unnecessarily burn more power than required during braking.

enable_brake_resistor: BoolProperty

Enable/disable the use of a brake resistor.

Setting this to False even though a brake resistor is connected is harmless. Setting this to True even though no brake resistor is connected can break the power supply. Changes to this value require a reboot to take effect.

dc_bus_undervoltage_trip_level: Float32Property

Minimum voltage below which the motor stops operating.

dc_bus_overvoltage_trip_level: Float32Property

Maximum voltage above which the motor stops operating.

This protects against cases in which the power supply fails to dissipate the brake power if the brake resistor is disabled. The default is 26V for the 24V board version and 52V for the 48V board version.

enable_dc_bus_overvoltage_ramp: BoolProperty

Enables the DC bus overvoltage ramp feature.

If enabled, if the measured DC voltage exceeds dc_bus_overvoltage_ramp_start, the ODrive will sink more power than usual into the the brake resistor in an attempt to bring the voltage down again.

The brake duty cycle is increased by the following amount:

  • ODrive:vbus_voltage == dc_bus_overvoltage_ramp_start => brake_duty_cycle += 0%

  • ODrive:vbus_voltage == dc_bus_overvoltage_ramp_end => brake_duty_cycle += 100%

Remarks:
  • This feature is active even when all motors are disarmed.

  • This feature is disabled if brake_resistance is non-positive.

dc_bus_overvoltage_ramp_start: Float32Property

See enable_dc_bus_overvoltage_ramp.

Do not set this lower than your usual ODrive:vbus_voltage, unless you like fried brake resistors.

dc_bus_overvoltage_ramp_end: Float32Property

See enable_dc_bus_overvoltage_ramp.

Must be larger than dc_bus_overvoltage_ramp_start, otherwise the ramp feature is disabled.

dc_max_positive_current: Float32Property

Max current the power supply can source.

dc_max_negative_current: Float32Property

Max current the power supply can sink.

This is the amount of current allowed to flow back into the power supply. The convention is that it is negative. By default, it is set to a conservative value of 10mA. If you are using a brake resistor and getting DC_BUS_OVER_REGEN_CURRENT errors, raise it slightly. If you are not using a brake resistor and you intend to send braking current back to the power supply, set this to a safe level for your power source. Note that in that case, it should be higher than your motor current limit + current limit margin.

Set to -INFINITY to disable.

error_gpio_pin: Uint32Property
gpio3_analog_mapping: ODrive.Endpoint

Make sure the corresponding GPIO is in GPIO_MODE_ANALOG_IN.

gpio4_analog_mapping: ODrive.Endpoint

Make sure the corresponding GPIO is in GPIO_MODE_ANALOG_IN.

class ODrive.Can
error: Property[ODrive.Can.Error]
config: ODrive.Can.Config
class ODrive.Endpoint
endpoint: EndpointRefProperty
min: Float32Property
max: Float32Property
class ODrive.Axis
watchdog_feed()

Feed the watchdog to prevent watchdog timeouts.

error: Property[ODrive.Axis.Error]
step_dir_active: BoolProperty
last_drv_fault: Uint32Property
steps: Int64Property
current_state: Property[ODrive.Axis.AxisState]
requested_state: Property[ODrive.Axis.AxisState]
is_homed: BoolProperty
config: ODrive.Axis.Config
motor: ODrive.Motor
controller: ODrive.Controller
acim_estimator: ODrive.AcimEstimator
sensorless_estimator: ODrive.SensorlessEstimator
trap_traj: ODrive.TrapezoidalTrajectory
min_endstop: ODrive.Endstop
max_endstop: ODrive.Endstop
mechanical_brake: ODrive.MechanicalBrake
pos_vel_mapper: ODrive.Mapper
commutation_mapper: ODrive.Mapper
interpolator: ODrive.Interpolator
task_times: ODrive.Axis.TaskTimes
procedure_result: Property[ODrive.ProcedureResult]
class ODrive.Mapper
set_abs_pos(pos)

Sets the absolute position. This can be useful on the pos_vel_mapper but it’s a bad idea on the commutation_mapper.

Parameters

pos (float) –

status: Property[ODrive.ComponentStatus]
pos_rel: Float32Property
pos_abs: Float32Property
vel: Float32Property
config: ODrive.Mapper.Config
class ODrive.OnboardEncoder
status: Property[ODrive.ComponentStatus]
raw: Float32Property
class ODrive.IncrementalEncoder
status: Property[ODrive.ComponentStatus]
pos_min: Float32Property
pos_max: Float32Property
pos_residual: Float32Property
config: ODrive.IncrementalEncoder.Config
class ODrive.HallEncoder
status: Property[ODrive.ComponentStatus]
hall_cnt: Uint8Property
abs_pos_min: Float32Property
abs_pos_max: Float32Property
config: ODrive.HallEncoder.Config
class ODrive.SpiEncoder
status: Property[ODrive.ComponentStatus]
raw: Float32Property
config: ODrive.SpiEncoder.Config
class ODrive.EncoderEstimator
status: Property[ODrive.ComponentStatus]
pos_estimate: Float32Property
vel_estimate: Float32Property
class ODrive.Interpolator
status: Property[ODrive.ComponentStatus]
interpolation: Float32Property
config: ODrive.Interpolator.Config
class ODrive.ThermistorCurrentLimiter
class ODrive.OnboardThermistorCurrentLimiter
temperature: Float32Property
config: ODrive.OnboardThermistorCurrentLimiter.Config
class ODrive.OffboardThermistorCurrentLimiter
temperature: Float32Property
config: ODrive.OffboardThermistorCurrentLimiter.Config
class ODrive.Motor
last_error_time: Float32Property
error: Property[ODrive.Motor.Error]
is_armed: BoolProperty
is_calibrated: BoolProperty
current_meas_phA: Float32Property
current_meas_phB: Float32Property
current_meas_phC: Float32Property
DC_calib_phA: Float32Property
DC_calib_phB: Float32Property
DC_calib_phC: Float32Property
I_bus: Float32Property
phase_current_rev_gain: Float32Property
effective_current_lim: Float32Property
resistance_calibration_I_beta: Float32Property
max_allowed_current: Float32Property

Indicates the maximum current that can be measured by the current sensors in the current hardware configuration. This value depends on config.requested_current_range.

max_dc_calib: Float32Property
fet_thermistor: ODrive.OnboardThermistorCurrentLimiter
motor_thermistor: ODrive.OffboardThermistorCurrentLimiter
current_control: ODrive.Motor.CurrentControl
n_evt_current_measurement: Uint32Property

Number of current measurement events since startup (modulo 2^32)

n_evt_pwm_update: Uint32Property

Number of PWM update events since startup (modulo 2^32)

config: ODrive.Motor.Config
class ODrive.Oscilloscope
config(addr0, addr1, addr2, addr3, addr4, addr5, addr6, addr7, addr8)
Parameters
  • addr0 (int) –

  • addr1 (int) –

  • addr2 (int) –

  • addr3 (int) –

  • addr4 (int) –

  • addr5 (int) –

  • addr6 (int) –

  • addr7 (int) –

  • addr8 (int) –

trigger()
trigger_high_res()
get_raw(offset) tuple[int, int, int, int]
Parameters

offset (int) –

size: Uint32Property
pos: Uint32Property
class ODrive.AcimEstimator
rotor_flux: Float32Property

estimated magnitude of the rotor flux

slip_vel: Float32Property

estimated slip between physical and electrical angular velocity}

phase_offset: Float32Property

estimate offset between physical and electrical angular position}

stator_phase_vel: Float32Property

calculated setpoint for the electrical velocity}

stator_phase: Float32Property

calculated setpoint for the electrical phase}

config: ODrive.AcimEstimator.Config
class ODrive.Controller
move_incremental(displacement, from_input_pos)

Moves the axes’ goal point by a specified increment.

Parameters
  • displacement (float) – The desired position change.

  • from_input_pos (bool) – If true, the increment is applied relative to input_pos. If false, the increment is applied relative to pos_setpoint, which usually corresponds roughly to the current position of the axis.

start_anticogging_calibration()
status: Property[ODrive.ComponentStatus]
input_pos: Float32Property
input_vel: Float32Property
input_torque: Float32Property
pos_setpoint: Float32Property
vel_setpoint: Float32Property
torque_setpoint: Float32Property
trajectory_done: BoolProperty
vel_integrator_torque: Float32Property
config: ODrive.Controller.Config
autotuning: ODrive.Controller.Autotuning
mechanical_power: Float32Property

Mechanical power estimate. Torque * velocity

electrical_power: Float32Property

Electrical power estimate. Vdq dot Idq

class ODrive.SensorlessEstimator
error: Property[ODrive.SensorlessEstimator.Error]
phase: Float32Property
pll_pos: Float32Property
phase_vel: Float32Property
config: ODrive.SensorlessEstimator.Config
class ODrive.TrapezoidalTrajectory
config: ODrive.TrapezoidalTrajectory.Config
class ODrive.Endstop
endstop_state: BoolProperty
config: ODrive.Endstop.Config
class ODrive.MechanicalBrake
engage()

This function engages the mechanical brake if one is present and enabled.

release()

This function releases the mechanical brake if one is present and enabled.

config: ODrive.MechanicalBrake.Config
class ODrive.TaskTimer
start_time: Uint32Property
end_time: Uint32Property
length: Uint32Property
max_length: Uint32Property
class ODrive.GpioMode
DIGITAL = 0 (0x0)
DIGITAL_PULL_UP = 1 (0x1)
DIGITAL_PULL_DOWN = 2 (0x2)
ANALOG_IN = 3 (0x3)
UART_A = 4 (0x4)
UART_B = 5 (0x5)
UART_C = 6 (0x6)
CAN_A = 7 (0x7)
I2C_A = 8 (0x8)
SPI_A = 9 (0x9)
PWM = 10 (0xA)
ENC0 = 11 (0xB)
ENC1 = 12 (0xC)
ENC2 = 13 (0xD)
MECH_BRAKE = 14 (0xE)
STATUS = 15 (0xF)
BRAKE_RES = 16 (0x10)
AUTO = 17 (0x11)
class ODrive.StreamProtocolType
Fibre = 0 (0x0)
Ascii = 1 (0x1)
Stdout = 2 (0x2)
AsciiAndStdout = 3 (0x3)
Other = 4 (0x4)
class ODrive.ComponentStatus
Nominal = 0 (0x0)
NoResponse = 1 (0x1)
InvalidResponseLength = 2 (0x2)
ParityMismatch = 3 (0x3)
IllegalHallState = 4 (0x4)
PolarityNotCalibrated = 5 (0x5)
PhasesNotCalibrated = 6 (0x6)
NumericalError = 7 (0x7)
MissingInput = 8 (0x8)
RelativeMode = 9 (0x9)
Unconfigured = 10 (0xA)
Overspeed = 11 (0xB)
IndexNotFound = 12 (0xC)
BadConfig = 13 (0xD)
NotEnabled = 14 (0xE)
SpinoutDetected = 15 (0xF)
class ODrive.ProcedureResult
Success = 0 (0x0)
Busy = 1 (0x1)
Cancelled = 2 (0x2)
Disarmed = 3 (0x3)
NoResponse = 4 (0x4)
PolePairCprMismatch = 5 (0x5)
PhaseResistanceOutOfRange = 6 (0x6)
PhaseInductanceOutOfRange = 7 (0x7)
UnbalancedPhases = 8 (0x8)
InvalidMotorType = 9 (0x9)
IllegalHallState = 10 (0xA)
class ODrive.EncoderId
None = 0 (0x0)
IncEncoder0 = 1 (0x1)
IncEncoder1 = 2 (0x2)
IncEncoder2 = 3 (0x3)
SensorlessEstimator = 4 (0x4)
SpiEncoder0 = 5 (0x5)
SpiEncoder1 = 6 (0x6)
SpiEncoder2 = 7 (0x7)
HallEncoder0 = 8 (0x8)
HallEncoder1 = 9 (0x9)
Amt21Encoder0 = 10 (0xA)
Amt21Encoder1 = 11 (0xB)
Amt21Encoder2 = 12 (0xC)
OnboardEncoder0 = 13 (0xD)
OnboardEncoder1 = 14 (0xE)
class ODrive.SpiEncoderMode
Disabled = 0 (0x0)
Rls = 1 (0x1)
Ams = 2 (0x2)
Cui = 3 (0x3)
Aeat = 4 (0x4)
Ma732 = 5 (0x5)
class ODrive.SystemStats.Usb
rx_cnt: Uint32Property
tx_cnt: Uint32Property
tx_overrun_cnt: Uint32Property
class ODrive.SystemStats.I2C
addr: Uint8Property
addr_match_cnt: Uint32Property
rx_cnt: Uint32Property
error_cnt: Uint32Property
class ODrive.Amt21EncoderGroup0.Config
enable: BoolProperty
rs485: Uint8Property
gpio: Uint8Property
addr0: Uint8Property
class ODrive.Can.Error
DUPLICATE_CAN_IDS = 1 (0x1)
class ODrive.Can.Config
baud_rate: Uint32Property

The baudrate of the CAN bus. Only compatible baudrates are accepted. The baud rate must be integer-divisible by 10’000’000. Note that baudrates above 1’000’000 violate the CAN classic specification.

protocol: Property[ODrive.Can.Protocol]
class ODrive.Can.Protocol
SIMPLE = 1 (0x1)
class ODrive.Axis.Error
INVALID_STATE = 1 (0x1)
WATCHDOG_TIMER_EXPIRED = 2048 (0x800)
MIN_ENDSTOP_PRESSED = 4096 (0x1000)
MAX_ENDSTOP_PRESSED = 8192 (0x2000)
ESTOP_REQUESTED = 16384 (0x4000)
HOMING_WITHOUT_ENDSTOP = 131072 (0x20000)
OVER_TEMP = 262144 (0x40000)
UNKNOWN_POSITION = 524288 (0x80000)
class ODrive.Axis.Config
startup_motor_calibration: BoolProperty

run motor calibration at startup, skip otherwise

run encoder index search after startup, skip otherwise this only has an effect if encoder.config.use_index is also true

startup_encoder_offset_calibration: BoolProperty

run encoder offset calibration after startup, skip otherwise

startup_closed_loop_control: BoolProperty

enable closed loop control after calibration/startup

startup_homing: BoolProperty

enable homing after calibration/startup

enable_step_dir: BoolProperty

Enable step/dir input after calibration. Make sure to set the corresponding GPIO’s mode to GPIO_MODE_DIGITAL.

step_dir_always_on: BoolProperty

Keep step/dir enabled while the motor is disabled. This is ignored if enable_step_dir is false. This setting only takes effect on a state transition into idle or out of closed loop control.

calib_range: Float32Property
calib_scan_distance: Float32Property
calib_scan_vel: Float32Property
watchdog_timeout: Float32Property
enable_watchdog: BoolProperty
step_gpio_pin: Uint16Property
dir_gpio_pin: Uint16Property
calibration_lockin: ODrive.Axis.Config.CalibrationLockin
sensorless_ramp: ODrive.Axis.LockinConfig
general_lockin: ODrive.Axis.LockinConfig
can: ODrive.Axis.CanConfig
load_encoder: Property[ODrive.EncoderId]
commutation_encoder: Property[ODrive.EncoderId]
encoder_bandwidth: Float32Property

Applies to both commutation and load encoder. If the same encoder is used for both axes, this is ignored on axis0.

class ODrive.Axis.TaskTimes
thermistor_update: ODrive.TaskTimer
sensorless_estimator_update: ODrive.TaskTimer
endstop_update: ODrive.TaskTimer
can_heartbeat: ODrive.TaskTimer
controller_update: ODrive.TaskTimer
open_loop_vector_generator_update: ODrive.TaskTimer
acim_estimator_update: ODrive.TaskTimer
motor_update: ODrive.TaskTimer
current_controller_update: ODrive.TaskTimer
dc_calib: ODrive.TaskTimer
current_sense: ODrive.TaskTimer
pwm_update: ODrive.TaskTimer
class ODrive.Axis.LockinConfig
current: Float32Property
ramp_time: Float32Property
ramp_distance: Float32Property
accel: Float32Property
vel: Float32Property
finish_distance: Float32Property
finish_on_vel: BoolProperty
finish_on_distance: BoolProperty
class ODrive.Axis.CanConfig
node_id: Uint32Property

Changes take effect after a reboot

is_extended: BoolProperty

Changes take effect after a reboot

heartbeat_rate_ms: Uint32Property
encoder_rate_ms: Uint32Property
class ODrive.Axis.AxisState
UNDEFINED = 0 (0x0)
IDLE = 1 (0x1)
STARTUP_SEQUENCE = 2 (0x2)
FULL_CALIBRATION_SEQUENCE = 3 (0x3)
MOTOR_CALIBRATION = 4 (0x4)
ENCODER_OFFSET_CALIBRATION = 7 (0x7)
CLOSED_LOOP_CONTROL = 8 (0x8)
LOCKIN_SPIN = 9 (0x9)
ENCODER_DIR_FIND = 10 (0xA)
HOMING = 11 (0xB)
ENCODER_HALL_POLARITY_CALIBRATION = 12 (0xC)
ENCODER_HALL_PHASE_CALIBRATION = 13 (0xD)
class ODrive.Axis.Config.CalibrationLockin
current: Float32Property
ramp_time: Float32Property
ramp_distance: Float32Property
accel: Float32Property
vel: Float32Property
class ODrive.Mapper.Config
circular: BoolProperty
scale: Float32Property
offset_valid: BoolProperty
index_offset_valid: BoolProperty
index_offset: Float32Property
use_index_gpio: BoolProperty
index_search_always_on: BoolProperty

Listen for index pulses even when not explicitly running index search and even when the motor is disarmed. In case the index pulse is fairly wide (low resolution encoders or hall effect sensors), care must be taken as to which direction the motor is spun to register the index.

index_gpio: Uint8Property
use_endstop: BoolProperty
class ODrive.IncrementalEncoder.Config
enabled: BoolProperty
cpr: Uint32Property

Counts per revolution of the encoder. This is 4x the Pulse Per Revolution (PPR) value. Usually this is indicated in the datasheet of your encoder.

class ODrive.HallEncoder.Config
enabled: BoolProperty
ignore_illegal_hall_state: BoolProperty
class ODrive.SpiEncoder.Config
ncs_gpio: Uint8Property
mode: Property[ODrive.SpiEncoderMode]
class ODrive.Interpolator.Config
dynamic: BoolProperty
class ODrive.OnboardThermistorCurrentLimiter.Config
temp_limit_lower: Float32Property

The lower limit when the controller starts limiting current.

temp_limit_upper: Float32Property

The upper limit when current limit reaches 0 Amps and an over temperature error is triggered.

enabled: BoolProperty

Whether this thermistor is enabled.

class ODrive.OffboardThermistorCurrentLimiter.Config
gpio_pin: Uint16Property
poly_coefficient_0: Float32Property
poly_coefficient_1: Float32Property
poly_coefficient_2: Float32Property
poly_coefficient_3: Float32Property
temp_limit_lower: Float32Property

The lower limit when the controller starts limiting current.

temp_limit_upper: Float32Property

The upper limit when current limit reaches 0 Amps and an over temperature error is triggered.

enabled: BoolProperty

Whether this thermistor is enabled.

class ODrive.Motor.Error
DRV_FAULT = 8 (0x8)
CONTROL_DEADLINE_MISSED = 16 (0x10)
MODULATION_MAGNITUDE = 128 (0x80)
CURRENT_SENSE_SATURATION = 1024 (0x400)
CURRENT_LIMIT_VIOLATION = 4096 (0x1000)
MODULATION_IS_NAN = 65536 (0x10000)
MOTOR_THERMISTOR_OVER_TEMP = 131072 (0x20000)
FET_THERMISTOR_OVER_TEMP = 262144 (0x40000)
TIMER_UPDATE_MISSED = 524288 (0x80000)
CURRENT_MEASUREMENT_UNAVAILABLE = 1048576 (0x100000)
CONTROLLER_FAILED = 2097152 (0x200000)
I_BUS_OUT_OF_RANGE = 4194304 (0x400000)
BRAKE_RESISTOR_DISARMED = 8388608 (0x800000)
SYSTEM_LEVEL = 16777216 (0x1000000)
BAD_TIMING = 33554432 (0x2000000)
UNKNOWN_PHASE_ESTIMATE = 67108864 (0x4000000)
UNKNOWN_PHASE_VEL = 134217728 (0x8000000)
UNKNOWN_TORQUE = 268435456 (0x10000000)
UNKNOWN_CURRENT_COMMAND = 536870912 (0x20000000)
UNKNOWN_CURRENT_MEASUREMENT = 1073741824 (0x40000000)
UNKNOWN_VBUS_VOLTAGE = 2147483648 (0x80000000)
UNKNOWN_VOLTAGE_COMMAND = 4294967296 (0x100000000)
UNKNOWN_GAINS = 8589934592 (0x200000000)
CONTROLLER_INITIALIZING = 17179869184 (0x400000000)
class ODrive.Motor.CurrentControl
p_gain: Float32Property
i_gain: Float32Property
I_measured_report_filter_k: Float32Property
Id_setpoint: Float32Property
Iq_setpoint: Float32Property
Vd_setpoint: Float32Property
Vq_setpoint: Float32Property
phase: Float32Property
phase_vel: Float32Property
Ialpha_measured: Float32Property
Ibeta_measured: Float32Property
Id_measured: Float32Property
Iq_measured: Float32Property
power: Float32Property
v_current_control_integral_d: Float32Property
v_current_control_integral_q: Float32Property
mod_d: Float32Property
mod_q: Float32Property
final_v_alpha: Float32Property
final_v_beta: Float32Property
class ODrive.Motor.Config
pre_calibrated: BoolProperty
pole_pairs: Int32Property

Number of magnet pole pairs in the motor’s rotor.

This is the number of magnet poles in the rotor, divided by two. This is not the same as the number of coils in the stator.

To find this, you can simply count the number of permanent magnets in the rotor, if you can see them.

Otherwise a good way to find the number of pole pairs is with a current limited power supply. Connect any two of the three phases to a power supply outputting around 2A, spin the motor by hand, and count the number of detents. This will be the number of pole pairs. If you can’t distinguish the detents from the normal cogging present when the motor is disconnected, increase the current.

Another way is sliding a loose magnet in your hand around the rotor, and counting how many times it stops. This will be the number of _pole pairs_. If you use a ferrous piece of metal instead of a magnet, you will get the number of _magnet poles_.

direction: Float32Property
calibration_current: Float32Property
resistance_calib_max_voltage: Float32Property
phase_inductance: Float32Property
phase_resistance: Float32Property
torque_constant: Float32Property

Torque constant of the motor.

This is the ratio of torque produced by the motor per Amp of current delivered to the motor. This should be set to 8.27 / (motor KV).

If you decide that you would rather command torque in units of Amps, you could simply set the torque constant to 1.

If you don’t command/monitor torque directly but only use velocity/position control, this value has no effect.

motor_type: Property[ODrive.Motor.MotorType]
current_lim: Float32Property
current_lim_margin: Float32Property
torque_lim: Float32Property
inverter_temp_limit_lower: Float32Property
inverter_temp_limit_upper: Float32Property
requested_current_range: Float32Property
current_control_bandwidth: Float32Property
acim_gain_min_flux: Float32Property
acim_autoflux_min_Id: Float32Property
acim_autoflux_enable: BoolProperty
acim_autoflux_attack_gain: Float32Property
acim_autoflux_decay_gain: Float32Property
R_wL_FF_enable: BoolProperty
bEMF_FF_enable: BoolProperty
I_bus_hard_min: Float32Property

If the controller fails to keep this motor’s DC current (ODrive.Motor:I_bus) above this value the motor gets disarmed immediately. Most likely you want a negative value here. Set to -inf to disable. Take noise into account when chosing a value.

I_bus_hard_max: Float32Property

If the controller fails to keep this motor’s DC current (ODrive.Motor:I_bus) below this value the motor gets disarmed immediately. Usually this is set in conjunction with I_bus_hard_min. Set to inf to disable. Take noise into account when chosing a value.

I_leak_max: Float32Property

In almost all scenarios, the currents on phase A, B and C should add up to zero. A small amount of measurement noise is expected. However if the sum of A, B, C currents exceeds this configuration value, the motor gets disarmed immediately.

Note that this feature is only works on devices with three current sensors (e.g. ODrive v4).

dc_calib_tau: Float32Property
drv_config: Uint64Property

Do not modify unless you know what you’re doing.

shunt_conductance: Float32Property

Set this to 1.0 / R_shunt if you have modified the shunt resistors

class ODrive.Motor.MotorType
HIGH_CURRENT = 0 (0x0)
GIMBAL = 2 (0x2)
ACIM = 3 (0x3)
class ODrive.AcimEstimator.Config
nominal_slip_vel: Float32Property

1/(2*pi*rotor_tau), where rotor_tau is time constant of the rotor (L_r/R_r)

class ODrive.Controller.Config
gain_scheduling_width: Float32Property
enable_vel_limit: BoolProperty
enable_current_mode_vel_limit: BoolProperty

Enable velocity limit in current control mode (requires a valid velocity estimator).

enable_gain_scheduling: BoolProperty
enable_overspeed_error: BoolProperty
control_mode: Property[ODrive.Controller.ControlMode]
input_mode: Property[ODrive.Controller.InputMode]
pos_gain: Float32Property

units = (turn/s) / turn

vel_gain: Float32Property

units = ‘Nm/(turn/s)

vel_integrator_gain: Float32Property

units = Nm/(turn/s * s)

vel_integrator_limit: Float32Property

Clamp the integrator value to this limit. Set to Infinity to disable.

vel_limit: Float32Property

Infinity to disable.

vel_limit_tolerance: Float32Property

Ratio to vel_limit. Infinity to disable.

vel_ramp_rate: Float32Property
torque_ramp_rate: Float32Property
circular_setpoints: BoolProperty
circular_setpoint_range: Float32Property

circular range in [turns] for position setpoints when circular_setpoints is True

absolute_setpoints: BoolProperty

True: Position setpoints are absolute with respect to some calibration method (usually homing). Position control will not work if the absolute position is not known yet. False: Position setpoints are relative to the startup position.

use_commutation_vel: BoolProperty

When using two separate encoders for position control and commutation, this selects which of the two encoders is used for velocity control. If false, the position encoder is used, else the commutation encoder is used. commutation_vel_scale must be set accordingly.

commutation_vel_scale: Float32Property

If use_commutation_vel is true, this defines the scale to apply to the commutation velocity. If the position encoder is mounted after a gearbox with a reduction ratio 1:N, this variable must be set to 1/pole_pairs/N (positive or negative, depending on the setup).

steps_per_circular_range: Int32Property

Number of steps within the circular setpoint range. Set this and the circular setpoint range to powers of 2 for the best results.

homing_speed: Float32Property
inertia: Float32Property
axis_to_mirror: Uint8Property
mirror_ratio: Float32Property
torque_mirror_ratio: Float32Property
input_filter_bandwidth: Float32Property
anticogging: ODrive.Controller.Config.Anticogging
mechanical_power_bandwidth: Float32Property

Bandwidth for mechanical power estimate. Used for spinout detection

electrical_power_bandwidth: Float32Property

Bandwidth for electrical power estimate. Used for spinout detection. Dot product of Vdq and Idq

spinout_mechanical_power_threshold: Float32Property

Mechanical power threshold for spinout detection. This should be a negative value

spinout_electrical_power_threshold: Float32Property

Electrical power threshold for spinout detection. This should be a positive value

class ODrive.Controller.Autotuning
frequency: Float32Property
pos_amplitude: Float32Property
pos_phase: Float32Property
vel_amplitude: Float32Property
vel_phase: Float32Property
vel_burst_factor: Uint8Property
torque_amplitude: Float32Property
torque_phase: Float32Property
class ODrive.Controller.ControlMode
VOLTAGE_CONTROL = 0 (0x0)
TORQUE_CONTROL = 1 (0x1)
VELOCITY_CONTROL = 2 (0x2)
POSITION_CONTROL = 3 (0x3)
class ODrive.Controller.InputMode
INACTIVE = 0 (0x0)
PASSTHROUGH = 1 (0x1)
VEL_RAMP = 2 (0x2)
POS_FILTER = 3 (0x3)
MIX_CHANNELS = 4 (0x4)
TRAP_TRAJ = 5 (0x5)
TORQUE_RAMP = 6 (0x6)
MIRROR = 7 (0x7)
Tuning = 8 (0x8)
class ODrive.Controller.Config.Anticogging
index: Uint32Property
pre_calibrated: BoolProperty
calib_anticogging: BoolProperty
calib_pos_threshold: Float32Property
calib_vel_threshold: Float32Property
cogging_ratio: Float32Property
anticogging_enabled: BoolProperty
class ODrive.SensorlessEstimator.Error
UNSTABLE_GAIN = 1 (0x1)
UNKNOWN_CURRENT_MEASUREMENT = 2 (0x2)
class ODrive.SensorlessEstimator.Config
observer_gain: Float32Property
pll_bandwidth: Float32Property
pm_flux_linkage: Float32Property
class ODrive.TrapezoidalTrajectory.Config
vel_limit: Float32Property
accel_limit: Float32Property
decel_limit: Float32Property
class ODrive.Endstop.Config
gpio_num: Uint16Property

Make sure the corresponding GPIO is in GPIO_MODE_DIGITAL.

enabled: BoolProperty
offset: Float32Property
is_active_high: BoolProperty
debounce_ms: Uint32Property
class ODrive.MechanicalBrake.Config
gpio_num: Uint16Property
is_active_low: BoolProperty