Robot interface · repose-robot-interface
Write a bridge
A bridge is a Copper CuBridge that translates between the standard Repose channels and one robot's protocol. If it follows the contract, every planner, controller and program in Repose works with your robot unchanged.
Structure
Split the crate the way the existing bridges are split. It keeps the protocol testable without a robot:
params | The RON config: block as a struct with deny_unknown_fields and a validate(). |
protocol | Pure encode/decode of the wire format. No sockets, no clocks. Unit-test it against captured traffic. |
mapping | Protocol messages ↔ Repose payloads: joint state, robot status, session events. |
transport | Sockets and threads. Always with timeouts. |
bridge | The CuBridge impl and its Tx/Rx channel sets. |
The contract
- Publish
joint_stateasCuJointStatePayload<N>every cycle you have fresh data, in SI units, in the joint order of your chain model. - Map status honestly into
CuRobotStatus:Readyonly when the robot really accepts commands,Fault(code)andEmergencyStopwhen reported. Encodings you don't understand stay on a vendor channel, unmapped. - Accept
joint_commandasCuJointCommandPayload<N>. Support the modes your robot can do, and refuse the others explicitly. - Drive sessions through
CuSessionTracker, mapping its outgoing commands and your controller's reports. Don't invent parallel session state. See Session lifecycle. - Never put vendor payloads on a standard channel. Extras go on
vendor_*channels.
Safety
- Session and motion behind a cargo feature (
control) and config flags (allow_control,allow_motion), all off by default. - A stale command (older than a timeout) becomes a stop, not "keep going".
- Losing the connection calls
tracker.on_disconnected()and stops publishingReady. - Reads always have a timeout, so the Copper cycle can never block forever.
Testing
- Protocol round-trips from recorded traffic.
- Mapping tables: every status code you know maps to the intended
CuRobotStatus. - A read-only build (no
control) against the real controller: watchjoint_statewhile you move the robot from its pendant. Positions must match the pendant, in the right order and sign. - Then sessions, then a tiny motion with the e-stop in hand.
Contributing it
Bridges belong in repose-bridges, one crate per vendor directory, with a README listing channels, supported modes and validated hardware.