Overview#
motors_py.MotorDriver is the Python entry point for motor drivers. The factory supports DM, EVO, LRO, RP, and XYN; interface and feedback semantics depend on the selected driver.
Creation and control modes#
MotorDriver.create_motor(
motor_id, interface_type, interface, motor_type, motor_model,
master_id_offset=0, motor_zero_offset=0.0
)MotorControlMode exposes NONE=0, MIT=1, POS=2, and SPD=3. Before use, check the modes and buses supported by the selected driver. EtherCAT paths for LRO, RP, and XYN are not yet available.
Main methods#
| Method | Purpose and limits |
|---|---|
init_motor() / deinit_motor() |
Initializes / deinitializes the device; initialization returns uint8_t, which must be interpreted according to the driver |
set_motor_control_mode(mode) |
Requests a control mode |
motor_pos_cmd(pos, spd, ignore_limit=False) |
Position command; bypassing limits changes the protection semantics |
motor_spd_cmd(spd) |
Speed command |
motor_mit_cmd(p,v,kp,kd,tau) |
A single set of MIT commands |
motors_mit_cmd(f_p,f_v,f_kp,f_kd,f_t) |
Array-based MIT binding, up to 8 slots |
refresh_motor_status() |
Requests a status refresh |
get_motor_pos() / get_motor_spd() |
Cached position / speed |
get_motor_current() / get_motor_temperature() |
Cached feedback; physical quantities depend on the driver |
get_error_id() / clear_motor_error() |
Reads cached errors / requests clearing; does not establish that the underlying hardware cause has been resolved |
set_motor_zero() / write_motor_flash() |
Changes zero offsets / persistent parameters |
Differences between Python and C++#
The array-based MIT binding processes at most 8 position elements. Missing values in the other arrays are filled with zeros, and elements beyond 8 slots are not passed through this binding. Validate all array lengths and indices before calling.
set_motor_id(old_id,new_id) is declared only in the public C++ header. The Python bindings provide reset_motor_id(), but not set_motor_id().
Return values and caches#
Interpret init_motor() return codes according to the specific driver: in DM, 0 means DOWN and 1 means UP; other codes may indicate faults. The effects of lock_motor() / unlock_motor() also depend on the driver. Use the stopping interfaces specified for that driver and the delivered device.
refresh_motor_status() sends a status request, but subsequent getters still read the cache. get_response_count() counts unanswered requests: it increments when a request is sent and resets to zero when feedback arrives. The feedback quantity from get_motor_current() may be torque or current; interpret its units according to the specific driver.
See Driver errors for the corresponding error definitions.