Documentation Index
Fetch the complete documentation index at: https://motorbridge.seeedstudio.com/llms.txt
Use this file to discover all available pages before exploring further.
Source:
integrations/ws_gateway/README.mdws_gateway
Channel Compatibility (PCAN + slcan + Damiao Serial Bridge)
- Linux SocketCAN uses interface names directly:
can0,can1,slcan0. - For USB-serial CAN adapters, bring up
slcan0first:sudo slcand -o -c -s8 /dev/ttyUSB0 slcan0 && sudo ip link set slcan0 up. - Damiao-only serial bridge transport is also available in CLI (
--transport dm-serial --serial-port /dev/ttyACM0 --serial-baud 921600). - Full Damiao serial-bridge interface list and command patterns are documented in
motor_cli/README.md(section3.6inmotor_cli/README.zh-CN.md). - On Linux SocketCAN, do not append bitrate in
--channel(for examplecan0@1000000is invalid). - On Windows (PCAN backend),
can0/can1map toPCAN_USBBUS1/2; optional@bitratesuffix is supported.
Status
Core WS API is implemented. The bundled web HMI (tools/ws_test_client.html) is still under active development.
Transport
- Protocol: WebSocket
- V1 payload: JSON text frames
- Periodic state push on each
--dt-mstick
Unified Mode Mapping (Draft)
Goal: application layer uses one unified operation set first; vendor-specific ops remain available but are not recommended as default.Unified Control Modes (app-facing, fixed baseline)
| Unified Mode | Unified Op | Core Parameters |
|---|---|---|
mit | {"op":"mit", ...} | pos, vel, kp, kd, tau |
pos_vel | {"op":"pos_vel", ...} | pos, vlim |
vel | {"op":"vel", ...} | vel |
force_pos | {"op":"force_pos", ...} | pos, vlim, ratio |
unsupported.
Vendor Mapping Table (unified mode -> vendor-native)
| Vendor | mit | pos_vel | vel | force_pos | Parameter Differences | Notes |
|---|---|---|---|---|---|---|
| damiao | native MIT | native POS_VEL | native VEL | native FORCE_POS | full parameter match | baseline reference |
| robstride | native MIT | maps to native Position (run_mode=1 + limit_spd + loc_ref) | native Velocity mode | unsupported | vel maps to vendor velocity target; pos_vel maps to vendor Position | native param read/write via robstride_* |
| hexfellow | native MIT | native POS_VEL | unsupported | unsupported | mit supports kp/kd/tau; no standalone vel | CAN-FD path |
| myactuator | unsupported | Position setpoint flow | native velocity setpoint | unsupported | pos_vel via position setpoint; vel in baseline set | native strengths: current/position/version/mode-query |
| hightorque | native MIT (ht_can mapping) | maps to native pos+vel+tqe | native velocity frame | maps to native pos+vel+tqe | mit/vel are raw-frame mapped; kp/kd accepted but ignored by protocol; pos_vel/force_pos map to pos+vel+tqe | current subset: scan/read/mit/vel/pos-vel/force-pos/stop; enable/disable accepted as no-op |
Unified Core Ops Support Matrix
| Vendor | scan | set_id | enable | disable | stop | state_once/status |
|---|---|---|---|---|---|---|
| damiao | supported | supported | supported | supported | supported | supported |
| robstride | supported | supported | supported | supported | supported | supported |
| hexfellow | supported | unsupported | supported | supported | supported | supported |
| myactuator | supported | unsupported | supported | supported | supported | supported |
| hightorque | supported | unsupported | accepted (no-op) | accepted (no-op) | supported | supported |
Parameter Notes by Mode
mit: same unified fields, but vendor scaling differs internally (gateway adapter handles conversion). HighTorque detail:kp/kdare currently ignored by protocol path.pos_vel: only valid where vendor has equivalent mode.vel: sign/scale conversion is vendor-specific internally.force_pos: Damiao native; HighTorque maps to pos+vel+tqe; others unsupported.
WS capabilities Response (Draft)
Recommended: client calls {"op":"capabilities"} on connect and adapts UI/flows by returned support matrix.
Example response
Build
Run
127.0.0.1:9002is the default and recommended bind for local use.- If you bind to non-loopback addresses (for example
0.0.0.0:9002), you must setMOTORBRIDGE_WS_TOKEN. - WebSocket clients must provide this token via header
x-motorbridge-token: <token>orAuthorization: Bearer <token>.
Experimental Windows Support (PCAN-USB)
Linux remains the primary target. Windows support is experimental and currently uses PEAK PCAN.- Install PEAK PCAN driver + PCAN-Basic runtime (
PCANBasic.dll). - Use
can0@1000000as the channel value on Windows:
Inbound command examples
Outbound frames
Success response:Notes
--vendor damiao|robstride|hexfellow|myactuator|hightorquecontrols default target vendor.set_targetcan switch vendor/transport/channel/serial/model/id on the fly per session.continuous=truekeeps sending that control command every tick.stopclears continuous control.set_idis vendor-aware:- Damiao: write
MST_IDfirst, thenESC_ID. - RobStride: device ID update via
SET_DEVICE_ID.
- Damiao: write
- Damiao-only ops:
write/get_register_*anddm-serialtransport. - RobStride-only ops:
robstride_ping,robstride_read_param,robstride_write_param. - MyActuator-native ops:
current,pos,version,mode-query. - HighTorque-native op:
read. - V2 plan can switch to binary frames while preserving operation semantics.
Simple HMI (for quick testing)
- File:
integrations/ws_gateway/tools/ws_test_client.html - Dedicated 4-motor sync example:
examples/web/ws_quad_sync_hmi.html - Open directly in browser (double-click or
xdg-open), then connect tows://127.0.0.1:9002. - Current status: in development (UI/flow may change quickly).
- For stable validation, prefer sending JSON commands directly (wscat/websocat/custom client).
- Built-in dynamic device workflow:
- scan Damiao and RobStride in one page
- scan hits are shown in a device table (vendor + motor_id + feedback_id + model)
- pick any scanned motor as current target and run enable/disable/vel/mit
- checkbox batch ops: batch enable/stop/disable and batch MIT sync-to-position
- For the 4-motor same-angle slider workflow, start a local static server:
python3 -m http.server 18080- open
http://127.0.0.1:18080/examples/web/ws_quad_sync_hmi.html