Skip to main content

Module codec

Module codec 

Source
Expand description

The version seam of the robot protocol.

Everything that differs between FCI v5 (Franka Emika Robot, FER, libfranka 0.9.2) and FCI v10 (Franka Research 3, libfranka 0.21.2) at the byte level is funnelled through the functions in this module, so that crate::robot holds a single FciVersion and never names a version-specific wire type.

The functions take a &mut [u8; N] output buffer sized for the larger of the two versions and return how many bytes they wrote; there is no allocation and no dyn dispatch, only a match on FciVersion, so they are safe to call from a control cycle.

Status bytes are mapped to the shared Rust enums, which keep the FCI v10 name set (crate::error::MoveStatus, v10::StopMoveStatus, v10::AutomaticErrorRecoveryStatus, v10::GetterSetterStatus, v10::CommandStatus). Because the v5 enums are proper subsets by name, mapping is lossless; a byte that is not a valid status for the negotiated version is a crate::error::FrankaError::Protocol.

The module is split by direction: encode builds the Move::Request and the UDP RobotCommand, decode reads the UDP RobotState, and status maps response status bytes onto the shared enums. Everything is re-exported here, so codec::* paths are unchanged.

Enumsยง

FciVersion
The FCI protocol version a connection speaks.