tesseract_robotics.tesseract_common

Introduction

tesseract_common contains functionality that is common to all tesseract modules. This includes general types, container templates, utility functions, and more. The Python wrappers contain additional functionality for using with Eigen Geometry, Boost Filesystem, Boost Uuid, console_bridge, and TinyXML2.

Eigen Geometry

Matrix and vector types for Eigen are automatically converted to NumPy arrays when returned from a function, and NumPy arrays are automatically converted to Eigen types when passed into a function. This works for matrices and vectors, but does not work well for the Eigen geometry types used by Tesseract. The following Eigen classes are available in tesseract_common:

  • Quaterniond - Represents a Quaternion in (w,x,y,z) format

  • AngleAxisd - Represents a rotation as an angle around an axis

  • Translation3d - Represents a translation in 3D space

  • Isometry3d - Represents a rotation and translation in 3D space. This is used by Tesseract to represent transforms and poses.

Resource Locators

Resource locators are used by Tesseract to locate resources such as meshes, urdfs, srdfs, etc. The tesseract_common.GeneralResourceLocator class is available to locate resources in Python. This class searches paths in the environmental variable TESSERACT_RESOURCE_PATH to find resources. Each package://<dir>/ will search for the subdirectory <dir> in each path in TESSERACT_RESOURCE_PATH.

Auto-configuration: When you import tesseract_robotics, the following environment variables are automatically set to point to bundled data (if not already set):

  • TESSERACT_RESOURCE_PATH - Path to bundled resources for package:// URL resolution

  • TESSERACT_SUPPORT_DIR - Path to bundled tesseract_support directory

  • TESSERACT_TASK_COMPOSER_CONFIG_FILE - Path to bundled task composer config

This means package://tesseract_support/urdf/... URLs work out of the box without manual configuration.

Boost Filesystem

boost::filesystem::path is used by Tesseract to represent file paths. Because of function overloads, it is not possible to use strings for filesystems. The FileSystem path class is used as a container for paths to allow the correct function overloads to be selected.

Boost Uuid

The boost::uuids::uuid is used by Tesseract to represent unique identifiers. The Uuid class is available to represent boost::uuids::uuid in Python.

The newRandomUuid function is available to generate a random Uuid in Python.

Console Bridge

The console_bridge package is used by Tesseract to provide logging functionality. Several functions are available to modify the logging level and to log messages:

The following module level functions are available to modify the logging behavior:

  • getLogLevel()

  • setLogLevel()

  • useOutputHandler()

  • noOutputHandler()

The following module level constants are available for setting the logging level:

  • CONSOLE_BRIDGE_LOG_NONE

  • CONSOLE_BRIDGE_LOG_ERROR

  • CONSOLE_BRIDGE_LOG_WARN

  • CONSOLE_BRIDGE_LOG_INFO

  • CONSOLE_BRIDGE_LOG_DEBUG

The useOutputHandler() function can be used with the OutputHandler class to capture logging messages in Python:

class MyOutputHandler(tesseract_common.OutputHandler):
    def __init__(self):
        super().__init__()

    def log(self, text, level, filename, line):
        # Do something with the logging message
        print(text)

output_handler = MyOutputHandler()
tesseract_common.useOutputHandler(output_handler)

# Always restore the original output handler when done to avoid segfaults on exit
tesseract_common.restorePreviousOutputHandler()

TinyXML2 Support

The tinyxml2 package is used to serialize and deserialize Tesseract types. The tinyxml2 wrappers are included in the tesseract_common package to allow for serialization and deserialization of Tesseract types in Python.

Classes

AllowedCollisionMatrix Class

AngleAxisd Class

AnyPoly Class

BytesResource Class

CollisionMarginData Class

FilesystemPath Class

GeneralResourceLocator Class

Isometry3d Class

JointState Class

JointStates Class

JointTrajectory Class

KinematicLimits Class

ManipulatorInfo Class

OutputHandler Class

PairHash Class

Quaterniond Class

Resource Class

ResourceLocator Class

SimpleLocatedResource Class

SimpleResourceLocatorFn Class

SimpleResourceLocatorFnBase Class

Timer Class

Translation3d Class

TypeErasureInterface Class

Uuid Class

VectorFilesystemPath Class

XMLAttribute Class

XMLComment Class

XMLConstHandle Class

XMLDeclaration Class

XMLDocument Class

XMLElement Class

XMLHandle Class

XMLNode Class

XMLPrinter Class

XMLText Class

XMLUnknown Class

XMLUtil Class

XMLVisitor Class

type_index Class

Functions

AnyPoly_as_double Function

AnyPoly_as_string Function

AnyPoly_is_double Function

AnyPoly_is_string Function

AnyPoly_wrap_double Function

AnyPoly_wrap_string Function

getLogLevel Function

isWithinLimits Function

log Function

makeOrderedLinkPair Function

newRandomUuid Function

noOutputHandler Function

restorePreviousOutputHandler Function

satisfiesLimits Function

setLogLevel Function

useOutputHandler Function

Constants

  • COLLAPSE_WHITESPACE

  • CONSOLE_BRIDGE_LOG_DEBUG

  • CONSOLE_BRIDGE_LOG_ERROR

  • CONSOLE_BRIDGE_LOG_INFO

  • CONSOLE_BRIDGE_LOG_NONE

  • CONSOLE_BRIDGE_LOG_WARN

  • CollisionMarginOverrideType_MODIFY

  • CollisionMarginOverrideType_MODIFY_PAIR_MARGIN

  • CollisionMarginOverrideType_NONE

  • CollisionMarginOverrideType_OVERRIDE_DEFAULT_MARGIN

  • CollisionMarginOverrideType_OVERRIDE_PAIR_MARGIN

  • CollisionMarginOverrideType_REPLACE

  • PEDANTIC_WHITESPACE

  • PRESERVE_WHITESPACE

  • TINYXML2_MAJOR_VERSION

  • TINYXML2_MAX_ELEMENT_DEPTH

  • TINYXML2_MINOR_VERSION

  • TINYXML2_PATCH_VERSION

  • TIXML2_MAJOR_VERSION

  • TIXML2_MINOR_VERSION

  • TIXML2_PATCH_VERSION

  • XML_CAN_NOT_CONVERT_TEXT

  • XML_ELEMENT_DEPTH_EXCEEDED

  • XML_ERROR_COUNT

  • XML_ERROR_EMPTY_DOCUMENT

  • XML_ERROR_FILE_COULD_NOT_BE_OPENED

  • XML_ERROR_FILE_NOT_FOUND

  • XML_ERROR_FILE_READ_ERROR

  • XML_ERROR_MISMATCHED_ELEMENT

  • XML_ERROR_PARSING

  • XML_ERROR_PARSING_ATTRIBUTE

  • XML_ERROR_PARSING_CDATA

  • XML_ERROR_PARSING_COMMENT

  • XML_ERROR_PARSING_DECLARATION

  • XML_ERROR_PARSING_ELEMENT

  • XML_ERROR_PARSING_TEXT

  • XML_ERROR_PARSING_UNKNOWN

  • XML_NO_ATTRIBUTE

  • XML_NO_TEXT_NODE

  • XML_SUCCESS

  • XML_WRONG_ATTRIBUTE_TYPE

Container Templates

  • AllowedCollisionEntries -> std::unordered_map<std::pair<std::string,std::string>, std::string, tesseract_common::PairHash>

  • Array2Double -> std::array<double,2>

  • Array2Int -> std::array<int,2>

  • Array2Isometry3d -> std::array<Eigen::Isometry3d,2>

  • Array2String -> std::array<std::string,2>

  • Array2Vector3d -> std::array<Eigen::Vector3d,2>

  • MapStringDouble -> std::unordered_map<std::string, double>

  • MapStringMapStringDouble -> std::unordered_map<std::string, std::unordered_map<std::string, double> >

  • MapStringMapStringMapStringDouble -> std::unordered_map<std::string, std::unordered_map<std::string, std::unordered_map<std::string, double> > >

  • MapStringMapStringString -> std::unordered_map<std::string, std::unordered_map<std::string, std::string> >

  • MapStringString -> std::unordered_map<std::string, std::string>

  • MapStringString2 -> std::map<std::string, std::string>

  • MapStringVectorDouble -> std::unordered_map<std::string, std::vector<double> >

  • MapStringVectorPairString -> std::unordered_map<std::string, std::vector<std::pair<std::string, std::string>>>

  • MapStringVectorString -> std::unordered_map<std::string, std::vector<std::string>>

  • PairString -> std::pair<std::string, std::string>

  • PairVectorString -> std::pair<std::vector<std::string>, std::vector<std::string>>

  • PluginInfoMap -> std::map<std::string, tesseract_common::PluginInfo>

  • SetString -> std::set<std::string>

  • VectorDouble -> std::vector<double>

  • VectorEigenIndex -> std::vector<Eigen::Index>

  • VectorPairString -> std::vector<std::pair<std::string, std::string> >

  • VectorSizet -> std::vector<std::size_t>

  • VectorString -> std::vector<std::string>

  • VectorUInt8 -> std::vector<uint8_t>

  • VectorUuid -> std::vector<boost::uuids::uuid>

  • VectorVector3d -> std::vector<Eigen::Vector3d>

  • VectorVectorXd -> std::vector<Eigen::VectorXd>

  • TransformMap -> tesseract_common::AlignedMap< std::string, Eigen::Isometry3d>

  • VectorIsometry3d -> tesseract_common::AlignedVector< Eigen::Isometry3d>

  • VectorVector2d -> tesseract_common::AlignedVector< Eigen::Vector2d>

  • VectorVector4d -> tesseract_common::AlignedVector< Eigen::Vector4d>