This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
MotrixLab is a reinforcement learning framework built on top of MotrixSim simulation backend. It provides a unified interface for training RL agents using multiple simulation backends (MotrixSim) and integrates with SKRL and RSLRL libraries. The framework is designed for robotics simulation and supports various environments including basic cartpole, locomotion tasks, and manipulation tasks.
This project uses UV for dependency management and Python 3.10.
uv sync --all-packages --all-extrasFor SKRL framework with specific backend:
uv sync --all-packages --extra skrl-jax # JAX backend
uv sync --all-packages --extra skrl-torch # PyTorch backend
For rslrl frame:
uv sync --all-packages --extra rslrlAvailable dependency groups in MotrixLab:
see pyproject.toml
Note: This is a workspace project with two main packages: motrix_envs (simulation environments) and motrix_rl (RL framework integration).
Train with SKRL (default):
uv run scripts/train.py --env cartpoleTrain with RSLRL:
uv run scripts/train.py --env cartpole --rllib rslrlView environment without training:
uv run scripts/view.py --env cartpoleuv run scripts/play.py --env cartpoleSpecify policy file:
uv run scripts/play.py --env cartpole --policy <path/to/best.[pickle/pt]>Add --render flag to training for visualization:
uv run scripts/train.py --env cartpole --renderuv run tensorboard --logdir runs/{env-name}uv run pytest-
Workspace Structure:
motrix_envs/: Simulation environment definitions using MotrixSim backendmotrix_rl/: RL framework integration (primarily SKRL) and training utilities
-
Scripts (
scripts/):train.py: Main training script with configurable environments, frameworks, and backends (use--rllibto select)view.py: Environment visualization without trainingplay.py: Policy evaluation and testing
-
Environment Registry: Environments are registered via
motrix_envs.registryand accessed using string names like "cartpole"
- Workspace Project: Uses UV workspace with two packages sharing dependencies
- MotrixSim Backend: Built on MotrixSim simulation engine for physics simulation
- SKRL Integration: RL framework supporting both JAX and PyTorch backends
- RSLRL Integration: RL framework supporting PyTorch backend (use
--rllib rslrl) - Environment Naming: Simple string-based environment identification (e.g., "cartpole")
- Automatic Backend Selection: For SKRL, training script automatically selects JAX or PyTorch based on GPU availability; RSLRL uses PyTorch only
- Multi-Backend Training: Supports different simulation backends for the same environment
Training results are saved to runs/{env-name}/ directory structure with checkpoints and tensorboard logs.
- Python Version: Requires exactly Python 3.10.*
- GPU Support: Includes CUDA support for both JAX and PyTorch backends
- Private PyPI: Uses internal PyPI server for MotrixSim packages
- No Manual Tests: No test files found in the repository structure
- Field Correspondence: When modifying
RslrlRunnerCfginmotrix_rl/rslrl/cfg.py, ensure fields matchtemplate/rslrl_config.yamlexactly - no extra or missing fields. This is critical for proper configuration serialization and deserialization. - Reference Template: Use
template/rslrl_config.yamlas the source of truth for valid runner configuration fields