Skip to main content

A Python library for robotic education and research

Reason this release was yanked:

extra package files are not being included in the source dist due to error in setup.py (will cause build failure if using the source dist).

Project description

Robotics Toolbox for Python

PyPI 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)

	┏━━━━━━━━┳━━━━━━━━┳━━━━━┳━━━━━━━┳━━━━━━━━━┳━━━━━━━━┓
	 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.8, 0.2, 0.1) * SE3.OA([0, 1, 0], [0, 0, -1])
sol = robot.ikine_min(T)         # solve IK
print(sol.q)                     # display joint angles

	[-0.01044    7.876    1.557    -6.81    1.571    4.686   0.5169]

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

	Out[35]: 
	SE3:                                           
		-1         -4e-08      0.000521   0.615    
		 2.79e-08   1          0.00013    0.154    
		-0.000521   0.00013   -1          0.105    
		 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.trajectory.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

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

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.

env = rtb.backends.Swift()  # instantiate 3D browser-based visualizer
env.launch()                # activate it
env.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
      env.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.

Publication List

NEO: A Novel Expeditious Optimisation Algorithm for Reactive Motion Control of Manipulators, J. Haviland and P. Corke. In the video, the robot is controlled using the Robotics toolbox for Python and features a recording from the Swift Simulator.

[Paper] [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]


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-0.7.0.tar.gz (234.8 kB view details)

Uploaded Source

Built Distributions

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

roboticstoolbox_python-0.7.0-cp38-cp38-win_amd64.whl (65.4 MB view details)

Uploaded CPython 3.8Windows x86-64

roboticstoolbox_python-0.7.0-cp38-cp38-manylinux2010_x86_64.whl (65.4 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.12+ x86-64

roboticstoolbox_python-0.7.0-cp38-cp38-macosx_10_14_x86_64.whl (65.4 MB view details)

Uploaded CPython 3.8macOS 10.14+ x86-64

roboticstoolbox_python-0.7.0-cp37-cp37m-win_amd64.whl (65.4 MB view details)

Uploaded CPython 3.7mWindows x86-64

roboticstoolbox_python-0.7.0-cp37-cp37m-manylinux2010_x86_64.whl (65.4 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.12+ x86-64

roboticstoolbox_python-0.7.0-cp37-cp37m-macosx_10_14_x86_64.whl (65.4 MB view details)

Uploaded CPython 3.7mmacOS 10.14+ x86-64

roboticstoolbox_python-0.7.0-cp36-cp36m-win_amd64.whl (65.4 MB view details)

Uploaded CPython 3.6mWindows x86-64

roboticstoolbox_python-0.7.0-cp36-cp36m-manylinux2010_x86_64.whl (65.4 MB view details)

Uploaded CPython 3.6mmanylinux: glibc 2.12+ x86-64

roboticstoolbox_python-0.7.0-cp36-cp36m-macosx_10_14_x86_64.whl (65.4 MB view details)

Uploaded CPython 3.6mmacOS 10.14+ x86-64

File details

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

File metadata

  • Download URL: roboticstoolbox-python-0.7.0.tar.gz
  • Upload date:
  • Size: 234.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for roboticstoolbox-python-0.7.0.tar.gz
Algorithm Hash digest
SHA256 af6d51994246af00041905553bd1530089118c7673f82bfae83be56e11ba7b95
MD5 59385b38e27ac9fd27a771d0b051e830
BLAKE2b-256 7f676a615abb3a7018b89fd05678e2601a28f4986ba8399dec72ce622ab0b7d0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: roboticstoolbox_python-0.7.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 65.4 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.6

File hashes

Hashes for roboticstoolbox_python-0.7.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 15f1a0044ef57637f347b6422ec97dacdb724da82067fdf81ff006601504d119
MD5 61255c522e26da1c435357cd3b913cbe
BLAKE2b-256 b6ecf0664481953aa0304595af6f0f57f27c140e00f14b48ce5380ad8865feb9

See more details on using hashes here.

File details

Details for the file roboticstoolbox_python-0.7.0-cp38-cp38-manylinux2010_x86_64.whl.

File metadata

  • Download URL: roboticstoolbox_python-0.7.0-cp38-cp38-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 65.4 MB
  • Tags: CPython 3.8, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for roboticstoolbox_python-0.7.0-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 2cc6f73149f037894daf81118954a2c3c4f6c49edc96af2f08e157d9e8c31d9e
MD5 a8519e888f9394ae25a82eaa1267b5ba
BLAKE2b-256 18b2b4d7ead317a4bdaf68b9771d6fbdf4ebc5308c7a4b1358cebf73472d8338

See more details on using hashes here.

File details

Details for the file roboticstoolbox_python-0.7.0-cp38-cp38-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for roboticstoolbox_python-0.7.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 98c992758853233745957baff14e88192da100e023303f34053f9b4c41486735
MD5 fe51867d6dd44ec328999da5f6adcdc8
BLAKE2b-256 2f1c444bca91a743dbf101de961a804a3aa815c64b10e2b2d447261aa34d878c

See more details on using hashes here.

File details

Details for the file roboticstoolbox_python-0.7.0-cp38-cp38-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: roboticstoolbox_python-0.7.0-cp38-cp38-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 65.4 MB
  • Tags: CPython 3.8, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.6

File hashes

Hashes for roboticstoolbox_python-0.7.0-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 41604573f88523992d59aa84626c94d6905f655a44f4ae4d907d928cc6fc140d
MD5 c7fde5c7a49b0cc8d7eef954a70d9d6a
BLAKE2b-256 384efd81a7c40eea1d1a4670711b419dcc47bd551706c2493e3b70c8a0e4e17f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: roboticstoolbox_python-0.7.0-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 65.4 MB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for roboticstoolbox_python-0.7.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 c99912f3ef00e7ad0f8ed35fe4373652fee551a3a3704b7e8df01c76c1177488
MD5 7581af8cb39b801ead79ced962effc24
BLAKE2b-256 7743e2a330ec1eb1b2715c3ee8e5661706ab8c73f51c1b2a0086e9d69af51ceb

See more details on using hashes here.

File details

Details for the file roboticstoolbox_python-0.7.0-cp37-cp37m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: roboticstoolbox_python-0.7.0-cp37-cp37m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 65.4 MB
  • Tags: CPython 3.7m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for roboticstoolbox_python-0.7.0-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 5978fb5d563a59b322538e678d934ea277c5c7b69c1338961b42fd03af8cc2f8
MD5 bca3b7c126afdde35d4ca601023bda34
BLAKE2b-256 84bb0a645d759828ed0c32673caefb4425a8f5c7a6a94073a9261a4c8011e0a4

See more details on using hashes here.

File details

Details for the file roboticstoolbox_python-0.7.0-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for roboticstoolbox_python-0.7.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 3254e6c1cddabf75514f32ca29f72faf6c77d75990de4461921fce6b0296fcd6
MD5 e315c9c00a01f0a5528b9c9da613b560
BLAKE2b-256 5032fa1bf0c3114ba62f209d8965607cfda79ce3a4ade3de3375ed0de5bcf739

See more details on using hashes here.

File details

Details for the file roboticstoolbox_python-0.7.0-cp37-cp37m-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: roboticstoolbox_python-0.7.0-cp37-cp37m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 65.4 MB
  • Tags: CPython 3.7m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for roboticstoolbox_python-0.7.0-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 47a71b5d16acc54f651ded94ebcdc0a4e0ccaf6317a2666929688a69cdcae12c
MD5 94cd1cf051f58945097c7d9afda89579
BLAKE2b-256 f20ce3543dd671b692b6e556ea7aaa85d2343e04ad5ccd58597efaf8fd21e2d6

See more details on using hashes here.

File details

Details for the file roboticstoolbox_python-0.7.0-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: roboticstoolbox_python-0.7.0-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 65.4 MB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.6.8

File hashes

Hashes for roboticstoolbox_python-0.7.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 17956804084a099b5e2accbd04db287a4433df71c1aa7fcbb57d0b2e26494a23
MD5 a9ae9bcbb7ed22149c2f9104ac27355b
BLAKE2b-256 dff22ae72e87a0b8725970d54a8ae0b436347a37c8c88fb6467ed8c6deb27ef5

See more details on using hashes here.

File details

Details for the file roboticstoolbox_python-0.7.0-cp36-cp36m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: roboticstoolbox_python-0.7.0-cp36-cp36m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 65.4 MB
  • Tags: CPython 3.6m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for roboticstoolbox_python-0.7.0-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 4a656e78753dfaff8483c0ec1dd5b7742d6b55c1aac20196512cd11276ae136c
MD5 c1446edf1119d1ec984717491ed77a3f
BLAKE2b-256 4452fc3765e4ee6fa8a6a571c585f95787a8b215844a7cb6e48e321d2ec76948

See more details on using hashes here.

File details

Details for the file roboticstoolbox_python-0.7.0-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for roboticstoolbox_python-0.7.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 548f3303489e70b900a291c5c4f786a0c79387ec58fb39214cfcc8b3254611f4
MD5 741b8f4ae9b065e7157cec602ecdd7c5
BLAKE2b-256 2707bb820ef8823cab38a7c189042f4e4d76d2a24d4642356f8640a12ed41bce

See more details on using hashes here.

File details

Details for the file roboticstoolbox_python-0.7.0-cp36-cp36m-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: roboticstoolbox_python-0.7.0-cp36-cp36m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 65.4 MB
  • Tags: CPython 3.6m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.6.12

File hashes

Hashes for roboticstoolbox_python-0.7.0-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 a43110f39303ca86737bb5e62a7d36914ff4000c6e77b85d75ba2d20705d172d
MD5 35ba5268008969d2a8ace83a4799e43b
BLAKE2b-256 a8bb5ee574433d5abbc97c7e97048623e9deb23fff6a78b8ba7fe89fdbe43fe0

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