Backends
A backend is where robot state comes from and where joint commands go. Every backend implements the same four calls:
class RobotBackend {
public:
virtual void start() = 0;
virtual std::optional<RobotState> read_state() = 0; // nullopt: session closed
virtual void submit(const JointCommand &) = 0; // PD targets, gains, feedforward
virtual void stop() noexcept = 0;
};
The policy loop does not know which backend it runs on, so moving from simulation to hardware is a flag:
boltrt --robot g1 --policy policy.yaml --backend mujoco
boltrt --robot g1 --policy policy.yaml --backend real
MuJoCo
type: mujoco
physics_dt: 0.005
realtime: false
floor: true
- Online (default with a window): physics runs on its own thread at
physics_dtusing the latest command; the policy keeps its own clock. - Headless (
--headless): no window and no pacing; physics and policy step deterministically, for batch evaluation and regression checks. - The native viewer owns its shortcuts (
Spacepause,Backspacereset). These affect physics only.
Hardware: G1 and RP1
Hardware backends run a high-frequency command writer with a watchdog in the
same process. If commands stop arriving within command_timeout_s, or state
stops within state_timeout_s, the backend fails safe. Details, safety notes and
configuration: Real robots.
Replay
replay feeds recorded robot states into the loop without simulating anything,
and discards the commands. Use it to reproduce a run offline, to debug a state
sequence recorded on hardware, or for latency measurement and same-state parity
checks.
# replay.yaml
type: replay
path: states.jsonl # e.g. the output of --record
boltrt --task tracking --robot g1 --policy policy.yaml --backend mujoco \
--motion walk.npz --headless --start --record states.jsonl
boltrt --task tracking --robot g1 --policy policy.yaml --backend replay.yaml \
--motion walk.npz --headless --start --record replayed.jsonl
Each line needs q, dq, orientation (wxyz), angular_velocity, tick and
time; root_position is optional. Like MuJoCo, the replay advances to the next
line only after a command is submitted, so tick i sees recorded line i and a
replayed run reproduces the recorded actions. The run ends at the end of the file.
Adding a backend
Implement RobotBackend, register a factory in BackendRegistry, and keep SDK
headers and build rules inside src/backend/<name>/. See
Add a backend.