Skip to main content

Adversarial Motion Prior (AMP) reinforcement learning extension for PPO based on RSL-RL.

Project description

AMP-RSL-RL

AMP-RSL-RL is a reinforcement learning library that extends the Proximal Policy Optimization (PPO) implementation of RSL-RL to incorporate Adversarial Motion Priors (AMP). This framework enables humanoid agents to learn motor skills from motion capture data using adversarial imitation learning techniques.


📦 Installation

The repository is available on PyPI under the package name amp-rl-rsl. You can install it directly using pip:

pip install amp-rsl-rl

Alternatively, if you prefer to clone the repository and install it locally, follow these steps:

  1. Clone the repository:

    git clone https://github.com/gbionics/amp_rsl_rl.git
    cd amp_rsl_rl
    
  2. Install the package:

    pip install .
    

For editable/development mode:

pip install -e .

If you want to run the examples, please install with:

pip install .[examples]

The required dependencies include:

  • numpy
  • scipy
  • torch
  • rsl-rl-lib

These will be automatically installed via pip.


📂 Project Structure

amp_rsl_rl/
│
├── algorithms/        # AMP and PPO implementations
├── networks/          # Neural networks for policy and discriminator
├── runners/           # Training and evaluation routines
├── storage/           # Replay buffer for experience collection
├── utils/             # Dataset loaders and motion tools

📁 Dataset Structure

The AMP-RSL-RL framework expects motion capture datasets in .npy format. Each .npy file must contain a Python dictionary with the following keys:

  • joints_list: List[str]
    A list of joint names. These should correspond to the joint order expected by the agent.

  • joint_positions: List[np.ndarray]
    A list where each element is a NumPy array representing the joint positions at a frame. All arrays should have the same shape (N,), where N is the number of joints.

  • root_position: List[np.ndarray]
    A list of 3D vectors representing the position of the base (root) of the agent in world coordinates for each frame.

  • root_quaternion: List[np.ndarray]
    A list of unit quaternions in xyzw format (SciPy convention), representing the base orientation of the agent for each frame.

  • fps: float
    The number of frames per second in the original dataset. This is used to resample the data to match the simulator's timestep.


� Symmetry Augmentation

AMP-RSL-RL now exposes the symmetry-aware data augmentation and mirror-loss hooks from RSL-RL. The implementation follows the design described in:

Mittal, M., Rudin, N., Klemm, V., Allshire, A., & Hutter, M. (2024).
Symmetry Considerations for Learning Task Symmetric Robot Policies. In IEEE International Conference on Robotics and Automation (ICRA).
https://doi.org/10.1109/ICRA57147.2024.10611493 Symmetry augmentation can be enabled through the symmetry_cfg section of the algorithm configuration, providing both minibatch augmentation and optional mirror-loss regularisation for the policy update. AMP-specific components (the discriminator and expert/policy motion buffers) are augmented using the same configuration so that style rewards and adversarial training remain consistent with their symmetric counterparts.


Example

Here’s an example of how the structure might look when loaded in Python:

{
    "joints_list": ["hip", "knee", "ankle"],
    "joint_positions": [np.array([0.1, -0.2, 0.3]), np.array([0.11, -0.21, 0.31]), ...],
    "root_position": [np.array([0.0, 0.0, 1.0]), np.array([0.01, 0.0, 1.0]), ...],
    "root_quaternion": [np.array([0.0, 0.0, 0.0, 1.0]), np.array([0.0, 0.0, 0.1, 0.99]), ...],
    "fps": 120.0
}

All lists must have the same number of entries (i.e. one per frame). The dataset should represent smooth motion captured over time.


📚 Supported Dataset

For a ready-to-use motion capture dataset, you can use the AMP Dataset on Hugging Face. This dataset is curated to work seamlessly with the AMP-RSL-RL framework.


🧑‍💻 Authors


📄 License

BSD 3-Clause License © 2025 Istituto Italiano di Tecnologia

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

amp_rsl_rl-2.2.1.tar.gz (58.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

amp_rsl_rl-2.2.1-py3-none-any.whl (47.3 kB view details)

Uploaded Python 3

File details

Details for the file amp_rsl_rl-2.2.1.tar.gz.

File metadata

  • Download URL: amp_rsl_rl-2.2.1.tar.gz
  • Upload date:
  • Size: 58.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for amp_rsl_rl-2.2.1.tar.gz
Algorithm Hash digest
SHA256 1906cd0a85337960198ac3b542e15d8a6f44a2274769b51f447f45a1b34f2b01
MD5 5d15988035460935a1269e23076aa9d9
BLAKE2b-256 bdb4954a46c8dea8b04b27497129929e7e9f1bd8da916bb329ff2dcec8f30f98

See more details on using hashes here.

File details

Details for the file amp_rsl_rl-2.2.1-py3-none-any.whl.

File metadata

  • Download URL: amp_rsl_rl-2.2.1-py3-none-any.whl
  • Upload date:
  • Size: 47.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for amp_rsl_rl-2.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7afeecb1a04ad4eea78fc8a140542cb8cb05f85a42dd0335fb7d81949251ccd3
MD5 dfe2415f38321cff7c9bd37c1a00ab10
BLAKE2b-256 2c692f49899129d5bbc6008a64fa5dcdda2cf94e4eeee694b65bfc794058b756

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page