Architecture overview
ThePolicyServer runs on a GPU-equipped machine and handles inference requests, while PolicyClient runs on your robot controller or simulation environment:
Starting the server
Server configuration
ThePolicyServer class provides several configuration options:
Basic configuration
With authentication
Server endpoints
The server registers these endpoints by default:ping: Health check endpointkill: Gracefully shutdown the serverget_action: Get action from observationreset: Reset policy stateget_modality_config: Retrieve modality configuration
Client usage
ThePolicyClient implements the same interface as BasePolicy:
Timeout configuration
Configure request timeout based on your inference latency:Custom endpoints
Register custom endpoints for application-specific functionality:Message serialization
The server uses MessagePack for efficient serialization with custom handling for NumPy arrays and modality configs:Debugging with replay policy
Test your client integration without a trained model:The replay policy is useful for verifying environment setup, observation formatting, and action execution without requiring a trained model.
Network considerations
Firewall configuration
Ensure port 5555 (or your chosen port) is open:Latency optimization
For low-latency applications:- Use dedicated network interfaces
- Disable TCP Nagle’s algorithm (ZeroMQ does this by default)
- Run server and client on the same machine when possible
- Consider using InfiniBand or high-speed Ethernet
Error handling
The server catches exceptions and returns error responses:"Unauthorized: Invalid API token": Authentication failed"Unknown endpoint": Endpoint not registered- Connection timeout: Server unreachable or overloaded
Server script configuration
Therun_gr00t_server.py script supports additional options: