This code is a Python implementation of DMPs by Chauby (Email: chaubyZou@163.com), it is free for everyone.
The corresponding tutorial can be found at:
- Zhihu:Dynamic Movement Primitives介绍及Python实现与UR5机械臂仿真 - 知乎 (zhihu.com)
- Wechat:https://mp.weixin.qq.com/s/a-cQc8nW-jVJk7KwNWMojQ
The code has been tested on Windows 10 with Anaconda 3, and NOT tested on Ubuntu or Mac. Since the code is very simple, the author belive it also works well on the other system with Anaconda 3.
Requirements:
- Python 3.6+
- Numpy
- Scipy
- Matplotlib
For simulation on CoppeliaSim, you need to install the CoppeliaSim 4.2 or later version.
Canonical system with different parameters:
The DMP model is used to model and reproduce sine and cosine trajectories with a limited time.
The solid curves represent the demonstrated trajectories, the dashed curves represent the reproduced trajectories by DMP models with the same and different initial and goal positions.
The conventional DMP can not model the trajectory with a same start and goal positions, since
The modified version of DMP can address the problem, the result is shown as follows:
For demonstrated trajecotry with only one dimension.
For demonstrated trajecotry with two dimensions.
- Open the CoppeliaSim project file in the folder "coppeliasim";
- Click the "run" button of the CoppeliaSim to run the project file;
- Run python script "demo_rhythmic_DMP_UR5.py" or "demo_discrete_DMP_UR5.py".
The position of the end-effector are set by the code, and the inverse kinematics calculation model in CoppeliaSim are used to calculate the joint angles of UR5.
The corresponding positions for the end-effector of UR5 are shown as follows:
Randomly modiy goal positions of the reproduced trajectory:
Randomly modify initial and goal positions of the reproduced trajectory:
Three joints of the UR5 robot are under control.
The corresponding joint angles are show as follows:
The reference paper can be found at the folder named 'paper', and can also be downloaded at:
For more tutorials about the robot planning and control, please refer to: