RSL-RL
repository·main·Indexed 25 days ago
https://github.com/leggedrobotics/rsl_rlA lightweight, GPU-accelerated reinforcement learning library implemented in PyTorch and optimized for robotics research. It features high-throughput Multi-GPU training and supports algorithms such as PPO and Distillation. RSL-RL is compatible with learning environments including Isaac Lab, Legged Gym, mjlab, and MuJoCo Playground. The library provides various model architectures (MLP, RNN, CNN), stochastic distributions, and extensions like Random Network Distillation (RND) and Symmetry augmentation.
What's inside rsl_rl
- RSL-RL is a GPU-accelerated, lightweight learning library designed for robotics research. It is optimized for high-throughput training with native Multi-GPU support and features robotics-focused algorithms like PPO and Student-Teacher Distillation. Its compact design is intended for rapid prototyping and testing new ideas without the overhead of large, complex libraries.
Implement a custom Environment interface
mainTo use RSL-RL with a custom environment, your environment must implement the
:class:~rsl_rl.env.vec_env.VecEnv`` abstract interface. Specifically, it must implement the following methods::func:~rsl_rl.env.vec_env.VecEnv.step``:func:~rsl_rl.env.vec_env.VecEnv.get_observations``
Install RSL-RL as a dependency
mainTo use RSL-RL as a library in your project, install it via pip. Ensure you have Python 3.9+ installed and that you have activated your desired virtual environment (e.g.,
venvorconda) before running the installation command.pip install rsl-rl-libInstall RSL-RL for development
mainIf you intend to contribute to RSL-RL or need to modify its source code, install it in editable mode. Clone the repository and use
pip install -e .to ensure changes to the source are reflected in your environment.git clone https://github.com/leggedrobotics/rsl_rl cd rsl_rl pip install -e .Extend RSL-RL with custom classes via configuration
mainRSL-RL is designed to be extensible without modifying the library source. You can pass custom classes (for models, loggers, etc.) directly in your configuration dictionary. Use the:func:~rsl_rl.utils.utils.resolve_callable`` utility to resolve these classes from the configuration.Configure Observation Groups in RSL-RL
mainRSL-RL uses
TensorDictto handle observations returned by the environment'sVecEnv.stepmethod. These observations are organized into observation groups.You configure how these groups are assigned to different model components (like the actor or critic) using the
obs_groupsdictionary in your runner configuration. Theobs_groupsdictionary maps an observation set (a key likeactororcritic) to a list of observation groups (the keys present in theTensorDict).For example, if your environment returns a
policytensor (for deployment) and aprivilegedtensor (only for training), you can configure the actor to only see thepolicygroup while the critic sees both.Install RSL-RL via PyPI
mainFor out-of-the-box usage, you can install the library directly from PyPI.Configure Distillation Algorithm
mainTheDistillationalgorithm configuration is passed via thealgorithmkey in the runner configuration. It is used for training a student model from a teacher.Configure OnPolicyRunner
mainTheOnPolicyRunneris used for standard on-policy reinforcement learning. It requires a nested configuration dictionary containing settings for observations, environment steps, saving intervals, and sub-dictionaries for the algorithm, actor, and critic models.Configure GaussianDistribution
mainUseGaussianDistributionfor stochastic model outputs with a standard deviation.Configure Symmetry Augmentation
mainConfigureSymmetryaugmentation to add symmetric trajectories and loss terms to the training process.Configure MLPModel
mainUseMLPModelfor standard multi-layer perceptron architectures. It is the base model for other types likeRNNModelandCNNModel.