Skip to main content

A Python library for robotic education and research

Project description

Robotics Toolbox for Python

PyPI version Anaconda version PyPI - Python Version License: MIT Binder QUT Centre for Robotics Open Source

Build Status Coverage Language grade: Python PyPI - Downloads

A Python implementation of the Robotics Toolbox for MATLAB®

Synopsis

This toolbox brings robotics-specific functionality to Python, and leverages 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 easily create your own in Denavit-Hartenberg form, import a URDF file, or use over 30 supplied models for well-known contemporary robots from Franka-Emika, Kinova, Universal Robotics, Rethink as well as classical robots such as the Puma 560 and the Stanford arm.

The toolbox will also support 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;
  • backward compatability with the Robotics Toolbox for MATLAB

The Toolbox leverages the Spatial Maths Toolbox for Python to provide support for data types such as SO(n) and SE(n) matrices, quaternions, twists and spatial vectors.

Code Example

We will load a model of the Franka-Emika Panda robot defined classically using modified (Craig's convention) Denavit-Hartenberg notation

import roboticstoolbox as rtb
robot = rtb.models.DH.Panda()
print(robot)

	Panda (by Franka Emika): 7 axes (RRRRRRR), modified DH parameters
	┏━━━━━━━━┳━━━━━━━━┳━━━━━┳━━━━━━━┳━━━━━━━━━┳━━━━━━━━┓
	 aⱼ₋₁     ₋₁   θⱼ    dⱼ      q       q   
	┣━━━━━━━━╋━━━━━━━━╋━━━━━╋━━━━━━━╋━━━━━━━━━╋━━━━━━━━┫
	    0.0    0.0°   q1  0.333  -166.0°  166.0° 
	    0.0  -90.0°   q2    0.0  -101.0°  101.0° 
	    0.0   90.0°   q3  0.316  -166.0°  166.0° 
	 0.0825   90.0°   q4    0.0  -176.0°   -4.0° 
	-0.0825  -90.0°   q5  0.384  -166.0°  166.0° 
	    0.0   90.0°   q6    0.0    -1.0°  215.0° 
	  0.088   90.0°   q7  0.107  -166.0°  166.0° 
	┗━━━━━━━━┻━━━━━━━━┻━━━━━┻━━━━━━━┻━━━━━━━━━┻━━━━━━━━┛

	┌─────┬───────────────────────────────────────┐
	tool  t = 0, 0, 0.1; rpy/xyz = -45°, 0°, 0° 
	└─────┴───────────────────────────────────────┘

	┌─────┬─────┬────────┬─────┬───────┬─────┬───────┬──────┐
	name  q0   q1      q2   q3     q4   q5     q6   
	├─────┼─────┼────────┼─────┼───────┼─────┼───────┼──────┤
	  qz   0°   0°      0°   0°     0°   0°     0°  
	  qr   0°  -17.2°   0°  -126°   0°   115°   45° 
	└─────┴─────┴────────┴─────┴───────┴─────┴───────┴──────┘

T = robot.fkine(robot.qz)  # forward kinematics
print(T)

	   0.707107    0.707107    0           0.088
	   0.707107   -0.707107    0           0
	   0           0          -1           0.823
	   0           0           0           1

(Python prompts are not shown to make it easy to copy+paste the code, console output is indented)

We can solve inverse kinematics very easily. We first choose an SE(3) pose defined in terms of position and orientation (end-effector z-axis down (A=-Z) and finger orientation parallel to y-axis (O=+Y)).

from spatialmath import SE3

T = SE3(0.7, 0.2, 0.1) * SE3.OA([0, 1, 0], [0, 0, -1])
sol = robot.ikine_LM(T)         # solve IK
print(sol)
	IKsolution(q=array([  0.2134,    1.867,  -0.2264,   0.4825,   0.2198,    1.396,   -2.037]), success=True, reason=None, iterations=12, residual=1.4517646473808178e-11)

q_pickup = sol.q
print(robot.fkine(q_pickup))    # FK shows that desired end-effector pose was achieved

	Out[35]:
		-1            9.43001e-14  2.43909e-12  0.7
		 9.43759e-14  1            7.2574e-13   0.2
		-2.43913e-12  7.2575e-13  -1            0.1
		 0            0            0            1

Note that because this robot is redundant we don't have any control over the arm configuration apart from end-effector pose, ie. we can't control the elbow height.

We can animate a path from the upright qz configuration to this pickup configuration

qt = rtb.jtraj(robot.qz, q_pickup, 50)
robot.plot(qt.q, movie='panda1.gif')

Panda trajectory animation

which uses the default matplotlib backend. Grey arrows show the joint axes and the colored frame shows the end-effector pose.

Let's now load a URDF model of the same robot. The kinematic representation is no longer based on Denavit-Hartenberg parameters, it is now a rigid-body tree.

robot = rtb.models.URDF.Panda()  # load URDF version of the Panda
print(robot)    # display the model

	panda (by Franka Emika): 7 axes (RRRRRRR), ETS model
	┌───┬──────────────┬─────────────┬──────────────┬──────────────────────────────────────────────────────────────────────────────┐
	id      link        parent        joint                                          ETS                                      
	├───┼──────────────┼─────────────┼──────────────┼──────────────────────────────────────────────────────────────────────────────┤
	 0   panda_link0          _O_                {panda_link0} = {_O_}                                                        
	 1   panda_link1  panda_link0  panda_joint1  {panda_link1} = {panda_link0}  * tz(0.333) * Rz(q0)                          
	 2   panda_link2  panda_link1  panda_joint2  {panda_link2} = {panda_link1}  * Rx(-90°) * Rz(q1)                           
	 3   panda_link3  panda_link2  panda_joint3  {panda_link3} = {panda_link2}  * ty(-0.316) * Rx(90°) * Rz(q2)               
	 4   panda_link4  panda_link3  panda_joint4  {panda_link4} = {panda_link3}  * tx(0.0825) * Rx(90°) * Rz(q3)               
	 5   panda_link5  panda_link4  panda_joint5  {panda_link5} = {panda_link4}  * tx(-0.0825) * ty(0.384) * Rx(-90°) * Rz(q4) 
	 6   panda_link6  panda_link5  panda_joint6  {panda_link6} = {panda_link5}  * Rx(90°) * Rz(q5)                            
	 7   panda_link7  panda_link6  panda_joint7  {panda_link7} = {panda_link6}  * tx(0.088) * Rx(90°) * Rz(q6)                
	 8  @panda_link8  panda_link7  panda_joint8  {panda_link8} = {panda_link7}  * tz(0.107)                                   
	└───┴──────────────┴─────────────┴──────────────┴──────────────────────────────────────────────────────────────────────────────┘

	┌─────┬─────┬────────┬─────┬───────┬─────┬───────┬──────┐
	name  q0   q1      q2   q3     q4   q5     q6   
	├─────┼─────┼────────┼─────┼───────┼─────┼───────┼──────┤
	  qz   0°   0°      0°   0°     0°   0°     0°  
	  qr   0°  -17.2°   0°  -126°   0°   115°   45° 
	└─────┴─────┴────────┴─────┴───────┴─────┴───────┴──────┘

The symbol @ indicates the link as an end-effector, a leaf node in the rigid-body tree.

We can instantiate our robot inside a browser-based 3d-simulation environment.

from roboticstoolbox.backends.Swift import Swift  # instantiate 3D browser-based visualizer
backend = Swift()
backend.launch()            # activate it
backend.add(robot)          # add robot to the 3D scene
for qk in qt.q:             # for each joint configuration on trajectory
      robot.q = qk          # update the robot state
      backend.step()        # update visualization

Getting going

Installing

You will need Python >= 3.6

Using pip

Install a snapshot from PyPI

pip3 install roboticstoolbox-python

Available options are:

  • vpython install VPython backend
  • collision install collision checking with pybullet

Put the options in a comma separated list like

pip3 install roboticstoolbox-python[optionlist]

Swift, a web-based visualizer, is installed as part of Robotics Toolbox.

From GitHub

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 .

Run some examples

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.

Toolbox Research Applications

The toolbox is incredibly useful for developing and prototyping algorithms for research, thanks to the exhaustive set of well documented and mature robotic functions exposed through clean and painless APIs. Additionally, the ease at which a user can visualize their algorithm supports a rapid prototyping paradigm.

Check out our ICRA 2021 paper on IEEE Xplore or get the PDF from Peter's website.

If the toolbox helped you in your research, please cite

@inproceedings{rtb,
  title={Not your grandmother’s toolbox--the Robotics Toolbox reinvented for Python},
  author={Corke, Peter and Haviland, Jesse},
  booktitle={2021 IEEE International Conference on Robotics and Automation (ICRA)},
  pages={11357--11363},
  year={2021},
  organization={IEEE}
}

Publication List

J. Haviland, N. Sünderhauf and P. Corke, "A Holistic Approach to Reactive Mobile Manipulation," in IEEE Robotics and Automation Letters, doi: 10.1109/LRA.2022.3146554. In the video, the robot is controlled using the Robotics toolbox for Python and features a recording from the Swift Simulator.

[Arxiv Paper] [IEEE Xplore] [Project Website] [Video] [Code Example]

J. Haviland and P. Corke, "NEO: A Novel Expeditious Optimisation Algorithm for Reactive Motion Control of Manipulators," in IEEE Robotics and Automation Letters, doi: 10.1109/LRA.2021.3056060. In the video, the robot is controlled using the Robotics toolbox for Python and features a recording from the Swift Simulator.

[Arxiv Paper] [IEEE Xplore] [Project Website] [Video] [Code Example]

A Purely-Reactive Manipulability-Maximising Motion Controller, J. Haviland and P. Corke. In the video, the robot is controlled using the Robotics toolbox for Python.

[Paper] [Project Website] [Video] [Code Example]


Common Issues

See the common issues with fixes here.

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

roboticstoolbox-python-1.0.1.tar.gz (1.4 MB view details)

Uploaded Source

Built Distributions

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

roboticstoolbox_python-1.0.1-cp310-cp310-win_amd64.whl (1.8 MB view details)

Uploaded CPython 3.10Windows x86-64

roboticstoolbox_python-1.0.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (2.7 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.12+ x86-64manylinux: glibc 2.5+ x86-64

roboticstoolbox_python-1.0.1-cp310-cp310-macosx_10_15_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.10macOS 10.15+ x86-64

roboticstoolbox_python-1.0.1-cp39-cp39-win_amd64.whl (1.8 MB view details)

Uploaded CPython 3.9Windows x86-64

roboticstoolbox_python-1.0.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (2.7 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.12+ x86-64manylinux: glibc 2.5+ x86-64

roboticstoolbox_python-1.0.1-cp39-cp39-macosx_10_15_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.9macOS 10.15+ x86-64

roboticstoolbox_python-1.0.1-cp38-cp38-win_amd64.whl (1.8 MB view details)

Uploaded CPython 3.8Windows x86-64

roboticstoolbox_python-1.0.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (2.7 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.12+ x86-64manylinux: glibc 2.5+ x86-64

roboticstoolbox_python-1.0.1-cp38-cp38-macosx_10_15_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.8macOS 10.15+ x86-64

roboticstoolbox_python-1.0.1-cp37-cp37m-win_amd64.whl (1.8 MB view details)

Uploaded CPython 3.7mWindows x86-64

roboticstoolbox_python-1.0.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (2.7 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.12+ x86-64manylinux: glibc 2.5+ x86-64

roboticstoolbox_python-1.0.1-cp37-cp37m-macosx_10_15_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.7mmacOS 10.15+ x86-64

roboticstoolbox_python-1.0.1-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (2.7 MB view details)

Uploaded CPython 3.6mmanylinux: glibc 2.12+ x86-64manylinux: glibc 2.5+ x86-64

File details

Details for the file roboticstoolbox-python-1.0.1.tar.gz.

File metadata

  • Download URL: roboticstoolbox-python-1.0.1.tar.gz
  • Upload date:
  • Size: 1.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for roboticstoolbox-python-1.0.1.tar.gz
Algorithm Hash digest
SHA256 76d6bbb627c3ef98f8edbeadd2ef15cc59e65cd6cffdeb75cd5a3346a215d802
MD5 81c4e72448bc89d0cf5a99e7a19abc38
BLAKE2b-256 8a050456787133d010757d5f02c258e1e99024dd5d26855985f6c0160b48d376

See more details on using hashes here.

File details

Details for the file roboticstoolbox_python-1.0.1-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for roboticstoolbox_python-1.0.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 fa1a1fcfd9b622b2e65db899e1e81101ca374f82107b0269fbdbf37b79701290
MD5 6f594a26b344120876fbc7d5b08315f9
BLAKE2b-256 4ec0a2da853701d4ebef75573c03d32c7a18c4d86bec4d51190cf500a64b4818

See more details on using hashes here.

File details

Details for the file roboticstoolbox_python-1.0.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for roboticstoolbox_python-1.0.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 470af62c686535fe722865aec694fe721815970dbcc47370502e8ab889acc644
MD5 2c2d36577f30178ad769d0a0e2b28872
BLAKE2b-256 afb42065b3ea11b3c2682735dae50bebfd2cc74d5aa8e828e65d0f63e3af76b1

See more details on using hashes here.

File details

Details for the file roboticstoolbox_python-1.0.1-cp310-cp310-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for roboticstoolbox_python-1.0.1-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 6b11e4a901a991928329151901aee1fd4f168c2f50d4f971478204c09eb89f28
MD5 b5f92280791efb0015a646f4e69f97bc
BLAKE2b-256 d94ce7ecd4fad8daa4f3fd4dc685af0217a3967c6bdfe47600bed36b5b0ac64e

See more details on using hashes here.

File details

Details for the file roboticstoolbox_python-1.0.1-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for roboticstoolbox_python-1.0.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 2cf17b4b5268b77b110b5b09902ba8e8af6202b295bd2bbed63583dd81a3615b
MD5 7170ce53f86d8fffc62d7b4b41ab77c5
BLAKE2b-256 11560f53dc732a9f1d8a5477b0917417c8f4d39d5bb6d2001302fd6049d042a3

See more details on using hashes here.

File details

Details for the file roboticstoolbox_python-1.0.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for roboticstoolbox_python-1.0.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 c2e08523ebd541cf4a53c95493c026707fabce639f89a459d3c16cc803b957fa
MD5 52be15169b647ae7f0e2c601e8297a0c
BLAKE2b-256 26ecb8849352f53cb2f8d9cf397c6274439814473a3c3662f91c6a52bb510cc5

See more details on using hashes here.

File details

Details for the file roboticstoolbox_python-1.0.1-cp39-cp39-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for roboticstoolbox_python-1.0.1-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 a7484badf628b1c8c1fdf385a6531943e18261889c115ebf02eae6c50543968d
MD5 1bba3b41e0e96d3ff7e3df3963d3a8f7
BLAKE2b-256 4de19a350e7d544fa1b58b83e29de686dbef9298d8ac757195d3a9006c05d552

See more details on using hashes here.

File details

Details for the file roboticstoolbox_python-1.0.1-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for roboticstoolbox_python-1.0.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 c96e6e787fa9caa51d99a32375a1d6f283550bbcf96f81c8fac1654a132cd917
MD5 ff1efaf2d36a25f05ad84cf3e66e4e49
BLAKE2b-256 add5d99445c33e7e44149e757eec0182843d88e70499e99837e5f69db7bc85a9

See more details on using hashes here.

File details

Details for the file roboticstoolbox_python-1.0.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for roboticstoolbox_python-1.0.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 3503b81e6da8fe9a42a2b31162b4270b1cba6d0309c069235cece51e8534b769
MD5 0526d7832dc01cf64c80fa6923d17905
BLAKE2b-256 516ec923521c32505e5f371aa6e32b86c97ea8b2f53a9ebf3cd786940a63e4b8

See more details on using hashes here.

File details

Details for the file roboticstoolbox_python-1.0.1-cp38-cp38-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for roboticstoolbox_python-1.0.1-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 c44c5a3a8d27ac280c0b63cd4135c027ae16c021a2487b6702f2f2210ff32f56
MD5 a4ffad7684d4a1213e7374cb827f3616
BLAKE2b-256 935dbc58e7dba88fc711b45bd48a48745c8677aca58c7dbbf4a4787b1f1762fb

See more details on using hashes here.

File details

Details for the file roboticstoolbox_python-1.0.1-cp37-cp37m-win_amd64.whl.

File metadata

File hashes

Hashes for roboticstoolbox_python-1.0.1-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 b1c715c74d9ab05e9fa7ef9e7b84c64d99d5fb6bb21b9cc9440f8c144958831c
MD5 5bce5100aef399b708dc48121558384a
BLAKE2b-256 c37eeeeaa5d4e48e85be8a70d94de98e709eb4b76a84eebcec4270fbf0cce436

See more details on using hashes here.

File details

Details for the file roboticstoolbox_python-1.0.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for roboticstoolbox_python-1.0.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 818d80c272f32471f669e848098904fef3dd44864b3097654fb8a0adf394dd35
MD5 84a4fda8a0c1ad8494793292ff2df869
BLAKE2b-256 981b6b92d5e3281a725ee8f7f59b3a43f1fdc381b7e6727b2402c8bbe0db27b8

See more details on using hashes here.

File details

Details for the file roboticstoolbox_python-1.0.1-cp37-cp37m-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for roboticstoolbox_python-1.0.1-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 41893480ef2adbc0f1105bd6357f51d0378e134170f41ba20819c262d3430a91
MD5 d77c63375165fe73e42628e6cfe82775
BLAKE2b-256 b537b2084a940101fd3823e91d5f4866432b0c495ea538bc23f9704e95873246

See more details on using hashes here.

File details

Details for the file roboticstoolbox_python-1.0.1-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for roboticstoolbox_python-1.0.1-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 d25eb052d13777726a150994bfcbf1eb1550b8156fb10a896aa36a6a70944c41
MD5 a8b4e704600f8691183a086a18cfb3cb
BLAKE2b-256 930fb34d040bb3af60a2bc637e6b946d79d0e1acd66d2609535b2dd76bab177c

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