Skip to main content

Crate repose_robot_interface

Crate repose_robot_interface 

Source
Expand description

Vendor-neutral contract for robot bridges in copper-rs.

Every Repose robot bridge, whether simulator or hardware and whatever the vendor, exposes the same channels, so an application swaps robots by changing one bridge entry in its RON config:

DirChannelPayloadRequired
Rxjoint_staterepose_kinematics::CuJointStatePayload<N>always
Txjoint_commandrepose_controller::CuJointCommandPayload<N>bridges that move the robot
TxsessionCuSessionCommandbridges with a control session
Rxsession_stateCuSessionStatebridges with a control session

Bridges may add vendor channels (raw diagnostics, controller-reported poses) under vendor-prefixed names such as cri_status.

§Session lifecycle

A hardware controller has to grant control and energise its drives before it accepts motion. The CuSessionCommand vocabulary covers that lifecycle in vendor-neutral terms, and each bridge maps it to its protocol:

AcquireControl → ClearFaults → EnableDrives → … motion … → DisableDrives → ReleaseControl

CuSessionTracker holds the protocol-independent rules, so every bridge enforces them the same way:

  • one command in flight; a request while one is pending is refused and counted,
  • every command except CuSessionCommand::AcquireControl is refused locally while the controller reports this client as not in control,
  • acknowledgements and rejections only count for the sequence number that was sent,
  • shutdown disables drives, then releases control, but only what this session itself changed.
use repose_robot_interface::{CuSessionCommand, CuSessionDecision, CuSessionResult, CuSessionTracker};

let mut tracker = CuSessionTracker::default();
tracker.on_control_report(false);
assert_eq!(tracker.request(CuSessionCommand::EnableDrives), CuSessionDecision::Refused);

assert_eq!(tracker.request(CuSessionCommand::AcquireControl), CuSessionDecision::Send);
let command = tracker.take_outgoing().unwrap();
tracker.mark_sent(command, 7);
tracker.on_control_report(true); // completes AcquireControl
assert_eq!(tracker.state().result, CuSessionResult::Acknowledged);
assert!(tracker.state().control_acquired);

Structs§

CuSessionDetail
Fixed-capacity ASCII text from a controller, truncated to 32 bytes.
CuSessionState
Session state, the payload of a bridge’s session_state Rx channel.
CuSessionTracker
Protocol-independent session rules shared by every bridge.

Enums§

CuSessionCommand
Vendor-neutral session command, the payload of a bridge’s session Tx channel.
CuSessionDecision
What a bridge does with a request.
CuSessionRejection
Why the most recent command was rejected.
CuSessionResult
Outcome of the most recent session command.