bindings/python. The goal is to help you master all core APIs following the real motor usage flow.
Course file convention:
xx-*.py: runnable directlyxx-*.md: explanation, parameters, and notes for that lesson
1. Build a Unified Mental Model First
In real projects, always understand the flow along this chain:- Choose transport (
Controller(...)/from_socketcanfd(...)/from_dm_serial(...)/from_dm_device(...)) - Add motor (
add_*_motor(...)) - Enable (
enable_all()) - Mode (
ensure_mode(...)) - Send (
send_*) - Feedback (
request_feedback()) - Read state (
get_state())
<= v0.1.6: manualpoll_feedback_once()recommendedv0.1.7+: background polling on by default;get_state()usually suffices
2. Course Order (by engineering practice)
00 enable-and-status
Goal:
- Run the minimal loop: communicate, enable, read state
enable_allrequest_feedbackget_statepoll_feedback_once(compat)
01 scan
Goal:
- Scan online motors, confirm
motor_id / feedback_id / model
motorbridge-cli scan
02 register-rw
Goal:
- Read/write register parameters, understand “control params” vs “device params”
get_register_u32/f32write_register_u32/f32store_parameters
03 mode-switch-method
Goal:
- Unified mode switching, avoid “command/mode mismatch”
ensure_mode(Mode.*, timeout_ms)
04 / 05 / 06 / 07 single-mode lessons
Goal:- Master
MIT / POS_VEL / VEL / FORCE_POSindependently
send_mitsend_pos_velsend_velsend_force_pos
08 mode-mixed-switch
Goal:
- Safely switch multiple modes within one program
ensure_mode+ eachsend_*
09 multi-motor
Goal:
- Same-vendor multi-motor and cross-vendor multi-controller unified query
add_*_motorrequest_feedbackget_state
3. Full Binding API Cheatsheet (no ambiguity)
Controller API
Constructors:Controller(channel="can0")Controller.from_socketcanfd(channel="can0")Controller.from_dm_serial(serial_port, baud)Controller.from_dm_device(dm_device_type, dm_channel)
close()shutdown()close_bus()
enable_all()disable_all()poll_feedback_once()
add_damiao_motor(...)add_robstride_motor(...)add_myactuator_motor(...)add_hightorque_motor(...)add_hexfellow_motor(...)
Motor API
Lifecycle and maintenance:close()enable()/disable()clear_error()set_zero_position()
ensure_mode(mode, timeout_ms=1000)send_mit(pos, vel, kp, kd, tau)send_pos_vel(pos, vlim)send_vel(vel)send_force_pos(pos, vlim, ratio)
request_feedback()get_state()->MotorState | None
set_can_timeout_ms(timeout_ms)store_parameters()write_register_u32/f32(...)get_register_u32/f32(...)
robstride_ping()robstride_set_device_id(...)robstride_get_param_* / robstride_write_param_*
4. Sensible Motor Usage Habits (strongly recommended)
- Scan before you control; do not send blindly.
- Keep only one sender process running to avoid
os error 105. - Start with a conservative control period:
DT_MS=20~50. enable + statusfirst, then enter a control mode.- On errors, check three things first: ID, baud rate, and transport type (socketcan/socketcanfd/dm-serial).
5. Recommended Learning Commands
6. Cross-link with Mintlify Docs
For the full tutorial + API-reference docs site, see:../motorbridge-docs- Key pages:
sdk/python/reference.mdx,zh/sdk/python/reference.mdx