Skip to main content

A Python library for robotic education and research

Project description

Robotics Toolbox for Python

PyPI version PyPI - Python Version Language grade: Python Build Status Coverage License: MIT Binder QUT Centre for Robotics Open Source

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

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])
q_pickup, *_ = robot.ikunc(T)   # solve IK, ignore additional outputs
print(q_pickup)                 # display joint angles

	[ 1.10903519  1.21806211  0.10114796  1.49547496  0.33270093 -0.29437262 -0.8927488 ]

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

	  -1          -1.31387e-11-1.57726e-09 0.0999999    
	  -1.31386e-11 1          -7.46658e-08 0.2          
	   1.57726e-09-7.46658e-08-1           0.5          
	   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) 
	└───┴──────────────┴─────────────┴──────────────┴─────────────────────────────────────────────┘

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

URDF Panda trajectory animation

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
  • 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-sim, 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.

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.6.1.tar.gz (180.3 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.6.1-cp38-cp38-win_amd64.whl (53.3 MB view details)

Uploaded CPython 3.8Windows x86-64

roboticstoolbox_python-0.6.1-cp38-cp38-manylinux2010_x86_64.whl (53.4 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.12+ x86-64

roboticstoolbox_python-0.6.1-cp38-cp38-macosx_10_14_x86_64.whl (53.3 MB view details)

Uploaded CPython 3.8macOS 10.14+ x86-64

roboticstoolbox_python-0.6.1-cp37-cp37m-win_amd64.whl (53.3 MB view details)

Uploaded CPython 3.7mWindows x86-64

roboticstoolbox_python-0.6.1-cp37-cp37m-manylinux2010_x86_64.whl (53.4 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.12+ x86-64

roboticstoolbox_python-0.6.1-cp37-cp37m-macosx_10_14_x86_64.whl (53.3 MB view details)

Uploaded CPython 3.7mmacOS 10.14+ x86-64

roboticstoolbox_python-0.6.1-cp36-cp36m-win_amd64.whl (53.3 MB view details)

Uploaded CPython 3.6mWindows x86-64

roboticstoolbox_python-0.6.1-cp36-cp36m-manylinux2010_x86_64.whl (53.4 MB view details)

Uploaded CPython 3.6mmanylinux: glibc 2.12+ x86-64

roboticstoolbox_python-0.6.1-cp36-cp36m-macosx_10_14_x86_64.whl (53.3 MB view details)

Uploaded CPython 3.6mmacOS 10.14+ x86-64

File details

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

File metadata

  • Download URL: roboticstoolbox-python-0.6.1.tar.gz
  • Upload date:
  • Size: 180.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.9

File hashes

Hashes for roboticstoolbox-python-0.6.1.tar.gz
Algorithm Hash digest
SHA256 49c6d4251feacf0ea0e075e00ac607393d5fe3689dca78a1e79ae942e86403df
MD5 d17eb432d00712a605ebd07c9dbce3d2
BLAKE2b-256 9cf3390e02ec5e727dca32a6484bad2418c56ba8e31f27976333258e44c24e9e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: roboticstoolbox_python-0.6.1-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 53.3 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6

File hashes

Hashes for roboticstoolbox_python-0.6.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 2c5280974594e4179cac6a850e00cc709b6621020dec66d1a04617532d2df337
MD5 832b33eeb84c05950c5a9d1048414eeb
BLAKE2b-256 0b726d27272711c259a025c08769b1eac6a516f2832bec7e51060d47fd9e0a77

See more details on using hashes here.

File details

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

File metadata

  • Download URL: roboticstoolbox_python-0.6.1-cp38-cp38-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 53.4 MB
  • Tags: CPython 3.8, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.9

File hashes

Hashes for roboticstoolbox_python-0.6.1-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 382fad6b08d562b25aa05c7a8ab2f5eef144734ec37cb09d69c7593970fd1dcc
MD5 2e38e94f8ea96bb488a7d846946d2f81
BLAKE2b-256 98793075707fdf9dd3ac8e30555b11be24893f1a182fcee595b4d44e35aa68c7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for roboticstoolbox_python-0.6.1-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 9a7631efdd353addfac841561a98cf6866ee3cc541294c3a9ec67a73b87cf70d
MD5 fdc50fc42286cdc8b56a8fbc78f3e731
BLAKE2b-256 6ca03517dbb3d6d27d0ddf6fe1d26013110f318cea4e5882127dd8b51db830d0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: roboticstoolbox_python-0.6.1-cp38-cp38-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 53.3 MB
  • Tags: CPython 3.8, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6

File hashes

Hashes for roboticstoolbox_python-0.6.1-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 9113f277c25409f054566dd3d0be76f30d17c76df83d0d52c1bd474abed64b3a
MD5 afd454f047f9eb249a9966faf2b52665
BLAKE2b-256 785e4a08faa75692348c03150797f8fd41a88b8ff56cb316ff067ca0e77b4c96

See more details on using hashes here.

File details

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

File metadata

  • Download URL: roboticstoolbox_python-0.6.1-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 53.3 MB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.9

File hashes

Hashes for roboticstoolbox_python-0.6.1-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 1a7cf1e4b904fc6dfb7a32cfa9565ba483804dd3e8093936986c9709bb792c5d
MD5 506ccff840d93dfae819f535e6b98d79
BLAKE2b-256 b7eca83e0f78d143e1b66283166cef1f8b7ec0fadd247a193e81fe95860de116

See more details on using hashes here.

File details

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

File metadata

  • Download URL: roboticstoolbox_python-0.6.1-cp37-cp37m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 53.4 MB
  • Tags: CPython 3.7m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.9

File hashes

Hashes for roboticstoolbox_python-0.6.1-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 c7749fcd1764b99a1067cf99dc02ca7b524bfd298fe191ea4a75fbfb3a1b9a28
MD5 e0b03b4a8fb43859ff70264bda92cfc7
BLAKE2b-256 314c182317c9dc5d92b06560444086cc9807ca993087794980aed2cbc2f0764a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for roboticstoolbox_python-0.6.1-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 0d58abcdf29b285fd46898ad18b56dd09392b26a26f2b56bf9f8cb701c65f6e6
MD5 424be3a4089f3f6c6f3dc671bfe2f126
BLAKE2b-256 7f69b32267fc2da1e25525b05aedf90c0a0791e81e8447b5e0053e0bd6a44115

See more details on using hashes here.

File details

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

File metadata

  • Download URL: roboticstoolbox_python-0.6.1-cp37-cp37m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 53.3 MB
  • Tags: CPython 3.7m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.9

File hashes

Hashes for roboticstoolbox_python-0.6.1-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 1d5eb901253323137b916b84846312f0cdcd8cddccf8b9244fb29d6c4ff6ca23
MD5 a585df6ffa6112cdbd4e6f8d13f51e1a
BLAKE2b-256 fea28e7d83b841551d9521ffe52e9eb89c8ea8d8ee4fa0c13ac1c106f002ec9c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: roboticstoolbox_python-0.6.1-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 53.3 MB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.6.8

File hashes

Hashes for roboticstoolbox_python-0.6.1-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 bf0147c1f77375b570234fa0153cf8c77cee1d41b68ab5e9c92e547d812cee58
MD5 e932c34f4d75e300a3f0516b2b79bcbd
BLAKE2b-256 c76f2c85db5b0a3a3aea8f667daedf943ae0c003da25948f3ba34500e2e7013b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: roboticstoolbox_python-0.6.1-cp36-cp36m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 53.4 MB
  • Tags: CPython 3.6m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.9

File hashes

Hashes for roboticstoolbox_python-0.6.1-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 888e7d5517cccfc9fc5a5c4dfedb123df62781da4016edf0871d272882cddab3
MD5 6ead6b722d55b83ece89aa4c2bfa9b97
BLAKE2b-256 6f007fe29ed710abfec47a55749f69543c54ab7b24e4c2e4e092f2fd947b3b02

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for roboticstoolbox_python-0.6.1-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 08a7240e0b8af4b0dc4bc205fad87ac2fd2a0e27242033a557ece2e10e1e63de
MD5 08ebec1b1564018012815ddb4163b84c
BLAKE2b-256 30de6aefb46a7ac3ddf6d6e68812cdb41e1f154872c8db1c29c889f7dfb82f9a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: roboticstoolbox_python-0.6.1-cp36-cp36m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 53.3 MB
  • Tags: CPython 3.6m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.6.12

File hashes

Hashes for roboticstoolbox_python-0.6.1-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 79164b97f969b484d558e31bf9b0e3b82da0b57625b9dad6d84b9eee2fedb886
MD5 5461526115e14b92a76d52e8c42871f6
BLAKE2b-256 aeb69219c6cfd08ec2cf3bf4d0ef258fafa9a68fbd0f28c1a1d87254cc3a38cd

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