Chinese version: README.zh-CN.md
Companion Repos
motorbridge-studio: https://github.com/tianrking/motorbridge-studio Standalone web control UI built on top ofws_gateway.
Transport Legend
[STD-CAN]: classic CAN path (socketcan/pcan)[CAN-FD]: dedicated FD path (socketcanfd)[DM-SERIAL]: Damiao serial-bridge path (dm-serial)
[CAN-FD]has been integrated as an independent transport path.- No motor model is officially marked as CAN-FD validated in this repository yet.
Current Vendor Support
- Damiao:
- models:
3507,4310,4310P,4340,4340P,6006,8006,8009,10010L,10010,H3510,G6215,H6220,JH11,6248P - modes:
scan,enable,disable,MIT,POS_VEL,VEL,FORCE_POS,set-id,set-zero
- models:
- RobStride:
- models:
rs-00,rs-01,rs-02,rs-03,rs-04,rs-05,rs-06 - modes:
scan,ping,enable,disable,MIT,POS_VEL,VEL, parameter read/write,set-id,zero - host/feedback default:
0xFD(with0xFF/0xFEfallback probing) - model selection is required for real hardware use: use the actual
rs-00..rs-06model for limits/logging; parameter read/write uses the common RobStride section 4 runtime table - note: torque/current control is currently parameter-level only (
write-paramoniq_ref/limits), not a first-class unified mode
- models:
- MyActuator:
- models:
X8(runtime string; protocol is ID-based) - modes:
scan,enable,disable,stop,set-zero,status,current,vel,pos,version,mode-query
- models:
- HighTorque:
- models:
hightorque(runtime string; nativeht_can v1.5.5) - modes:
scan,read,mit,pos-vel,vel,stop,brake,rezero
- models:
- Hexfellow:
- models:
hexfellow(runtime string; CANopen profile) - modes:
scan,status,enable,disable,pos-vel,mit(viasocketcanfd)
- models:
Update (2026-04): Damiao / RobStride Capability Convergence
- Damiao production baseline now covers:
scan / enable / disable / MIT / POS_VEL / VEL / FORCE_POS / set-id / set-zero. - RobStride production baseline now covers:
scan / ping / enable / disable / MIT / POS_VEL / VEL / parameter read-write / set-id / zero. - RobStride RS00-RS06 keep the same unified control command shape. Runtime parameter read/write uses the common section 4 table (
0x7005..0x702E);--modelremains the physical model hint for limits/logging. - RobStride default host/feedback path is
0xFD; scan now tries0xFD,0xFF,0xFE,0x00,0xAAby default. - RobStride
feedback_id/host_idis host-side addressing, not the motordevice_id; scan hits report the motor ID asprobe/device_id. - In RobStride
pos-vel,--vel/--kd/--tauare intentionally ignored and reported as warnings (no hard error).
Architecture
Layered Runtime View
Workspace Topology (Latest)
Python Binding Surface (v0.1.7+)
motor_core: vendor-agnostic controller, routing, CAN bus layer (Linux SocketCAN / Windows experimental PCAN)motor_vendors/damiao: Damiao protocol / models / registersmotor_vendors/hexfellow: Hexfellow CANopen-over-CAN-FD implementationmotor_vendors/hightorque: HighTorque native ht_can protocol implementationmotor_vendors/robstride: RobStride extended CAN protocol / models / parametersmotor_vendors/myactuator: MyActuator CAN protocol implementationmotor_cli: unified Rust CLI- full parameters (English):
motor_cli/README.md - full parameters (Chinese):
motor_cli/README.zh-CN.md - Damiao command/register guide:
motor_cli/DAMIAO_API.md,motor_cli/DAMIAO_API.zh-CN.md - RobStride command/parameter guide:
motor_cli/ROBSTRIDE_API.md,motor_cli/ROBSTRIDE_API.zh-CN.md - MyActuator command/mode guide:
motor_cli/MYACTUATOR_API.md,motor_cli/MYACTUATOR_API.zh-CN.md
- full parameters (English):
motor_abi: stable C ABIbindings/python: Python SDK +motorbridge-clibindings/cpp: C++ RAII wrappermotorbridge-studio: standalone web control UI repository (split out oftools/factory_calib_ui_ws)
Quick Start
Build:[STD-CAN]
Hexfellow CLI:
[CAN-FD]
RobStride CLI:
--model rs-06 with the actual motor model (rs-00 through rs-06) for limits/logging. read-param / write-param uses the common section 4 runtime table.
HighTorque CLI (native ht_can v1.5.5):
Experimental Windows Support (PCAN-USB)
Linux remains the primary target. Windows support is experimental and currently backed by PEAK PCAN (PCANBasic.dll).
- Install PEAK PCAN driver + PCAN-Basic runtime on Windows.
- Channel mapping:
can0->PCAN_USBBUS1can1->PCAN_USBBUS2
- Optional bitrate suffix:
@<bitrate>(for examplecan0@1000000).
macOS PCAN Runtime (PCBUSB)
This project supports PCAN on macOS via MacCAN’sPCBUSB runtime.
On macOS, PCANBasic.dll is not used.
1. Prerequisites
- A PEAK-compatible USB-CAN adapter recognized by macOS.
motorbridgesource built on macOS.- Bundled archive in this repo:
third_party/pcan/macos/macOS_Library_for_PCANUSB_v0.13.tar.gz. - Or download directly from GitHub:
2. Quick install from bundled archive (recommended)
Use the helper script from repo root:--user-local, run motor_cli with:
3. Manual install PCBUSB (system-wide)
If you want to download manually first:libPCBUSB.dylibinto/usr/local/libPCBUSB.hinto/usr/local/include
4. Optional user-local install (no sudo)
If your user cannot write to/usr/local, use a local runtime path:
motor_cli with:
5. Verify runtime loading
6. Build motorbridge CLI
7. Channel mapping on macOS (PCAN backend)
can0maps toPCAN_USBBUS1can1maps toPCAN_USBBUS2- Optional bitrate suffix is supported (example:
can0@1000000)
8. Scan motors (Damiao)
PCBUSB:
9. Control example (Damiao MIT)
Replacemotor-id and feedback-id with your scan hits.
10. Troubleshooting
load PCBUSB failed ...:- Install PCBUSB with
install.sh, or exportDYLD_LIBRARY_PATHfor local install.
- Install PCBUSB with
No CAN backend for current platform:- Use a build that includes the macOS PCAN backend.
hits=0on scan:- Check wiring, power, termination resistor, and CAN bitrate.
Linux USB-CAN (slcan) Quick Guide
Linux uses SocketCAN interface names directly (for example can0, slcan0).
Do not pass bitrate suffix in Linux channel names (for example can0@1000000 is invalid on Linux SocketCAN).
Bring up an slcan adapter as slcan0:
slcan0 as CLI channel:
Damiao Dedicated CAN-FD Transport (socketcanfd)
Use this Linux-only transport when you want an independent CAN-FD path without changing existing classic CAN or dm-serial behavior.
[CAN-FD] (transport integrated; motor verification matrix pending)
Damiao Serial Bridge Quick Guide (dm-serial)
Use this path only when your Damiao adapter exposes a serial bridge (for example /dev/ttyACM1) and you want to run Damiao through that private transport:
[DM-SERIAL]
CAN Debugging (Professional Playbook)
For deterministic troubleshooting of Linuxslcan and Windows pcan, use:
Interpretation:
vendor=damiao id=<n>means one Damiao motor is online at motor ID<n>.vendor=robstride ... probe=<n> ... device_id=<n>means one RobStride motor responded at motor/device ID<n>.- In RobStride output,
feedback_id/host_idsuch as0xFDor0xFEis not the motor ID. vendor=hightorque ... [hit] id=<n> ...means one HighTorque motor responded via native ht_can v1.5.5.vendor=myactuator id=<n>means one MyActuator motor responded.hits=<k>at the end of each scan block is the count of discovered devices.
ABI and Bindings
- C ABI:
motor_controller_new_socketcan(channel)motor_controller_new_dm_serial(serial_port, baud)(Damiao-only serial bridge; cross-platform, e.g./dev/ttyACM0orCOM3)- Damiao:
motor_controller_add_damiao_motor(...) - Hexfellow:
motor_controller_add_hexfellow_motor(...)(CAN-FD path viasocketcanfd) - RobStride:
motor_controller_add_robstride_motor(...) - MyActuator:
motor_controller_add_myactuator_motor(...) - HighTorque:
motor_controller_add_hightorque_motor(...)
- Python:
Controller(channel="can0")Controller.from_dm_serial("/dev/ttyACM0", 921600)(Damiao-only)Controller.add_damiao_motor(...)Controller.add_hexfellow_motor(...)Controller.add_robstride_motor(...)Controller.add_myactuator_motor(...)Controller.add_hightorque_motor(...)
- C++:
Controller("can0")Controller::from_dm_serial("/dev/ttyACM0", 921600)(Damiao-only)Controller::add_damiao_motor(...)Controller::add_hexfellow_motor(...)Controller::add_robstride_motor(...)Controller::add_myactuator_motor(...)Controller::add_hightorque_motor(...)
ensure_mode):
1 = MIT2 = POS_VEL3 = VEL4 = FORCE_POS
- position:
rad - velocity:
rad/s - torque:
Nm
robstride_pingrobstride_set_device_idrobstride_get_param_*robstride_write_param_*
Example Entry Points
- Cross-language index:
examples/README.md - C ABI demo:
examples/c/c_abi_demo.c - C++ ABI demo:
examples/cpp/cpp_abi_demo.cpp - Python ctypes demo:
examples/python/python_ctypes_demo.py - Python SDK docs:
bindings/python/README.md - C++ binding docs:
bindings/cpp/README.md
Release and Package Matrix
A) GitHub Releases (binary assets)
| Asset | Install / Usage | Platform | Primary Audience | Included Capability |
|---|---|---|---|---|
motorbridge-abi-<tag>-linux-x86_64.deb | sudo apt install ./motorbridge-abi-<tag>-linux-x86_64.deb | Linux x86_64 | C/C++ users (Ubuntu/Debian) | libmotor_abi + headers + CMake config |
motorbridge-abi-<tag>-linux-*.tar.gz | extract and link manually | Linux x86_64/aarch64 | C/C++ users (non-deb or cross env) | Same ABI payload as .deb |
motorbridge-abi-<tag>-windows-x86_64.zip | extract and link/import | Windows x86_64 | C/C++ users | motor_abi.dll/.lib + headers + CMake config |
motor-cli-<tag>-<platform>.tar.gz/.zip | run bin/motor_cli | Linux/Windows | Field debug / production tooling | Full unified CLI (scan, mode control, id ops, etc.) |
motorbridge-*.whl, motorbridge-*.tar.gz | pip install ./... | depends on wheel tag | Offline Python install from Release assets | Python SDK + motorbridge-cli |
B) PyPI / TestPyPI (Python package channel)
| Channel | Publish Trigger | Python Versions | Platform Matrix | Package Type |
|---|---|---|---|---|
| TestPyPI | Actions -> Python Publish -> repository=testpypi | 3.10 / 3.11 / 3.12 / 3.13 / 3.14 | Linux (x86_64, aarch64), Windows (x86_64), macOS (arm64) | wheel + sdist |
| PyPI | tag vX.Y.Z or manual repository=pypi | 3.10 / 3.11 / 3.12 / 3.13 / 3.14 | Linux (x86_64, aarch64), Windows (x86_64), macOS (arm64) | wheel + sdist |
C) Functional Scope by Distribution Type
| Distribution Type | Typical Use | What You Can Do |
|---|---|---|
ABI package (.deb/.tar.gz/.zip) | C/C++ integration | Call stable C ABI, use C++ RAII wrapper, embed into native robotics stack |
| Python package (wheel/sdist) | Python app/tooling | Use Controller/Motor/Mode APIs and motorbridge-cli |
motor_cli binary package | Ops / factory / debugging | Direct CAN operations without Python runtime |
D) Additional Automated Distribution Channel
| Channel | CI Workflow | Output |
|---|---|---|
| APT repository (GitHub Pages) | .github/workflows/apt-repo-publish.yml | https://<owner>.github.io/<repo>/apt |
.debis currently Linux x86_64 oriented; other Linux targets should use ABI.tar.gz.- macOS x86_64 wheels are intentionally not produced in current matrix.
- Device matrix reference:
docs/en/devices.md. - Distribution channel automation guide:
docs/en/distribution_channels.md.