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)
If a vendor does not support one of these four baseline modes, gateway returns
unsupported.
Vendor Mapping Table (unified mode -> vendor-native)
Unified Core Ops Support Matrix
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
Multi-Joint State & Auth Notes
damiao_state_many: refresh every discovered Damiao joint in one logical request overdm-serial. State snapshots includemotor_id,feedback_id, andmodel, so browser HMIs can merge whole-arm telemetry by joint instead of treating all feedback as the active target. State reads request fresh feedback with a bounded timeout before returning.- Token auth: browser clients may send
MOTORBRIDGE_WS_TOKENin the WebSocket URL query as?motorbridge_ws_token=...(header-based auth and non-loopback token requirements are unchanged). - Single-motor command scoping: one-motor operations no longer fan out across multiple discovered motors; they are scoped to the explicit requested target.
- RobStride scans: probe each requested host/feedback ID exactly and sequentially (Windows PCAN-safe). Already-discovered IDs are skipped in later passes.
param_stream enabled=false: disabling the stream no longer opens or reopens hardware sessions.
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