Skip to main content

The Movement Primitives Package in PyTorch

Project description

MP_PyTorch: The Movement Primitives Package in PyTorch

MP_PyTorch package focus on Movement Primitives(MPs) on Imitation Learning(IL) and Reinforcement Learning(RL) and provides convenient movement primitives interface implemented by PyTorch, including DMPs, ProMPs and ProDMPs. Users can also implement custom Movement Primitives according to the basis and phase generator. Further, advanced NN-based Movement Primitives Algorithm can also be realized according to the convenient PyTorch-based Interface. This package aims to building a movement primitives toolkit which could be combined with modern imitation learning and reinforcement learning algorithm.

 

Installation

For the installation we recommend you set up a conda environment or venv beforehand.

This package will automatically install the following dependencies: addict, numpy, pytorch and matplotlib.

1. Install from PyPI

pip install mp_pytorch

2. Install from source

git clone git@github.com:ALRhub/MP_PyTorch.git
cd mp_pytorch
pip install -e .

After installation, you can import the package easily.

import mp_pytorch
from mp_pytorch import MPFactory

 

Quickstart

For further information, please refer to the User Guide.

The main steps to create ProDMPs instance and generate trajectories are as follows:

1. Edit configuration

Suppose you have edited the required configuration. You can view the demo and check how to edit the configuration in Edit Configuration.

# config, times, params, params_L, bc_time, bc_pos, bc_vel, demos = get_mp_utils("prodmp", True, True)

2. Initial prodmp instance and update inputs

mp = MPFactory.init_mp(**config)
mp.update_inputs(times=times, params=params, params_L=params_L,
                 bc_time=bc_time, bc_pos=bc_pos, bc_vel=bc_vel)

# you can also choose to learn parameters from demonstrations.
params_dict = mp.learn_mp_params_from_trajs(times, demos)

3. Generate trajectories

traj_dict = mp.get_trajs(get_pos=True, get_pos_cov=True,
                         get_pos_std=True, get_vel=True,
                         get_vel_cov=True, get_vel_std=True)

# for probablistic movement primitives, you can also choose to sample trajectories
samples, samples_vel = mp.sample_trajectories(num_smp=10)

The structure of this package can be seen as follows:

Types Classes Description
Phase Generator PhaseGenerator Interface for Phase Generators
RhythmicPhaseGenerator Rhythmic phase generator
SmoothPhaseGenerator Smooth phase generator
LinearPhaseGenerator Linear phase generator
ExpDecayPhaseGenerator Exponential decay phase generator
Basis Generator BasisGenerator Interface for Basis Generators
RhythmicBasisGenerator Rhythmic basis generator
NormalizedRBFBasisGenerator Normalized RBF basis generator
ProDMPBasisGenerator ProDMP basis generator
Movement Primitives MPFactory Create an MP instance given configuration
MPInterface Interface for Deterministic Movement Primitives
ProbabilisticMPInterface Interface for Probablistic Movement Primitives
DMP Dynamic Movement Primitives
ProMP Probablistic Movement Primitives
ProDMP Probablistic Dynamic Movement Primitives

 

Cite

If you interest this project and use it in a scientific publication, we would appreciate citations to the following information:

@misc{Rofunc2022,
      author = {Ge Li},
      title = {MP_PyTorch: The Movement Primitives Package in PyTorch},
      year = {2022},
      publisher = {GitHub},
      journal = {GitHub repository},
      url = {https://github.com/ALRhub/MP_PyTorch},
}

 

Team

MP_PyTorch is developed and maintained by the ALR-Lab(Autonomous Learning Robots Lab), KIT.

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

mp_pytorch-0.1.1.tar.gz (33.2 kB view details)

Uploaded Source

Built Distribution

mp_pytorch-0.1.1-py3-none-any.whl (44.5 kB view details)

Uploaded Python 3

File details

Details for the file mp_pytorch-0.1.1.tar.gz.

File metadata

  • Download URL: mp_pytorch-0.1.1.tar.gz
  • Upload date:
  • Size: 33.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.15

File hashes

Hashes for mp_pytorch-0.1.1.tar.gz
Algorithm Hash digest
SHA256 060b617c3aa77b422c8179dc97b2bc2e4d6272b36d9f1e2642ced7cff68d2f8e
MD5 2a2a4ba7154e9e4bf6e093204d9d6ff3
BLAKE2b-256 6f9630081e8af1ec628b7e68493b917f2028a809c9264eff5407af0acbba52a4

See more details on using hashes here.

Provenance

File details

Details for the file mp_pytorch-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: mp_pytorch-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 44.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.15

File hashes

Hashes for mp_pytorch-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7ae34581b8d66291b57d76c464cd95063aba712a51aa76a3df64795a64628200
MD5 8db60e551ebccd73077f0f399070a406
BLAKE2b-256 87471048ad64d239de70170504b2dc2a56d4dd76336280f03b22b48943ce3238

See more details on using hashes here.

Provenance

Supported by

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