![]() |
A Python implementation of the Robotics Toolbox for MATLAB® |
This toolbox brings robotics specific functionality to Python, and leverages the Python's advantages of portability, ubiquity and support, and the capability of the open-source ecosystem for linear algebra (numpy, scipy), graphics (matplotlib, three.js, WebGL), interactive development (jupyter, jupyterlab, mybinder.org), and 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).
The Toolbox provides:
- code that is mature and provides a point of comparison for other implementations of the same algorithms;
- routines which are generally written in a straightforward manner which allows for easy understanding, perhaps at the expense of computational efficiency.
- source code which can be read for learning and teaching.
>>> 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
You will need Python >= 3.6
Install a snapshot from PyPI
pip3 install roboticstoolbox-python
Available options are:
Put the options in a comma separated list like
pip3 install roboticstoolbox-python[optionlist]
To install the bleeding-edge version from GitHub
git clone https://github.com/petercorke/robotics-toolbox-python.git
cd robotics-toolbox-python
pip3 install -e .
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.