rfx deploy loads a trained policy and runs it on robot hardware. This is the main deployment command — train your policy, then deploy it.
Basic Usage
- Loads the policy weights and configuration
- Resolves the robot configuration
- Connects to hardware
- Runs the control loop with rate control and jitter tracking
- Handles clean shutdown on Ctrl+C
Arguments
Required
Path to the policy. Can be:
- Local directory:
runs/my-policy - HuggingFace Hub:
hf://org/repoorhf://user/model - Python file with
@rfx.policydecorator:my_policy.py
Optional
Robot type:
so101, go2, g1, or path to a YAML config file.If the policy was saved with robot_config, this is auto-detected and can be omitted.Path to robot YAML config file. Overrides
--robot if both are provided.Serial port or IP address override. Use when auto-detection fails or you want to specify a device explicitly.
Control loop frequency in Hz. Defaults to the robot’s configured rate.
Run time in seconds. If not specified, runs indefinitely until Ctrl+C.
Use MockRobot instead of real hardware. Useful for testing policies without a physical robot.
Warmup sleep duration in seconds after robot reset, before starting the control loop.
Deployment Modes
From Local Checkpoint
Deploy a policy saved to disk:From HuggingFace Hub
Deploy a policy directly from the Hub:From Python File
Deploy a policy defined in a Python file with the@rfx.policy decorator:
Mock Deployment (No Hardware)
Test a policy without physical hardware:MockRobot which simulates observations and actions.
Examples
Deploy SO-101 policy for 60 seconds
Deploy Go2 policy from HuggingFace Hub
Deploy with custom control rate
Deploy to specific serial port
Deploy with custom robot config
Test policy without hardware
Deploy with longer warmup period
What Deploy Does
rfx deploy handles the complete deployment pipeline:
-
Load Policy
- Parse policy source (local path, Hub URL, or Python file)
- Load weights from
model.safetensorsor checkpoint - Load metadata from
rfx_config.json - Initialize normalizer if present
-
Resolve Robot Configuration
- Use
--robotflag or auto-detect from policy config - Load robot YAML configuration
- Validate action/observation dimensions
- Use
-
Connect to Hardware
- Discover serial ports or network devices
- Initialize robot driver (Rust for SO-101, Zenoh for Go2/G1)
- Run reset sequence
- Wait for warmup period
-
Run Control Loop
- Observe robot state
- Run policy inference
- Send action commands
- Track loop timing and jitter
- Handle rate limiting
-
Clean Shutdown
- Catch Ctrl+C gracefully
- Stop robot safely
- Close connections
- Print statistics
Control Loop Details
The control loop runs at the specified rate (default from robot config):- Loop jitter (deviation from target rate)
- Average inference time
- Total steps executed
Stopping Deployment
Press Ctrl+C to stop gracefully:Error Handling
rfx deploy handles common errors:
Policy not found
Robot not detected
rfx doctor to check hardware detection.
Dimension mismatch
Python API
You can also deploy from Python:Deployment Best Practices
-
Test with
--mockfirst: Validate the policy loads correctly before connecting hardware. -
Use
--durationfor initial tests: Set a short duration (e.g., 10-30s) when testing new policies. - Monitor the first few runs: Watch for unexpected behavior, jitter warnings, or errors.
- Keep emergency stop accessible: Always have a way to quickly stop the robot.
- Start with low duration: Gradually increase deployment time as confidence grows.
See Also
- Record command - Collect demonstration data
- Doctor command - Check environment setup
- Policy API - Writing and saving policies
- Robot API - Robot configuration and interface
