Skip to main content

Tesseract Python Library

Project description

Tesseract Python

Python

PyPI

Platform CI Status
Linux (Focal) Build Status
Windows Build Status
Wheels Build Status

Github Issues

license - apache 2.0 license - bsd 2 clause

support level: consortium

tesseract_python contains Python wrappers for the Tesseract robot motion planner, generated using SWIG. These wrappers contain most of the Tesseract functionality, including scene loading and management (URDF,SRDF, meshes), collision checking (Bullet, FCL), kinematics (KDL, OPW, UR), planning (OMPL, Descartes, TrajOpt), and visualization (tesseract_viewer_python)

Standalone packages are provided on PyPi (pip install) for Windows and Linux, containing all the native dependencies for Python 3.7+.

The Tesseract Python package is developed and maintained by Wason Technology, LLC.

Note that these are low level wrappers. The lifecycle of objects follow the underlying C++ objects, meaning that the target of C++ references may be destroyed before the reference, leading to a memory error. These wrappers do not attempt to change the memory lifecycle of the underlying C++ objects.

Documentation

See https://tesseract-robotics.github.io/tesseract_python/ for documentation.

Installation

Standalone packages are provided on PyPi (pip install) for Windows and Linux, containing Tesseract, Tesseract Planning, andall the native dependencies for Python 3.7+. These packages have been tested on Windows 10, Ubuntu 20.04, and Ubuntu 22.04, but should work on any relatively recent x64 Windows or Linux operating system. Packages are available for Python 3.7 - 3.11.

To install on Windows:

python -m pip install tesseract-robotics tesseract-robotics-viewer

To install on Ubuntu 20.04 and Ubuntu 22.04:

sudo apt install python3-pip python3-numpy
# The supplied version of pip on Ubuntu 20.04 is too old for manylinux_2_31, upgrade pip
python3 -m pip install -U pip
python3 -m pip install --user  tesseract_robotics tesseract_robotics_viewer

Example

ABB Tesseract viewer plan and viewer example:

Install tesseract_robotics and tesseract_robotics_viewer as shown in Installation section.

Clone tesseract, tesseract_planning, and tesseract_python repositories to retrieve example assets. This is not necessary if the example assets are not used.

git clone --depth=1 https://github.com/tesseract-robotics/tesseract.git
git clone --depth=1 https://github.com/tesseract-robotics/tesseract_planning.git
git clone --depth=1 https://github.com/tesseract-robotics/tesseract_python.git

Set the TESSERACT_RESOURCE_PATH and TESSERACT_TASK_COMPOSER_CONFIG_FILE environmental variables so the example can find required resources:

Linux:

export TESSERACT_RESOURCE_PATH=`pwd`/tesseract
export TESSERACT_TASK_COMPOSER_CONFIG_FILE=`pwd`/tesseract_planning/tesseract_task_composer/config/task_composer_plugins_no_trajopt_ifopt.yaml

Windows:

set TESSERACT_RESOURCE_PATH=%CD%/tesseract
set TESSERACT_TASK_COMPOSER_CONFIG_FILE=%CD%/tesseract_planning/tesseract_task_composer/config/task_composer_plugins_no_trajopt_ifopt.yaml

Now run the example!

Windows:

cd tesseract_python\examples
python tesseract_planning_example_composer.py

Linux:

cd tesseract_python/examples
python3 tesseract_planning_example_composer.py

And point a modern browser to http://localhost:8000 to see the animation!

Example source:

import re
import traceback
import os
import numpy as np
import numpy.testing as nptest

from tesseract_robotics.tesseract_common import GeneralResourceLocator
from tesseract_robotics.tesseract_environment import Environment
from tesseract_robotics.tesseract_common import FilesystemPath, Isometry3d, Translation3d, Quaterniond, \
    ManipulatorInfo, AnyPoly, AnyPoly_wrap_double
from tesseract_robotics.tesseract_command_language import CartesianWaypoint, WaypointPoly, \
    MoveInstructionType_FREESPACE, MoveInstruction, InstructionPoly, StateWaypoint, StateWaypointPoly, \
    CompositeInstruction, MoveInstructionPoly, CartesianWaypointPoly, ProfileDictionary, \
        AnyPoly_as_CompositeInstruction, CompositeInstructionOrder_ORDERED, DEFAULT_PROFILE_KEY, \
        AnyPoly_wrap_CompositeInstruction, DEFAULT_PROFILE_KEY, JointWaypoint, JointWaypointPoly, \
        InstructionPoly_as_MoveInstructionPoly, WaypointPoly_as_StateWaypointPoly, \
        MoveInstructionPoly_wrap_MoveInstruction, StateWaypointPoly_wrap_StateWaypoint, \
        CartesianWaypointPoly_wrap_CartesianWaypoint, JointWaypointPoly_wrap_JointWaypoint

from tesseract_robotics.tesseract_task_composer import TaskComposerPluginFactory, PlanningTaskComposerProblem, \
    TaskComposerDataStorage, TaskComposerContext

from tesseract_robotics_viewer import TesseractViewer

# Run example FreespacePipeline planner

OMPL_DEFAULT_NAMESPACE = "OMPLMotionPlannerTask"
TRAJOPT_DEFAULT_NAMESPACE = "TrajOptMotionPlannerTask"

task_composer_filename = os.environ["TESSERACT_TASK_COMPOSER_CONFIG_FILE"]

# Initialize the resource locator and environment
locator = GeneralResourceLocator()
abb_irb2400_urdf_package_url = "package://tesseract_support/urdf/abb_irb2400.urdf"
abb_irb2400_srdf_package_url = "package://tesseract_support/urdf/abb_irb2400.srdf"
abb_irb2400_urdf_fname = FilesystemPath(locator.locateResource(abb_irb2400_urdf_package_url).getFilePath())
abb_irb2400_srdf_fname = FilesystemPath(locator.locateResource(abb_irb2400_srdf_package_url).getFilePath())

t_env = Environment()

# locator_fn must be kept alive by maintaining a reference
assert t_env.init(abb_irb2400_urdf_fname, abb_irb2400_srdf_fname, locator)

# Fill in the manipulator information. This is used to find the kinematic chain for the manipulator. This must
# match the SRDF, although the exact tcp_frame can differ if a tool is used.
manip_info = ManipulatorInfo()
manip_info.tcp_frame = "tool0"
manip_info.manipulator = "manipulator"
manip_info.working_frame = "base_link"

# Create a viewer and set the environment so the results can be displayed later
viewer = TesseractViewer()
viewer.update_environment(t_env, [0,0,0])

# Set the initial state of the robot
joint_names = ["joint_%d" % (i+1) for i in range(6)]
viewer.update_joint_positions(joint_names, np.array([1,-.2,.01,.3,-.5,1]))

# Start the viewer
viewer.start_serve_background()

# Set the initial state of the robot
t_env.setState(joint_names, np.ones(6)*0.1)

# Create the input command program waypoints
wp1 = CartesianWaypoint(Isometry3d.Identity() * Translation3d(0.8,-0.3,1.455) * Quaterniond(0.70710678,0,0.70710678,0))
wp2 = CartesianWaypoint(Isometry3d.Identity() * Translation3d(0.8,0.3,1.455) * Quaterniond(0.70710678,0,0.70710678,0))
wp3 = CartesianWaypoint(Isometry3d.Identity() * Translation3d(0.8,0.5,1.455) * Quaterniond(0.70710678,0,0.70710678,0))

# Create the input command program instructions. Note the use of explicit construction of the CartesianWaypointPoly
# using the *_wrap_CartesianWaypoint functions. This is required because the Python bindings do not support implicit
# conversion from the CartesianWaypoint to the CartesianWaypointPoly.
start_instruction = MoveInstruction(CartesianWaypointPoly_wrap_CartesianWaypoint(wp1), MoveInstructionType_FREESPACE, "DEFAULT")
plan_f1 = MoveInstruction(CartesianWaypointPoly_wrap_CartesianWaypoint(wp2), MoveInstructionType_FREESPACE, "DEFAULT")
plan_f2 = MoveInstruction(CartesianWaypointPoly_wrap_CartesianWaypoint(wp3), MoveInstructionType_FREESPACE, "DEFAULT")

# Create the input command program. Note the use of *_wrap_MoveInstruction functions. This is required because the
# Python bindings do not support implicit conversion from the MoveInstruction to the MoveInstructionPoly.
program = CompositeInstruction("DEFAULT")
program.setManipulatorInfo(manip_info)
program.appendMoveInstruction(MoveInstructionPoly_wrap_MoveInstruction(start_instruction))
program.appendMoveInstruction(MoveInstructionPoly_wrap_MoveInstruction(plan_f1))
# program.appendMoveInstruction(MoveInstructionPoly(plan_f2))

# Create the task composer plugin factory and load the plugins
config_path = FilesystemPath(task_composer_filename)
factory = TaskComposerPluginFactory(config_path)

# Create the task composer node. In this case the FreespacePipeline is used. Many other are available.
task = factory.createTaskComposerNode("FreespacePipeline")

# Get the output keys for the task
output_key = task.getOutputKeys()[0]

# Create a profile dictionary. Profiles can be customized by adding to this dictionary and setting the profiles
# in the instructions.
profiles = ProfileDictionary()

# Create an AnyPoly containing the program. This explicit step is required because the Python bindings do not
# support implicit conversion from the CompositeInstruction to the AnyPoly.
program_anypoly = AnyPoly_wrap_CompositeInstruction(program)

# Create the task problem and input
task_planning_problem = PlanningTaskComposerProblem(t_env, profiles)
task_planning_problem.input = program_anypoly

# Create an executor to run the task
task_executor = factory.createTaskComposerExecutor("TaskflowExecutor")

# Run the task and wait for completion
future = task_executor.run(task.get(), task_planning_problem)
future.wait()

# Retrieve the output, converting the AnyPoly back to a CompositeInstruction
results = AnyPoly_as_CompositeInstruction(future.context.data_storage.getData(output_key))

# Display the output
# Print out the resulting waypoints
for instr in results:
    assert instr.isMoveInstruction()
    move_instr1 = InstructionPoly_as_MoveInstructionPoly(instr)
    wp1 = move_instr1.getWaypoint()
    assert wp1.isStateWaypoint()
    wp = WaypointPoly_as_StateWaypointPoly(wp1)
    print(f"Joint Positions: {wp.getPosition().flatten()} time: {wp.getTime()}")

# Update the viewer with the results to animate the trajectory
# Open web browser to http://localhost:8000 to view the results
viewer.update_trajectory(results)
viewer.plot_trajectory(results, manip_info)

input("press enter to exit")

Tesseract Python Supported Packages

  • tesseract_collision – This package contains privides a common interface for collision checking prividing several implementation of a Bullet collision library and FCL collision library. It includes both continuous and discrete collision checking for convex-convex, convex-concave and concave-concave shapes.
  • tesseract_common – This package contains common functionality needed by the majority of the packages.
  • tesseract_environment – This package contains the Tesseract Environment which provides functionality to add,remove,move and modify links and joint. It also manages adding object to the contact managers and provides the ability.
  • tesseract_geometry – This package contains geometry types used by Tesseract including primitive shapes, mesh, convex hull mesh, octomap and signed distance field.
  • tesseract_kinematics – This package contains a common interface for Forward and Inverse kinematics for Chain, Tree's and Graphs including implementation using KDL and OPW Kinematics.
  • tesseract_scene_graph – This package contains the scene graph which is the data structure used to manage the connectivity of objects in the environment. It inherits from boost graph and provides addition functionality for adding,removing and modifying Links and Joints along with search implementation.
  • tesseract_support – This package contains support data used for unit tests and examples throughout Tesseract.
  • tesseract_urdf - This package contains a custom urdf parser supporting addition shapes and features currently not supported by urdfdom.
  • tesseract_visualization – This package contains visualization utilities and libraries.
  • tesseract_command_language - This is a generic programing language used as input for motion and process planning. It is very similar to how you currently program a robot on an industrial teach pendant.
  • tesseract_motion_planners – This package contains a common interface for Planners and includes implementation for OMPL, TrajOpt, TrajOpt IFOPT and Descartes.
  • tesseract_task_composer – This package contains a common interface for task pipelines and includes implementation for a wide variaty of process found industrial automation like painting, griding, welding, pick and place and more.
  • tesseract_time_parameterization – This package contains a time parameterization algorithms and includes iterative spline.

Related Repositories

Documentation

Build Instructions

Building the tesseract_python package is complicated and not recommended for novice users. See the wheels.yml workflow for details on how to build the packages and all dependencies.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

tesseract_robotics-0.4.0-cp312-cp312-win_amd64.whl (20.1 MB view details)

Uploaded CPython 3.12 Windows x86-64

tesseract_robotics-0.4.0-cp312-cp312-manylinux_2_31_x86_64.whl (36.0 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.31+ x86-64

tesseract_robotics-0.4.0-cp312-cp312-macosx_12_0_universal2.whl (24.0 MB view details)

Uploaded CPython 3.12 macOS 12.0+ universal2 (ARM64, x86-64)

tesseract_robotics-0.4.0-cp312-cp312-macosx_12_0_arm64.whl (44.7 MB view details)

Uploaded CPython 3.12 macOS 12.0+ ARM64

tesseract_robotics-0.4.0-cp311-cp311-win_amd64.whl (20.1 MB view details)

Uploaded CPython 3.11 Windows x86-64

tesseract_robotics-0.4.0-cp311-cp311-manylinux_2_31_x86_64.whl (36.0 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.31+ x86-64

tesseract_robotics-0.4.0-cp310-cp310-win_amd64.whl (20.1 MB view details)

Uploaded CPython 3.10 Windows x86-64

tesseract_robotics-0.4.0-cp310-cp310-manylinux_2_31_x86_64.whl (36.0 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.31+ x86-64

tesseract_robotics-0.4.0-cp39-cp39-win_amd64.whl (20.1 MB view details)

Uploaded CPython 3.9 Windows x86-64

tesseract_robotics-0.4.0-cp39-cp39-manylinux_2_31_x86_64.whl (36.0 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.31+ x86-64

tesseract_robotics-0.4.0-cp38-cp38-win_amd64.whl (20.1 MB view details)

Uploaded CPython 3.8 Windows x86-64

tesseract_robotics-0.4.0-cp38-cp38-manylinux_2_31_x86_64.whl (36.0 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.31+ x86-64

tesseract_robotics-0.4.0-cp37-cp37m-win_amd64.whl (20.1 MB view details)

Uploaded CPython 3.7m Windows x86-64

tesseract_robotics-0.4.0-cp37-cp37m-manylinux_2_31_x86_64.whl (36.0 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.31+ x86-64

File details

Details for the file tesseract_robotics-0.4.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for tesseract_robotics-0.4.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 392c764bc19d2cb8a4c039d06392ca2997381c94440fd8f896ddc89b04560d9f
MD5 9c29aacf8bed5abfd1215bc4c82c9a83
BLAKE2b-256 7a431ca5da5d5c86917abaa46e77429b1dedacae0065a76816dd43133439ff29

See more details on using hashes here.

File details

Details for the file tesseract_robotics-0.4.0-cp312-cp312-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for tesseract_robotics-0.4.0-cp312-cp312-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 cd7a7f356b55f845c98d336a251aa341b142f6d9029f4d34ecf1ca8dc4b47d2e
MD5 45a38346766a93d886ce8c31d645e3c3
BLAKE2b-256 fba560121d9bd23178f2ffc093526707a1cc01f88f3f7565cc6c4aff46a06966

See more details on using hashes here.

File details

Details for the file tesseract_robotics-0.4.0-cp312-cp312-macosx_12_0_universal2.whl.

File metadata

File hashes

Hashes for tesseract_robotics-0.4.0-cp312-cp312-macosx_12_0_universal2.whl
Algorithm Hash digest
SHA256 352caa3fbe670f0a4a63ee3cd2110182025a6cb50935cf66ed537e5479cd5f48
MD5 aa144c6818b69d5d18d2cb68ca1c4bce
BLAKE2b-256 e9458dbf5107ea1f684a20a42192db4a1c1ed39d911595dd8cd14ae21bedcd41

See more details on using hashes here.

File details

Details for the file tesseract_robotics-0.4.0-cp312-cp312-macosx_12_0_arm64.whl.

File metadata

  • Download URL: tesseract_robotics-0.4.0-cp312-cp312-macosx_12_0_arm64.whl
  • Upload date:
  • Size: 44.7 MB
  • Tags: CPython 3.12, macOS 12.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10

File hashes

Hashes for tesseract_robotics-0.4.0-cp312-cp312-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 78db5c22276d5fb0bc68e5af6b9ccbe056f04a4b4a92acfe2e677777890b1a61
MD5 9184d73a11510c6dca720b03def3df77
BLAKE2b-256 85588aabb7a51a92dd58940cd0b7816be4618e025c77c3eca8142a83cebf8e1c

See more details on using hashes here.

File details

Details for the file tesseract_robotics-0.4.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for tesseract_robotics-0.4.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 21ca9e0140793647d5d59687a6d4179b6532f26062e270f31076cb8a3a8eb97b
MD5 a205d78a70e5486c9b6fcfbc01c3ca02
BLAKE2b-256 7bbb45a61ea5e58aedd2d955fe9bc83c1b21320d6ccb470cd10d871d27f1636d

See more details on using hashes here.

File details

Details for the file tesseract_robotics-0.4.0-cp311-cp311-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for tesseract_robotics-0.4.0-cp311-cp311-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 40908159ae4fb42e2b046a3d02835f97568731ac2ce5513a09bf96baaeb6217e
MD5 4a69da5ea110b194c3322a3b8ed2d889
BLAKE2b-256 b272787b143da17a9fa5fb5f123b0a8075ab274872c377034dbbccbdedfdbddd

See more details on using hashes here.

File details

Details for the file tesseract_robotics-0.4.0-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for tesseract_robotics-0.4.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 8a08675d8f6ebe2d6ce37ece0909f2abbf10dde3039b8dce912a982f31665bb3
MD5 dd41c3127fd0bd0ada41813a0000d8e1
BLAKE2b-256 1a78e6923716504b264486f45b6ad3f3cd19488cbcb20d7002a46fc2aefa3b8d

See more details on using hashes here.

File details

Details for the file tesseract_robotics-0.4.0-cp310-cp310-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for tesseract_robotics-0.4.0-cp310-cp310-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 10eee4fab00927011ae2e5ade35a23012fab0556b8958eb2ec1bd99b018fd6b1
MD5 3d625269a8faf12822faf0a13f1c0ff6
BLAKE2b-256 7eb4602720e1279e1bf744604fe143d292c4e2e52f867114ce4a98262c9980db

See more details on using hashes here.

File details

Details for the file tesseract_robotics-0.4.0-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for tesseract_robotics-0.4.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 7b971aa5bbd73234d013997098c742e8958e6691b4fb11024da296f60b6bf5d8
MD5 c1b4c8510811308e246daa925117b01f
BLAKE2b-256 5e4eb65fc747622559c1dcb25b7a12059a3348351bcc5564f17cf86b97313c29

See more details on using hashes here.

File details

Details for the file tesseract_robotics-0.4.0-cp39-cp39-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for tesseract_robotics-0.4.0-cp39-cp39-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 6d9177ba2e4f1f8ac28b3f8f75f3198424e26b26ba1a764bc5234ee138182698
MD5 1b31611a32bff890506eb65d58aa6542
BLAKE2b-256 18214c3336d08ae0949abef660b8cac710530303e52b5f5533c9eacb4791753c

See more details on using hashes here.

File details

Details for the file tesseract_robotics-0.4.0-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for tesseract_robotics-0.4.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 58966d72c0f74a9405ba06eea1892be804be4afda755449f10dbdde0788e82f9
MD5 f17dc0f72f1ea2bae9faa00d95f25d1c
BLAKE2b-256 58eb66a77daf5ef9b53a6efb095dba977fac79047e8cf4de166eb6d46aca7889

See more details on using hashes here.

File details

Details for the file tesseract_robotics-0.4.0-cp38-cp38-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for tesseract_robotics-0.4.0-cp38-cp38-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 be1d98bd296a8d857fa30d19a8434b10ab952748d69c450bccdab3807a821a7d
MD5 e339de2828afaec9861698842d7b42ba
BLAKE2b-256 eac0aab4fee64ef92fe06a33b97a3c2971d6fc999b8e82ee7e9f582c94876344

See more details on using hashes here.

File details

Details for the file tesseract_robotics-0.4.0-cp37-cp37m-win_amd64.whl.

File metadata

File hashes

Hashes for tesseract_robotics-0.4.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 4652b40a9d73bfc967e124651ccc384e9787b6335990394b6533dea5df8d3410
MD5 9a8847d691291b8cd20e3c28740caa5c
BLAKE2b-256 36551654d206dd79f0176b4e9e62ba35e9e89c79a49fb13e768027d966c19a06

See more details on using hashes here.

File details

Details for the file tesseract_robotics-0.4.0-cp37-cp37m-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for tesseract_robotics-0.4.0-cp37-cp37m-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 3e1f822dd778ec153da0df147f3ee8d1d7b661628c35997f8b17c358336d2449
MD5 1a43b93b69d90f32ddb020ff80635b21
BLAKE2b-256 fea8b241fc11dcd48750c0bd21754a241cc2cb2cd37e8590b42247ef9f34292d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page