This is a Python implementation of the Robotics Toolbox for MATLAB®.
- GitHub repository https://github.com/petercorke/robotics-toolbox-python
- Examples and details: https://github.com/petercorke/robotics-toolbox-python/wiki
- Documentation https://petercorke.github.io/robotics-toolbox-python
This toolbox brings robotics specific functionality to Python, and leverages the advantages of Python such as portability, ubiquity and support, and the capability of the Python ecosystem for linear algebra (numpy, scipy), graphics (matplotlib, three.js), interactive development (jupyter, jupyterlab), documentation (sphinx).
The Toolbox provides tools for representing the kinematics and dynamics of serial-link manipulators - you can create your own in Denavit-Hartenberg form, import a URDF file, or use supplied models for well known robots from Franka-Emika, Kinova, Universal Robotics, Rethink as well as classical robots such as the Puma 560 and the Stanford arm.
The toolbox also supports mobile robots with functions for robot motion models (unicycle, bicycle), path planning algorithms (bug, distance transform, D*, PRM), kinodynamic planning (lattice, RRT), localization (EKF, particle filter), map building (EKF) and simultaneous localization and mapping (EKF), and a Simulink model a of non-holonomic vehicle. The Toolbox also including a detailed Simulink model for a quadrotor flying robot.
Advantages of the Toolbox are that:
- the code is mature and provides a point of comparison for other implementations of the same algorithms;
- the routines are generally written in a straightforward manner which allows for easy understanding, perhaps at the expense of computational efficiency. If you feel strongly about computational efficiency then you can always rewrite the function to be more efficient, compile the M-file using the MATLAB compiler, or create a MEX version;
- since source code is available there is a benefit for understanding and teaching.
The MATLAB version of this Toolbox dates back to 1993.
>>> import roboticstoolbox as rtb
>>> p560 = rtb.models.DH.Puma560()
>>> print(p560)
┏━━━┳━━━━━━━━━┳━━━━━━━━┳━━━━━━┓
┃θⱼ ┃ dⱼ ┃ aⱼ ┃ ⍺ⱼ ┃
┣━━━╋━━━━━━━━━╋━━━━━━━━╋━━━━━━┫
┃q1 ┃ 0.672 ┃ 0 ┃ None ┃
┃q2 ┃ 0 ┃ 0.4318 ┃ None ┃
┃q3 ┃ 0.15005 ┃ 0.0203 ┃ None ┃
┃q4 ┃ 0.4318 ┃ 0 ┃ None ┃
┃q5 ┃ 0 ┃ 0 ┃ None ┃
┃q6 ┃ 0 ┃ 0 ┃ None ┃
┗━━━┻━━━━━━━━━┻━━━━━━━━┻━━━━━━┛
┌───┬────────────────────────────┐
│qz │ 0°, 0°, 0°, 0°, 0°, 0° │
│qr │ 0°, 90°, -90°, 0°, 0°, 0° │
│qs │ 0°, 0°, -90°, 0°, 0°, 0° │
│qn │ 0°, 45°, 180°, 0°, 45°, 0° │
└───┴────────────────────────────┘
>>> p560.fkine([0, 0, 0, 0, 0, 0]) # forward kinematics
1 0 0 0.4521
0 1 0 -0.15005
0 0 1 0.4318
0 0 0 1
We can animate a path
qt = rtb.tools.trajectory.jtraj(p560.qz, p560.qr, 50)
p560.plot(qt.q)
which uses the default matplotlib backend. We can instantiate our robot inside the 3d simulation environment
env = rtb.backend.Sim()
env.launch()
env.add(p560)
# inv kienmatis example here
# jacobian
Requires Python ≥ 3.5.
git clone https://github.com/petercorke/robotics-toolbox-python.git
cd robotics-toolbox-python
pip3 install -e .
Install a snapshot from PyPI
pip3 install roboticstoolbox-python
The notebooks
folder contains some tutorial Jupyter notebooks which you can browse on GitHub.
Or you can run them, and experiment with them, at mybinder.org.