rfx.sim
Simulation backends for parallel training with support for Genesis (GPU), MuJoCo MJX (JAX), and Mock (CPU testing).SimRobot
Simulated robot with parallel environments.Constructor
Robot configuration. Can be a path to a YAML file, a RobotConfig object, or a dictionary.
Number of parallel environments to simulate.
Simulation backend to use. Options:
"genesis", "mjx", "mock".Device to run simulation on (
"cuda" or "cpu").Additional backend-specific arguments.
Methods
from_config
Path to robot configuration YAML file.
Number of parallel environments.
Simulation backend to use.
Device to use. If None, automatically selects CUDA if available, otherwise CPU.
Initialized SimRobot instance.
observe
Dictionary containing observation tensors with keys like
"state", "images", etc.act
Action tensor of shape
(num_envs, action_dim).reset
Indices of environments to reset. If None, resets all environments.
Initial observations after reset.
get_reward
Reward tensor of shape
(num_envs,).get_done
Boolean tensor of shape
(num_envs,) indicating which environments are done.render
close
Properties
Name of the simulation backend being used.
Robot configuration object.
MockRobot
Mock robot for testing without real simulation dependencies.Constructor
Dimension of the state space.
Dimension of the action space.
Number of parallel environments.
Maximum state dimension for padding.
Maximum action dimension for padding.
Device to run on.
Additional configuration options (e.g.,
max_steps).Methods
MockRobot implements the same interface as SimRobot:observe() -> dict[str, torch.Tensor]act(action: torch.Tensor) -> Nonereset(env_ids: torch.Tensor | None = None) -> dict[str, torch.Tensor]get_reward() -> torch.Tensorget_done() -> torch.Tensor
