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) formatAngleAxisd
- Represents a rotation as an angle around an axisTranslation3d
- Represents a translation in 3D spaceIsometry3d
- 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
.
It is also possible to create a custom resource locator. See the TesseractSupportResourceLocator
in the
unit tests for an example of a custom resource locator.
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¶
- class tesseract_robotics.tesseract_common.AllowedCollisionMatrix(*args)
- addAllowedCollision(link_name1, link_name2, reason)
Disable collision between two collision objects
- Parameters:
obj1 – Collision object name
obj2 – Collision object name
reason (string) – The reason for disabling collison
- clearAllowedCollisions()
- Clears the list of allowed collisions, so that no collision will be
allowed.
- getAllAllowedCollisions()
Get all of the entries in the allowed collision matrix
- Return type:
AllowedCollisionEntries
- Returns:
AllowedCollisionEntries an unordered map containing all allowed collision entries. The keys of the unordered map are a std::pair of the link names in the allowed collision pair.
- insertAllowedCollisionMatrix(acm)
Inserts an allowable collision matrix ignoring duplicate pairs
- Parameters:
acm (
AllowedCollisionMatrix
) – ACM to be inserted
- isCollisionAllowed(link_name1, link_name2)
This checks if two links are allowed to be in collision
- Parameters:
link_name1 (string) – First link name
link_name2 (string) – Second link anme
- Return type:
boolean
- Returns:
True if allowed to be in collision, otherwise false
- removeAllowedCollision(*args)
Overload 1:
Remove disabled collision pair from allowed collision matrix
- Parameters:
obj1 – Collision object name
obj2 – Collision object name
Overload 2:
Remove disabled collision for any pair with link_name from allowed collision matrix
- Parameters:
link_name (string) – Collision object name
AngleAxisd Class¶
- class tesseract_robotics.tesseract_common.AngleAxisd(*args)
Eigen::AngleAxisd bindings
This class is a wrapper around Eigen::AngleAxisd
- angle()
Get the angle of this AngleAxisd
- Return type:
float
- Returns:
Angle
- axis()
Get the axis of this AngleAxisd
- Return type:
Eigen::Vector3d
- Returns:
Axis
- fromRotationMatrix(mat)
Set from a rotation matrix
- Parameters:
mat (Eigen::Matrix3d) – Rotation matrix
- Return type:
AngleAxisd
- Returns:
AngleAxisd
- inverse()
Get the inverse of this AngleAxisd
- Return type:
AngleAxisd
- Returns:
Inverse
- isApprox(*args)
Overload 1:
Check if this AngleAxisd is approximately equal to another AngleAxisd
- Parameters:
other (
AngleAxisd
) – Other AngleAxisd- Return type:
boolean
- Returns:
True if approximately equal, false otherwise
Overload 2:
Check if this AngleAxisd is approximately equal to another AngleAxisd
- Parameters:
other (
AngleAxisd
) – Other AngleAxisdprec (float) – Precision
- Return type:
boolean
- Returns:
True if approximately equal, false otherwise
- setAngle(angle)
Set the angle of this AngleAxisd
- Parameters:
angle (float) – Angle
- setAxis(axis)
Set the axis of this AngleAxisd
- Parameters:
axis (Eigen::Vector3d) – Axis
- toRotationMatrix()
Get the 3x3 rotation matrix of this AngleAxisd
- Return type:
Eigen::Matrix3d
- Returns:
Rotation matrix
AnyPoly Class¶
- class tesseract_robotics.tesseract_common.AnyPoly
BytesResource Class¶
- class tesseract_robotics.tesseract_common.BytesResource(*args)
- getFilePath()
Get the file path of the resource. Only valid if isFile() is true.
- Return type:
string
- Returns:
The file path to the resource
- getResourceContentStream()
Get the resource as a std::istream. This function and the returned stream may block
- Return type:
std::shared_ptr< std::istream >
- Returns:
A std::istream shared pointer for the resource data
- getResourceContents()
Get the resource as bytes. This function may block
- Return type:
std::vector< uint8_t,std::allocator< uint8_t > >
- Returns:
Resource bytes as a uint8_t vector
- getUrl()
Get the original URL used to locate the file
- Return type:
string
- Returns:
The URL of the resource
- isFile()
Returns true if the located resource is a local file
- Return type:
boolean
- Returns:
true if the resource is a local file, otherwise false
- locateResource(url)
Locate a resource based on a URL
- Parameters:
url (string) – The URL of the resource
- Return type:
Resource
- Returns:
A shared pointer to a Resource instance, or nullptr if not found
CalibrationInfo Class¶
- class tesseract_robotics.tesseract_common.CalibrationInfo
The CalibrationInfo struct
- clear()
Clear the contents
- empty()
Check if structure is empty
- insert(other)
Insert the content of an other CalibrationInfo
- property joints
The joint origin calibration information For each entry in
joints
the environment will apply a ChangeJointOriginCommand replacing the currentjoint origin with what is stored in the TransformMap
CollisionMarginData Class¶
- class tesseract_robotics.tesseract_common.CollisionMarginData(*args)
Stores information about how the margins allowed between collision objects
- apply(collision_margin_data, override_type)
Apply the contents of the provide CollisionMarginData based on the override type
- Parameters:
collision_margin_data (
CollisionMarginData
) – The collision margin data to applyoverride_type (int) – The type indicating how the provided data should be applied.
- getDefaultCollisionMargin()
Get the default collision margin
- Return type:
float
- Returns:
default collision margin
- getMaxCollisionMargin()
Get the largest collision margin
This used when setting the contact distance in the contact manager.
- Return type:
float
- Returns:
Max contact distance threshold
- getPairCollisionMargin(obj1, obj2)
Get the pairs collision margin data
If a collision margin for the request pair does not exist it returns the default collision margin data.
- Parameters:
obj1 (string) – The first object name
obj2 (string) – The second object name
- Return type:
float
- Returns:
A Vector2d[Contact Distance Threshold, Coefficient]
- getPairCollisionMargins()
Get Collision Margin Data for stored pairs
- Return type:
tesseract_common::PairsCollisionMarginData
- Returns:
A map of link pairs collision margin data
- incrementMargins(increment)
Increment all margins by input amount. Useful for inflating or reducing margins
- Parameters:
increment (float) – Amount to increment margins
- scaleMargins(scale)
Scale all margins by input value
- Parameters:
scale (float) – Value by which all margins are multiplied
- setDefaultCollisionMargin(default_collision_margin)
Set the default collision margin
- Parameters:
default_collision_margin (float) – New default collision margin
- setPairCollisionMargin(obj1, obj2, collision_margin)
Set the margin for a given contact pair
The order of the object names does not matter, that is handled internal to the class.
- Parameters:
obj1 (string) – The first object name. Order doesn’t matter
obj2 (string) – The Second object name. Order doesn’t matter
collision_margin (float) – contacts with distance < collision_margin are considered in collision
ContactManagersPluginInfo Class¶
- class tesseract_robotics.tesseract_common.ContactManagersPluginInfo
The contact managers plugin information structure
- clear()
Clear the contents
- property continuous_plugin_infos
A map of name to continuous contact manager plugin information
- property discrete_plugin_infos
A map of name to discrete contact manager plugin information
- empty()
Check if structure is empty
- insert(other)
Insert the content of an other ContactManagersPluginInfo
- property search_libraries
A list of library names without the prefix or suffix that contain plugins
- property search_paths
A list of paths to search for plugins
FilesystemPath Class¶
- class tesseract_robotics.tesseract_common.FilesystemPath(s)
Wrapper for boost::filesystem::path
- string()
Return the path as a string
- Return type:
string
- Returns:
The path as a string
GeneralResourceLocator Class¶
- class tesseract_robotics.tesseract_common.GeneralResourceLocator(*args)
A general resource loaders using environment variable Also can set this environment variable TESSERACT_RESOURCE_PATH with ‘:’ separated directories and then use the directires as package names
- locateResource(url)
Locate a resource based on a URL
- Parameters:
url (string) – The URL of the resource
- Return type:
Resource
- Returns:
A shared pointer to a Resource instance, or nullptr if not found
Isometry3d Class¶
- class tesseract_robotics.tesseract_common.Isometry3d(*args)
Eigen::Isometry3d bindings, used for Transforms in Tesseract
This class is a wrapper around Eigen::Isometry3d
- static Identity()
Get the identity Isometry3d
- Return type:
Isometry3d
- Returns:
Identity Isometry3d
- inverse()
Get the inverse of this Isometry3d
- Return type:
Isometry3d
- Returns:
Inverse of this Isometry3d
- isApprox(*args)
Overload 1:
Check if this Isometry3d is approximately equal to another Isometry3d
- Parameters:
other (
Isometry3d
) – Other Isometry3d- Return type:
boolean
- Returns:
True if approximately equal, false otherwise
Overload 2:
Check if this Isometry3d is approximately equal to another Isometry3d
- Parameters:
other (
Isometry3d
) – Other Isometry3dprec (float) – Precision
- Return type:
boolean
- Returns:
True if approximately equal, false otherwise
- linear()
Get the linear matrix of this Isometry3d
- Return type:
Eigen::Matrix3d
- Returns:
Linear matrix of this Isometry3d
- matrix()
Get the 4x4 holonomic matrix of this Isometry3d
- Return type:
Eigen::Matrix4d
- Returns:
4x4 holonomic matrix of this Isometry3d
- prerotate(*args)
Overload 1:
Pre-rotate this Isometry3d by a Matrix3d
- Parameters:
rotation (Eigen::Matrix3d) – Matrix3d
Overload 2:
Pre-rotate this Isometry3d by an AngleAxisd
- Parameters:
rotation (
AngleAxisd
) – AngleAxisd
Overload 3:
Pre-rotate this Isometry3d by a Quaterniond
- Parameters:
rotation (
Quaterniond
) – Quaterniond
- pretranslate(vec)
Pre-translate this Isometry3d by a Vector3d
- Parameters:
vec (Eigen::Vector3d) – Vector3d
- rotate(*args)
Overload 1:
Rotate this Isometry3d by a Matrix3d
- Parameters:
rotation (Eigen::Matrix3d) – Matrix3d
Overload 2:
Rotate this Isometry3d by an AngleAxisd
- Parameters:
rotation (
AngleAxisd
) – AngleAxisd
Overload 3:
Rotate this Isometry3d by a Quaterniond
- Parameters:
rotation (
Quaterniond
) – Quaterniond
- rotation()
Get the rotation matrix of this Isometry3d
- Return type:
Eigen::Matrix3d
- Returns:
Rotation matrix of this Isometry3d
- setIdentity()
Set this Isometry3d to the identity
- setLinear(linear)
Set the linear matrix of this Isometry3d
- Parameters:
linear (Eigen::Matrix3d) – Linear matrix
- setMatrix(matrix)
Set the 4x4 holonomic matrix of this Isometry3d
- Parameters:
matrix (Eigen::Matrix4d) – 4x4 holonomic matrix
- setTranslation(translation)
Set the translation vector of this Isometry3d
- Parameters:
translation (Eigen::Vector3d) – Translation vector
- translate(vec)
Translate this Isometry3d by a Vector3d
- Parameters:
vec (Eigen::Vector3d) – Vector3d
- translation()
Get the translation vector of this Isometry3d
- Return type:
Eigen::Vector3d
- Returns:
Translation vector of this Isometry3d
JointState Class¶
- class tesseract_robotics.tesseract_common.JointState(*args)
- property acceleration
The Acceleration at the waypoint (optional)
- property effort
The Effort at the waypoint (optional)
- property joint_names
The joint corresponding to the position vector.
- property position
The joint position at the waypoint
- property time
The Time from start at the waypoint (optional)
- property velocity
The velocity at the waypoint (optional)
JointStates Class¶
- class tesseract_robotics.tesseract_common.JointStates(*args)
JointTrajectory Class¶
- class tesseract_robotics.tesseract_common.JointTrajectory(*args)
Represents a joint trajectory
KinematicLimits Class¶
- class tesseract_robotics.tesseract_common.KinematicLimits
Store kinematic limits
- property acceleration_limits
The acceleration limits
- property joint_limits
The position limits
- property velocity_limits
The velocity limits
KinematicsPluginInfo Class¶
- class tesseract_robotics.tesseract_common.KinematicsPluginInfo
The kinematics plugin information structure
- clear()
Clear the contents
- empty()
Check if structure is empty
- property fwd_plugin_infos
A map of group name to forward kinematics plugin information
- insert(other)
Insert the content of an other KinematicsPluginInfo
- property inv_plugin_infos
A map of group name to inverse kinematics plugin information
- property search_libraries
A list of library names without the prefix or suffix that contain plugins
- property search_paths
A list of paths to search for plugins
ManipulatorInfo Class¶
- class tesseract_robotics.tesseract_common.ManipulatorInfo(*args)
Contains information about a robot manipulator
- empty()
Check if any data is current being stored
- Return type:
boolean
- Returns:
True if empty otherwise false
- getCombined(manip_info_override)
If the provided manipulator information member is not empty it will override this and return a new manipulator information with the combined results
- Parameters:
manip_info_override (
ManipulatorInfo
) – The manipulator information to check for overrides- Return type:
ManipulatorInfo
- Returns:
The combined manipulator information
- property manipulator
Name of the manipulator group
- property manipulator_ik_solver
(Optional) IK Solver to be used
- property tcp_frame
The coordinate frame within to the environment to use as the reference frame for the tool center point (TCP) which is defined by an offset transform relative to this frame
- property working_frame
The working frame to which waypoints are relative. If the tcp_frame is external to manipulator then the working frame must be an active frame on the manipulator
OutputHandler Class¶
- class tesseract_robotics.tesseract_common.OutputHandler
- log(text, level, filename, line)
log a message to the output handler with the given text and logging level from a specific file and line number
- Parameters:
text (string) – to log
level (int) – console_bridge log level
filename (string) – of the output log
line (int) –
PairHash Class¶
- class tesseract_robotics.tesseract_common.PairHash
PluginInfo Class¶
- class tesseract_robotics.tesseract_common.PluginInfo
The Plugin Information struct
- property class_name
The plugin class name
- property config
The plugin config data
- getConfigString()
Get the yaml config as a string
PluginInfoContainer Class¶
- class tesseract_robotics.tesseract_common.PluginInfoContainer
Quaterniond Class¶
- class tesseract_robotics.tesseract_common.Quaterniond(*args)
Eigen::Quaterniond wrapper
This class is a wrapper around Eigen::Quaterniond that provides additional functionality and easier bindings
- static UnitRandom()
Create random quaternion
- angularDistance(other)
Get the angular distance between this and another quaternions
- Parameters:
other (
Quaterniond
) – Other quaternion- Return type:
float
- Returns:
Angular distance in radians
- conjugate()
Get the conjugate of this quaternion
- Return type:
Quaterniond
- Returns:
Conjugate of this quaternion
- dot(other)
Get the dot product of this and another quaternion
- Parameters:
other (
Quaterniond
) – Other quaternion- Return type:
float
- Returns:
Dot product
- inverse()
Get the inverse of this quaternion
- Return type:
Quaterniond
- Returns:
Inverse of this quaternion
- isApprox(*args)
Overload 1:
Check if this quaternion is approximately equal to another
- Parameters:
other (
Quaterniond
) – Other quaternion- Return type:
boolean
- Returns:
True if approximately equal
Overload 2:
Check if this quaternion is approximately equal to another
- Parameters:
other (
Quaterniond
) – Other quaternionprec (float) – Precision
- Return type:
boolean
- Returns:
True if approximately equal
- norm()
Get the norm of this quaternion
- Return type:
float
- Returns:
Norm
- normalize()
Normalize this quaternion
- normalized()
Get the normalized version of this quaternion
- Return type:
Quaterniond
- Returns:
Normalized quaternion
- setIdentity()
Set this quaternion to identity
- Return type:
Quaterniond
- Returns:
Reference to this quaternion
- setVec(vec)
Set the vector representation of this quaternion
- Parameters:
vec (Eigen::Vector3d) – Vector representation
- setW(w)
Set the w component of this quaternion
- Parameters:
w (float) – W component
- setX(x)
Set the x component of this quaternion
- Parameters:
x (float) – X component
- setY(y)
Set the y component of this quaternion
- Parameters:
y (float) – Y component
- setZ(z)
Set the z component of this quaternion
- Parameters:
z (float) – Z component
- slerp(t, other)
Computer the spherical linear interpolation between this and another quaternion
- Parameters:
t (float) – Interpolation parameter
other (
Quaterniond
) – Other quaternion
- Return type:
Quaterniond
- Returns:
Result of interpolation
- squaredNorm()
Get the squared norm of this quaternion
- Return type:
float
- Returns:
Squared norm
- toRotationMatrix()
Get the 3x3 rotation matrix of this quaternion
- Return type:
Eigen::Matrix3d
- Returns:
Rotation matrix
- vec()
Get the vector representation of this quaternion
- Return type:
Eigen::Vector3d
- Returns:
Vector representation
- w()
Get the w component of this quaternion
- Return type:
float
- Returns:
W component
- x()
Get the x component of this quaternion
- Return type:
float
- Returns:
X component
- y()
Get the y component of this quaternion
- Return type:
float
- Returns:
Y component
- z()
Get the z component of this quaternion
- Return type:
float
- Returns:
Z component
Resource Class¶
- class tesseract_robotics.tesseract_common.Resource(*args, **kwargs)
Represents resource data available from a file or url
- getFilePath()
Get the file path of the resource. Only valid if isFile() is true.
- Return type:
string
- Returns:
The file path to the resource
- getResourceContentStream()
Get the resource as a std::istream. This function and the returned stream may block
- Return type:
std::shared_ptr< std::istream >
- Returns:
A std::istream shared pointer for the resource data
- getResourceContents()
Get the resource as bytes. This function may block
- Return type:
std::vector< uint8_t,std::allocator< uint8_t > >
- Returns:
Resource bytes as a uint8_t vector
- getUrl()
Get the original URL used to locate the file
- Return type:
string
- Returns:
The URL of the resource
- isFile()
Returns true if the located resource is a local file
- Return type:
boolean
- Returns:
true if the resource is a local file, otherwise false
ResourceLocator Class¶
- class tesseract_robotics.tesseract_common.ResourceLocator
Abstract class for resource loaders
- locateResource(url)
Locate a resource based on a URL
- Parameters:
url (string) – The URL of the resource
- Return type:
Resource
- Returns:
A shared pointer to a Resource instance, or nullptr if not found
SimpleLocatedResource Class¶
- class tesseract_robotics.tesseract_common.SimpleLocatedResource(*args)
Resource implementation for a local file
- getFilePath()
Get the file path of the resource. Only valid if isFile() is true.
- Return type:
string
- Returns:
The file path to the resource
- getResourceContentStream()
Get the resource as a std::istream. This function and the returned stream may block
- Return type:
std::shared_ptr< std::istream >
- Returns:
A std::istream shared pointer for the resource data
- getResourceContents()
Get the resource as bytes. This function may block
- Return type:
std::vector< uint8_t,std::allocator< uint8_t > >
- Returns:
Resource bytes as a uint8_t vector
- getUrl()
Get the original URL used to locate the file
- Return type:
string
- Returns:
The URL of the resource
- isFile()
Returns true if the located resource is a local file
- Return type:
boolean
- Returns:
true if the resource is a local file, otherwise false
- locateResource(url)
Locate a resource based on a URL
- Parameters:
url (string) – The URL of the resource
- Return type:
Resource
- Returns:
A shared pointer to a Resource instance, or nullptr if not found
SimpleResourceLocatorFn Class¶
- class tesseract_robotics.tesseract_common.SimpleResourceLocatorFn(fn)
SimpleResourceLocatorFnBase Class¶
- class tesseract_robotics.tesseract_common.SimpleResourceLocatorFnBase
TaskComposerPluginInfo Class¶
- class tesseract_robotics.tesseract_common.TaskComposerPluginInfo
The task composer plugin information structure
- clear()
Clear the contents
- empty()
Check if structure is empty
- property executor_plugin_infos
A map of name to task composer executor plugin information
- insert(other)
Insert the content of an other TaskComposerPluginInfo
- property search_libraries
A list of library names without the prefix or suffix that contain plugins
- property search_paths
A list of paths to search for plugins
- property task_plugin_infos
A map of name to task composer task plugin information
Timer Class¶
- class tesseract_robotics.tesseract_common.Timer
A simple timer class leveraging chrono high resolution clock
- elapsedMilliseconds()
Get the elapsed time in milliseconds If timer is actively running it will use Clock::now() as the end time
- Return type:
float
- Returns:
The elapsed time in milliseconds
- elapsedSeconds()
Get the elapsed time in seconds If timer is actively running it will use Clock::now() as the end time
- Return type:
float
- Returns:
The elapsed time in seconds
- start()
Start the timer
- stop()
Stop the timer
Translation3d Class¶
- class tesseract_robotics.tesseract_common.Translation3d(*args)
Eigen::Translation3d bindings
This class is a wrapper around Eigen::Translation3d
- setX(x)
Set the x component of this Translation3d
- Parameters:
x (float) – X component
- setY(y)
Set the y component of this Translation3d
- Parameters:
y (float) – Y component
- setZ(z)
Set the z component of this Translation3d
- Parameters:
z (float) – Z component
- x()
Get the x component of this Translation3d
- Return type:
float
- Returns:
X component
- y()
Get the y component of this Translation3d
- Return type:
float
- Returns:
Y component
- z()
Get the z component of this Translation3d
- Return type:
float
- Returns:
Z component
TypeErasureInterface Class¶
- class tesseract_robotics.tesseract_common.TypeErasureInterface(*args, **kwargs)
This is the interface that all type erasures interfaces must inherit from
Uuid Class¶
- class tesseract_robotics.tesseract_common.Uuid
Wrapper for boost::uuids::uuid
This class is a simple wrapper for boost::uuids::uuid. It is used to provide a simple interface for the uuid class in python.
XMLAttribute Class¶
- class tesseract_robotics.tesseract_common.XMLAttribute(*args, **kwargs)
An attribute is a name-value pair. Elements have an arbitrary number of attributes, each with a unique name.
Notes: The attributes are not XMLNodes. You may only query the Next() attribute in a list.
- BoolValue()
Query as a boolean. See IntValue()
- DoubleValue()
Query as a double. See IntValue()
- FloatValue()
Query as a float. See IntValue()
- GetLineNum()
Gets the line number the attribute is in, if the document was parsed from a file.
- IntValue()
- IntValue interprets the attribute as an integer, and returns the value.
- If the value isn’t an integer, 0 will be returned. There is no error checking;
use QueryIntValue() if you need error checking.
- Name()
The name of the attribute.
- Next()
The next attribute in the list.
- QueryBoolValue(value)
See QueryIntValue
- QueryDoubleValue(value)
See QueryIntValue
- QueryFloatValue(value)
See QueryIntValue
- QueryInt64Value(value)
See QueryIntValue
- QueryIntValue(value)
- QueryIntValue interprets the attribute as an integer, and returns the value
in the provided parameter. The function will return XML_SUCCESS on success, and XML_WRONG_ATTRIBUTE_TYPE if the conversion is not successful.
- QueryUnsignedValue(value)
See QueryIntValue
- SetAttribute(*args)
Overload 1: Set the attribute to a string value.
Overload 2: Set the attribute to value.
Overload 3: Set the attribute to value.
Overload 4: Set the attribute to value.
Overload 5: Set the attribute to value.
Overload 6: Set the attribute to value.
Overload 7: Set the attribute to value.
- UnsignedValue()
Query as an unsigned integer. See IntValue()
- Value()
The value of the attribute.
XMLComment Class¶
- class tesseract_robotics.tesseract_common.XMLComment(*args, **kwargs)
An XML Comment.
- Accept(visitor)
- Accept a hierarchical visit of the nodes in the TinyXML-2 DOM. Every node in the
XML tree will be conditionally visited and the host will be called back via the XMLVisitor interface.
This is essentially a SAX interface for TinyXML-2. (Note however it doesn’t re-parse the XML for the callbacks, so the performance of TinyXML-2 is unchanged by using this interface versus any other.)
The interface has been based on ideas from:
Which are both good references for “visiting”.
- An example of using Accept():
XMLPrinter printer;
tinyxmlDoc.Accept( &printer ); const char* xmlcstr = printer.CStr();
- ShallowClone(document)
Make a copy of this node, but not its children. You may pass in a Document pointer that will be the owner of the new Node. If the ‘document’ is null, then the node returned will be allocated from the current Document. (this->GetDocument())
Note: if called on a XMLDocument, this will return null.
- ShallowEqual(compare)
Test if 2 nodes are the same, but don’t test children. The 2 nodes do not need to be in the same Document.
Note: if called on a XMLDocument, this will return false.
XMLConstHandle Class¶
- class tesseract_robotics.tesseract_common.XMLConstHandle(*args)
A variant of the XMLHandle class for working with const XMLNodes and Documents. It is the same in all regards, except for the ‘const’ qualifiers. See XMLHandle for API.
XMLDeclaration Class¶
- class tesseract_robotics.tesseract_common.XMLDeclaration(*args, **kwargs)
- In correct XML the declaration is the first entry in the file.
<?xml version=”1.0” standalone=”yes”?>
TinyXML-2 will happily read or write files without a declaration, however.
The text of the declaration isn’t interpreted. It is parsed and written as a string.
- Accept(visitor)
- Accept a hierarchical visit of the nodes in the TinyXML-2 DOM. Every node in the
XML tree will be conditionally visited and the host will be called back via the XMLVisitor interface.
This is essentially a SAX interface for TinyXML-2. (Note however it doesn’t re-parse the XML for the callbacks, so the performance of TinyXML-2 is unchanged by using this interface versus any other.)
The interface has been based on ideas from:
Which are both good references for “visiting”.
- An example of using Accept():
XMLPrinter printer;
tinyxmlDoc.Accept( &printer ); const char* xmlcstr = printer.CStr();
- ShallowClone(document)
Make a copy of this node, but not its children. You may pass in a Document pointer that will be the owner of the new Node. If the ‘document’ is null, then the node returned will be allocated from the current Document. (this->GetDocument())
Note: if called on a XMLDocument, this will return null.
- ShallowEqual(compare)
Test if 2 nodes are the same, but don’t test children. The 2 nodes do not need to be in the same Document.
Note: if called on a XMLDocument, this will return false.
XMLDocument Class¶
- class tesseract_robotics.tesseract_common.XMLDocument(*args)
A Document binds together all the functionality. It can be saved, loaded, and printed to the screen. All Nodes are connected and allocated to a Document. If the Document is deleted, all its Nodes are also deleted.
- Accept(visitor)
- Accept a hierarchical visit of the nodes in the TinyXML-2 DOM. Every node in the
XML tree will be conditionally visited and the host will be called back via the XMLVisitor interface.
This is essentially a SAX interface for TinyXML-2. (Note however it doesn’t re-parse the XML for the callbacks, so the performance of TinyXML-2 is unchanged by using this interface versus any other.)
The interface has been based on ideas from:
Which are both good references for “visiting”.
- An example of using Accept():
XMLPrinter printer;
tinyxmlDoc.Accept( &printer ); const char* xmlcstr = printer.CStr();
- Clear()
Clear the document, resetting it to the initial state.
- DeepCopy(target)
Copies this document to a target document. The target will be completely cleared before the copy. If you want to copy a sub-tree, see XMLNode::DeepClone().
NOTE: that the ‘target’ must be non-null.
- DeleteNode(node)
Delete a node associated with this document. It will be unlinked from the DOM.
- Error()
Return true if there was an error parsing the document.
- ErrorID()
Return the errorID.
- ErrorLineNum()
Return the line where the error occured, or zero if unknown.
- ErrorStr()
- Returns a “long form” error description. A hopefully helpful
diagnostic with location, line number, and/or additional info.
- HasBOM()
Returns true if this document has a leading Byte Order Mark of UTF8.
- LoadFile(*args)
Overload 1:
Load an XML file from disk. Returns XML_SUCCESS (0) on success, or an errorID.
Overload 2:
Load an XML file from disk. You are responsible for providing and closing the FILE*.
NOTE: The file should be opened as binary (“rb”) not text in order for TinyXML-2 to correctly do newline normalization.
Returns XML_SUCCESS (0) on success, or an errorID.
- NewComment(comment)
Create a new Comment associated with this Document. The memory for the Comment is managed by the Document.
- NewDeclaration(text=None)
Create a new Declaration associated with this Document. The memory for the object is managed by the Document.
If the ‘text’ param is null, the standard declaration is used.:
<?xml version=”1.0” encoding=”UTF-8”?>
- NewElement(name)
Create a new Element associated with this Document. The memory for the Element is managed by the Document.
- NewText(text)
Create a new Text associated with this Document. The memory for the Text is managed by the Document.
- NewUnknown(text)
Create a new Unknown associated with this Document. The memory for the object is managed by the Document.
- Parse(*args)
Parse an XML file from a character string. Returns XML_SUCCESS (0) on success, or an errorID.
You may optionally pass in the ‘nBytes’, which is the number of bytes which will be parsed. If not specified, TinyXML-2 will assume ‘xml’ points to a null terminated string.
- Print(streamer=None)
- Print the Document. If the Printer is not provided, it will
- print to stdout. If you provide Printer, this can print to a file:
XMLPrinter printer( fp );
doc.Print( &printer );
- Or you can use a printer to print to memory:
XMLPrinter printer;
doc.Print( &printer );
printer.CStr() has a const char* to the XML
- PrintError()
A (trivial) utility function that prints the ErrorStr() to stdout.
- SaveFile(*args)
Overload 1:
Save the XML file to disk. Returns XML_SUCCESS (0) on success, or an errorID.
Overload 2:
Save the XML file to disk. You are responsible for providing and closing the FILE*.
Returns XML_SUCCESS (0) on success, or an errorID.
Overload 3:
Save the XML file to disk. You are responsible for providing and closing the FILE*.
Returns XML_SUCCESS (0) on success, or an errorID.
- SetBOM(useBOM)
Sets whether to write the BOM when writing the file.
- ShallowClone(arg2)
Make a copy of this node, but not its children. You may pass in a Document pointer that will be the owner of the new Node. If the ‘document’ is null, then the node returned will be allocated from the current Document. (this->GetDocument())
Note: if called on a XMLDocument, this will return null.
- ShallowEqual(arg2)
Test if 2 nodes are the same, but don’t test children. The 2 nodes do not need to be in the same Document.
Note: if called on a XMLDocument, this will return false.
XMLElement Class¶
- class tesseract_robotics.tesseract_common.XMLElement(*args, **kwargs)
The element is a container class. It has a value, the element name, and can contain other elements, text, comments, and unknowns. Elements also contain an arbitrary number of attributes.
- Accept(visitor)
- Accept a hierarchical visit of the nodes in the TinyXML-2 DOM. Every node in the
XML tree will be conditionally visited and the host will be called back via the XMLVisitor interface.
This is essentially a SAX interface for TinyXML-2. (Note however it doesn’t re-parse the XML for the callbacks, so the performance of TinyXML-2 is unchanged by using this interface versus any other.)
The interface has been based on ideas from:
Which are both good references for “visiting”.
- An example of using Accept():
XMLPrinter printer;
tinyxmlDoc.Accept( &printer ); const char* xmlcstr = printer.CStr();
- Attribute(name, value=None)
- Given an attribute name, Attribute() returns the value
for the attribute of that name, or null if none exists. For example:
const char* value = ele->Attribute( “foo” );
The ‘value’ parameter is normally null. However, if specified, the attribute will only be returned if the ‘name’ and ‘value’ match. This allow you to write code:
if ( ele->Attribute( “foo”, “bar” ) ) callFooIsBar();
- rather than:
if ( ele->Attribute( “foo” ) ) { if ( strcmp( ele->Attribute( “foo” ), “bar” ) == 0 ) callFooIsBar();
}
- BoolAttribute(name, defaultValue=False)
See IntAttribute()
- BoolText(defaultValue=False)
See QueryIntText()
- DeleteAttribute(name)
Delete an attribute.
- DoubleAttribute(name, defaultValue=0)
See IntAttribute()
- DoubleText(defaultValue=0)
See QueryIntText()
- FindAttribute(name)
Query a specific attribute in the list.
- FirstAttribute()
Return the first attribute in the list.
- FloatAttribute(name, defaultValue=0)
See IntAttribute()
- FloatText(defaultValue=0)
See QueryIntText()
- GetText()
- Convenience function for easy access to the text inside an element. Although easy
and concise, GetText() is limited compared to getting the XMLText child and accessing it directly.
If the first child of ‘this’ is a XMLText, the GetText() returns the character string of the Text node, else null is returned.
- This is a convenient method for getting the text of simple contained text:
<foo>This is text</foo> const char* str = fooElement->GetText();
‘str’ will be a pointer to “This is text”.
Note that this function can be misleading. If the element foo was created from this XML:
<foo><b>This is text</b></foo>
then the value of str would be null. The first child node isn’t a text node, it is another element. From this XML:
<foo>This is <b>text</b></foo>
GetText() will return “This is “.
- Int64Attribute(name, defaultValue=0)
See IntAttribute()
- Int64Text(defaultValue=0)
See QueryIntText()
- IntAttribute(name, defaultValue=0)
- Given an attribute name, IntAttribute() returns the value
of the attribute interpreted as an integer. The default
value will be returned if the attribute isn’t present, or if there is an error. (For a method with error
checking, see QueryIntAttribute()).
- Name()
Get the name of an element (which is the Value() of the node.)
- QueryBoolAttribute(name, value)
See QueryIntAttribute()
- QueryBoolText(bval)
See QueryIntText()
- QueryDoubleAttribute(name, value)
See QueryIntAttribute()
- QueryDoubleText(dval)
See QueryIntText()
- QueryFloatAttribute(name, value)
See QueryIntAttribute()
- QueryFloatText(fval)
See QueryIntText()
- QueryInt64Attribute(name, value)
See QueryIntAttribute()
- QueryInt64Text(uval)
See QueryIntText()
- QueryIntAttribute(name, value)
- Given an attribute name, QueryIntAttribute() returns
XML_SUCCESS, XML_WRONG_ATTRIBUTE_TYPE if the conversion can’t be performed, or XML_NO_ATTRIBUTE if the attribute doesn’t exist. If successful, the result of the conversion will be written to ‘value’. If not successful, nothing will be written to ‘value’. This allows you to provide default value:
int value = 10;
QueryIntAttribute( “foo”, &value ); // if “foo” isn’t found, value will still be 10
- QueryIntText(ival)
Convenience method to query the value of a child text node. This is probably best shown by example. Given you have a document is this form:
<point> <x>1</x> <y>1.4</y>
</point>
The QueryIntText() and similar functions provide a safe and easier way to get to the “value” of x and y.
int x = 0;
float y = 0; // types of x and y are contrived for example const XMLElement* xElement = pointElement->FirstChildElement( “x” ); const XMLElement* yElement = pointElement->FirstChildElement( “y” ); xElement->QueryIntText( &x ); yElement->QueryFloatText( &y );
- rtype:
int
- Returns:
XML_SUCCESS (0) on success, XML_CAN_NOT_CONVERT_TEXT if the text cannot be converted to the requested type, and XML_NO_TEXT_NODE if there is no child text to query.
- QueryStringAttribute(name, value)
See QueryIntAttribute()
- QueryUnsignedAttribute(name, value)
See QueryIntAttribute()
- QueryUnsignedText(uval)
See QueryIntText()
- SetAttribute(*args)
Overload 1: Sets the named attribute to value.
Overload 2: Sets the named attribute to value.
Overload 3: Sets the named attribute to value.
Overload 4: Sets the named attribute to value.
Overload 5: Sets the named attribute to value.
Overload 6: Sets the named attribute to value.
Overload 7: Sets the named attribute to value.
- SetName(str, staticMem=False)
Set the name of the element.
- SetText(*args)
- Overload 1:
- Convenience function for easy access to the text inside an element. Although easy
and concise, SetText() is limited compared to creating an XMLText child and mutating it directly.
- If the first child of ‘this’ is a XMLText, SetText() sets its value to
the given string, otherwise it will create a first child that is an XMLText.
- This is a convenient method for setting the text of simple contained text:
<foo>This is text</foo> fooElement->SetText( “Hullaballoo!” );
<foo>Hullaballoo!</foo>
Note that this function can be misleading. If the element foo was created from this XML:
<foo><b>This is text</b></foo>
- then it will not change “This is text”, but rather prefix it with a text element:
<foo>Hullaballoo!<b>This is text</b></foo>
- For this XML:
<foo />
- SetText() will generate
<foo>Hullaballoo!</foo>
- Overload 2:
Convenience method for setting text inside an element. See SetText() for important limitations.
- Overload 3:
Convenience method for setting text inside an element. See SetText() for important limitations.
- Overload 4:
Convenience method for setting text inside an element. See SetText() for important limitations.
- Overload 5:
Convenience method for setting text inside an element. See SetText() for important limitations.
- Overload 6:
Convenience method for setting text inside an element. See SetText() for important limitations.
- Overload 7:
Convenience method for setting text inside an element. See SetText() for important limitations.
- ShallowClone(document)
Make a copy of this node, but not its children. You may pass in a Document pointer that will be the owner of the new Node. If the ‘document’ is null, then the node returned will be allocated from the current Document. (this->GetDocument())
Note: if called on a XMLDocument, this will return null.
- ShallowEqual(compare)
Test if 2 nodes are the same, but don’t test children. The 2 nodes do not need to be in the same Document.
Note: if called on a XMLDocument, this will return false.
- UnsignedAttribute(name, defaultValue=0)
See IntAttribute()
- UnsignedText(defaultValue=0)
See QueryIntText()
XMLHandle Class¶
- class tesseract_robotics.tesseract_common.XMLHandle(*args)
A XMLHandle is a class that wraps a node pointer with null checks; this is an incredibly useful thing. Note that XMLHandle is not part of the TinyXML-2 DOM structure. It is a separate utility class.
- Take an example:
<Document> <Element attributeA = “valueA”>
<Child attributeB = “value1” /> <Child attributeB = “value2” />
</Element>
</Document>
Assuming you want the value of “attributeB” in the 2nd “Child” element, it’s very easy to write a lot of code that looks like:
XMLElement* root = document.FirstChildElement( “Document” );
if ( root ) {
XMLElement* element = root->FirstChildElement( “Element” ); if ( element ) {
XMLElement* child = element->FirstChildElement( “Child” ); if ( child ) {
XMLElement* child2 = child->NextSiblingElement( “Child” ); if ( child2 ) {
Finally do something useful.
And that doesn’t even cover “else” cases. XMLHandle addresses the verbosity of such code. A XMLHandle checks for null pointers so it is perfectly safe and correct to use:
XMLHandle docHandle( &document );
XMLElement* child2 = docHandle.FirstChildElement( “Document” ).FirstChildElement( “Element” ).FirstChildElement().NextSiblingElement(); if ( child2 ) {
do something useful
Which is MUCH more concise and useful.
- It is also safe to copy handles - internally they are nothing more than node pointers.
XMLHandle handleCopy = handle;
See also XMLConstHandle, which is the same as XMLHandle, but operates on const objects.
- FirstChild()
Get the first child of this handle.
- FirstChildElement(name=None)
Get the first child element of this handle.
- LastChild()
Get the last child of this handle.
- LastChildElement(name=None)
Get the last child element of this handle.
- NextSibling()
Get the next sibling of this handle.
- NextSiblingElement(name=None)
Get the next sibling element of this handle.
- PreviousSibling()
Get the previous sibling of this handle.
- PreviousSiblingElement(name=None)
Get the previous sibling element of this handle.
- ToDeclaration()
Safe cast to XMLDeclaration. This can return null.
- ToElement()
Safe cast to XMLElement. This can return null.
- ToNode()
Safe cast to XMLNode. This can return null.
- ToText()
Safe cast to XMLText. This can return null.
- ToUnknown()
Safe cast to XMLUnknown. This can return null.
XMLNode Class¶
- class tesseract_robotics.tesseract_common.XMLNode(*args, **kwargs)
XMLNode is a base class for every object that is in the XML Document Object Model (DOM), except XMLAttributes. Nodes have siblings, a parent, and children which can be navigated. A node is always in a XMLDocument. The type of a XMLNode can be queried, and it can be cast to its more defined type.
A XMLDocument allocates memory for all its Nodes. When the XMLDocument gets deleted, all its Nodes will also be deleted.
- A Document can contain: Element (container or leaf)
Comment (leaf) Unknown (leaf) Declaration( leaf )
- An Element can contain: Element (container or leaf)
Text (leaf) Attributes (not on tree) Comment (leaf) Unknown (leaf)
- Accept(visitor)
- Accept a hierarchical visit of the nodes in the TinyXML-2 DOM. Every node in the
XML tree will be conditionally visited and the host will be called back via the XMLVisitor interface.
This is essentially a SAX interface for TinyXML-2. (Note however it doesn’t re-parse the XML for the callbacks, so the performance of TinyXML-2 is unchanged by using this interface versus any other.)
The interface has been based on ideas from:
Which are both good references for “visiting”.
- An example of using Accept():
XMLPrinter printer;
tinyxmlDoc.Accept( &printer ); const char* xmlcstr = printer.CStr();
- DeepClone(target)
Make a copy of this node and all its children.
If the ‘target’ is null, then the nodes will be allocated in the current document. If ‘target’
is specified, the memory will be allocated is the specified XMLDocument.
NOTE: This is probably not the correct tool to copy a document, since XMLDocuments can have multiple top level XMLNodes. You probably want to use
XMLDocument::DeepCopy()
- DeleteChild(node)
Delete a child of this node.
- DeleteChildren()
Delete all the children of this node.
- GetDocument(*args)
Overload 1: Get the XMLDocument that owns this XMLNode.
Overload 2: Get the XMLDocument that owns this XMLNode.
- GetLineNum()
Gets the line number the node is in, if the document was parsed from a file.
- GetUserData()
Get user data set into the XMLNode. TinyXML-2 in no way processes or interprets user data. It is initially 0.
- InsertAfterChild(afterThis, addThis)
Add a node after the specified child node.
If the child node is already part of the document, it is moved from its old location to the new location. Returns the addThis argument or 0 if the afterThis node is not a child of this node, or if the node does not belong to the same document.
- InsertEndChild(addThis)
Add a child node as the last (right) child.
If the child node is already part of the document, it is moved from its old location to the new location. Returns the addThis argument or 0 if the node does not belong to the same document.
- InsertFirstChild(addThis)
Add a child node as the first (left) child.
If the child node is already part of the document, it is moved from its old location to the new location. Returns the addThis argument or 0 if the node does not belong to the same document.
- NoChildren()
Returns true if this node has no children.
- SetUserData(userData)
Set user data into the XMLNode. TinyXML-2 in no way processes or interprets user data. It is initially 0.
- SetValue(val, staticMem=False)
- Set the Value of an XML node.
See also: Value()
- ShallowClone(document)
Make a copy of this node, but not its children. You may pass in a Document pointer that will be the owner of the new Node. If the ‘document’ is null, then the node returned will be allocated from the current Document. (this->GetDocument())
Note: if called on a XMLDocument, this will return null.
- ShallowEqual(compare)
Test if 2 nodes are the same, but don’t test children. The 2 nodes do not need to be in the same Document.
Note: if called on a XMLDocument, this will return false.
- Value()
- The meaning of ‘value’ changes for the specific type.
Document: empty (NULL is returned, not an empty string)
Element: name of the element Comment: the comment text Unknown: the tag contents Text: the text string
XMLPrinter Class¶
- class tesseract_robotics.tesseract_common.XMLPrinter(file=None, compact=False, depth=0)
Printing functionality. The XMLPrinter gives you more options than the XMLDocument::Print() method.
It can: -# Print to memory. -# Print to a file you provide. -# Print XML without a XMLDocument.
Print to Memory
XMLPrinter printer;
doc.Print( &printer ); SomeFunction( printer.CStr() );
Print to a File
- You provide the file pointer.
XMLPrinter printer( fp );
doc.Print( &printer );
Print without a XMLDocument
When loading, an XML parser is very useful. However, sometimes when saving, it just gets in the way. The code is often set up for streaming, and constructing the DOM is just overhead.
The Printer supports the streaming case. The following code prints out a trivially simple XML file without ever creating an XML document.
XMLPrinter printer( fp );
printer.OpenElement( “foo” ); printer.PushAttribute( “foo”, “bar” ); printer.CloseElement();
- CStr()
If in print to memory mode, return a pointer to the XML file in memory.
- CStrSize()
If in print to memory mode, return the size of the XML file in memory. (Note the size returned includes the terminating null.)
- ClearBuffer()
If in print to memory mode, reset the buffer to the beginning.
- CloseElement(compactMode=False)
If streaming, close the Element.
- OpenElement(name, compactMode=False)
- If streaming, start writing an element.
The element must be closed with CloseElement()
- PushComment(comment)
Add a comment
- PushHeader(writeBOM, writeDeclaration)
If streaming, write the BOM and declaration.
- PushText(*args)
Overload 1: Add a text node.
Overload 2: Add a text node from an integer.
Overload 3: Add a text node from an unsigned.
Overload 4: Add a text node from an unsigned.
Overload 5: Add a text node from a bool.
Overload 6: Add a text node from a float.
Overload 7: Add a text node from a double.
- Visit(*args)
Overload 1: Visit a declaration.
Overload 2: Visit a text node.
Overload 3: Visit a comment node.
Overload 4: Visit an unknown node.
- VisitEnter(*args)
Overload 1: Visit a document.
Overload 2: Visit an element.
- VisitExit(*args)
Overload 1: Visit a document.
Overload 2: Visit an element.
XMLText Class¶
- class tesseract_robotics.tesseract_common.XMLText(*args, **kwargs)
XML text.
- Note that a text node can have child element nodes, for example:
<root>This is <b>bold</b></root>
A text node can have 2 ways to output the next. “normal” output and CDATA. It will default to the mode it was parsed from the XML file and you generally want to leave it alone, but you can change the output mode with SetCData() and query it with CData().
- Accept(visitor)
- Accept a hierarchical visit of the nodes in the TinyXML-2 DOM. Every node in the
XML tree will be conditionally visited and the host will be called back via the XMLVisitor interface.
This is essentially a SAX interface for TinyXML-2. (Note however it doesn’t re-parse the XML for the callbacks, so the performance of TinyXML-2 is unchanged by using this interface versus any other.)
The interface has been based on ideas from:
Which are both good references for “visiting”.
- An example of using Accept():
XMLPrinter printer;
tinyxmlDoc.Accept( &printer ); const char* xmlcstr = printer.CStr();
- CData()
Returns true if this is a CDATA text element.
- SetCData(isCData)
Declare whether this should be CDATA or standard text.
- ShallowClone(document)
Make a copy of this node, but not its children. You may pass in a Document pointer that will be the owner of the new Node. If the ‘document’ is null, then the node returned will be allocated from the current Document. (this->GetDocument())
Note: if called on a XMLDocument, this will return null.
- ShallowEqual(compare)
Test if 2 nodes are the same, but don’t test children. The 2 nodes do not need to be in the same Document.
Note: if called on a XMLDocument, this will return false.
XMLUnknown Class¶
- class tesseract_robotics.tesseract_common.XMLUnknown(*args, **kwargs)
Any tag that TinyXML-2 doesn’t recognize is saved as an unknown. It is a tag of text, but should not be modified. It will be written back to the XML, unchanged, when the file is saved.
DTD tags get thrown into XMLUnknowns.
- Accept(visitor)
- Accept a hierarchical visit of the nodes in the TinyXML-2 DOM. Every node in the
XML tree will be conditionally visited and the host will be called back via the XMLVisitor interface.
This is essentially a SAX interface for TinyXML-2. (Note however it doesn’t re-parse the XML for the callbacks, so the performance of TinyXML-2 is unchanged by using this interface versus any other.)
The interface has been based on ideas from:
Which are both good references for “visiting”.
- An example of using Accept():
XMLPrinter printer;
tinyxmlDoc.Accept( &printer ); const char* xmlcstr = printer.CStr();
- ShallowClone(document)
Make a copy of this node, but not its children. You may pass in a Document pointer that will be the owner of the new Node. If the ‘document’ is null, then the node returned will be allocated from the current Document. (this->GetDocument())
Note: if called on a XMLDocument, this will return null.
- ShallowEqual(compare)
Test if 2 nodes are the same, but don’t test children. The 2 nodes do not need to be in the same Document.
Note: if called on a XMLDocument, this will return false.
XMLUtil Class¶
- class tesseract_robotics.tesseract_common.XMLUtil
XMLVisitor Class¶
- class tesseract_robotics.tesseract_common.XMLVisitor
Implements the interface to the “Visitor pattern” (see the Accept() method.) If you call the Accept() method, it requires being passed a XMLVisitor class to handle callbacks. For nodes that contain other nodes (Document, Element) you will get called with a VisitEnter/VisitExit pair. Nodes that are always leafs are simply called with Visit().
If you return ‘true’ from a Visit method, recursive parsing will continue. If you return false, no children of this node or its siblings will be visited.
All flavors of Visit methods have a default implementation that returns ‘true’ (continue visiting). You need to only override methods that are interesting to you.
Generally Accept() is called on the XMLDocument, although all nodes support visiting.
You should never change the document from a callback.
See also: XMLNode::Accept()
- Visit(*args)
Overload 1: Visit a declaration.
Overload 2: Visit a text node.
Overload 3: Visit a comment node.
Overload 4: Visit an unknown node.
- VisitEnter(*args)
Overload 1: Visit a document.
Overload 2: Visit an element.
- VisitExit(*args)
Overload 1: Visit a document.
Overload 2: Visit an element.
type_index Class¶
- class tesseract_robotics.tesseract_common.type_index(*args, **kwargs)
Functions¶
AnyPoly_as_double Function¶
- tesseract_robotics.tesseract_common.AnyPoly_as_double(_self)
AnyPoly_as_string Function¶
- tesseract_robotics.tesseract_common.AnyPoly_as_string(_self)
AnyPoly_is_double Function¶
- tesseract_robotics.tesseract_common.AnyPoly_is_double(_self)
AnyPoly_is_string Function¶
- tesseract_robotics.tesseract_common.AnyPoly_is_string(_self)
AnyPoly_wrap_double Function¶
- tesseract_robotics.tesseract_common.AnyPoly_wrap_double(inner_waypoint)
AnyPoly_wrap_string Function¶
- tesseract_robotics.tesseract_common.AnyPoly_wrap_string(inner_waypoint)
getLogLevel Function¶
- tesseract_robotics.tesseract_common.getLogLevel()
Retrieve the current level of logging data. Messages with lower logging levels will not be recorded.
isWithinPositionLimits Function¶
- tesseract_robotics.tesseract_common.isWithinPositionLimits(joint_positions, position_limits)
Check if within position limits
- Parameters:
joint_positions (Eigen::Ref< Eigen::Matrix< double,Eigen::Dynamic,1 > const >) – The joint position to check
position_limits (Eigen::Ref< Eigen::Matrix< double,Eigen::Dynamic,2 > const >) – The joint limits to perform check
- Return type:
boolean
- Returns:
log Function¶
- tesseract_robotics.tesseract_common.log(file, line, level, m)
Root level logging function. This should not be invoked directly, but rather used via a ‘logging macro’. Formats the message string given the arguments and forwards the string to the output handler
makeOrderedLinkPair Function¶
- tesseract_robotics.tesseract_common.makeOrderedLinkPair(*args)
Overload 1:
Create a pair of strings, where the pair.first is always <= pair.second.
This is commonly used along with PairHash as the key to an unordered_map<LinkNamesPair, Type, PairHash>
- Parameters:
link_name1 (string) – First link name
link_name2 (string) – Second link name
- Return type:
LinkNamesPair
- Returns:
LinkNamesPair a lexicographically sorted pair of strings
Overload 2:
Populate a pair of strings, where the pair.first is always <= pair.second.
This is used to avoid multiple memory application throughout the code base
This is commonly used along with PairHash as the key to an unordered_map<LinkNamesPair, Type, PairHash>
- Parameters:
pair (
LinkNamesPair
) – The link name pair to load a lexicographically sorted pair of stringslink_name1 (string) – First link name
link_name2 (string) – Second link nam
newRandomUuid Function¶
- tesseract_robotics.tesseract_common.newRandomUuid()
Generate a new random uuid
This function generates a new random uuid
- Return type:
uuid
- Returns:
A new random uuid
noOutputHandler Function¶
- tesseract_robotics.tesseract_common.noOutputHandler()
This function instructs console bridge that no messages should be outputted. Equivalent to useOutputHandler(NULL)
restorePreviousOutputHandler Function¶
- tesseract_robotics.tesseract_common.restorePreviousOutputHandler()
Restore the output handler that was previously in use (if any)
satisfiesPositionLimits Function¶
- tesseract_robotics.tesseract_common.satisfiesPositionLimits(*args)
Overload 1:
Check if joint position is within bounds or relatively equal to a limit
- Parameters:
joint_positions (Eigen::Ref< Eigen::Matrix< double,Eigen::Dynamic,1 > const >) – The joint position to check
joint_limits – The joint limits to perform check
max_diff (Eigen::Ref< Eigen::Matrix< double,Eigen::Dynamic,1 > const >) – The max diff when comparing position to limit value max(abs(position - limit)) <= max_diff, if true they are considered equal
max_rel_diff (Eigen::Ref< Eigen::Matrix< double,Eigen::Dynamic,1 > const >) – The max relative diff between position and limit abs(position - limit) <= largest * max_rel_diff, if true considered equal. The largest is the largest of the absolute values of position and limit.
- Return type:
boolean
- Returns:
True if the all position are within the limits or relatively equal to the limit, otherwise false.
Overload 2:
Check if joint position is within bounds or relatively equal to a limit
- Parameters:
joint_positions (Eigen::Ref< Eigen::Matrix< double,Eigen::Dynamic,1 > const >) – The joint position to check
joint_limits – The joint limits to perform check
max_diff (float, optional) – The max diff when comparing position to limit value max(abs(position - limit)) <= max_diff, if true they are considered equal
max_rel_diff (float, optional) – The max relative diff between position and limit abs(position - limit) <= largest * max_rel_diff, if true considered equal. The largest is the largest of the absolute values of position and limit.
- Return type:
boolean
- Returns:
True if the all position are within the limits or relatively equal to the limit, otherwise false.
Overload 3:
Check if joint position is within bounds or relatively equal to a limit
- Parameters:
joint_positions (Eigen::Ref< Eigen::Matrix< double,Eigen::Dynamic,1 > const >) – The joint position to check
joint_limits – The joint limits to perform check
max_diff (float, optional) – The max diff when comparing position to limit value max(abs(position - limit)) <= max_diff, if true they are considered equal
max_rel_diff – The max relative diff between position and limit abs(position - limit) <= largest * max_rel_diff, if true considered equal. The largest is the largest of the absolute values of position and limit.
- Return type:
boolean
- Returns:
True if the all position are within the limits or relatively equal to the limit, otherwise false.
Overload 4:
Check if joint position is within bounds or relatively equal to a limit :type joint_positions: Eigen::Ref< Eigen::Matrix< double,Eigen::Dynamic,1 > const > :param joint_positions: The joint position to check :param joint_limits: The joint limits to perform check :param max_diff: The max diff when comparing position to limit value max(abs(position - limit)) <= max_diff, if true
they are considered equal
- Parameters:
max_rel_diff – The max relative diff between position and limit abs(position - limit) <= largest * max_rel_diff, if true considered equal. The largest is the largest of the absolute values of position and limit.
- Return type:
boolean
- Returns:
True if the all position are within the limits or relatively equal to the limit, otherwise false.
setLogLevel Function¶
- tesseract_robotics.tesseract_common.setLogLevel(level)
Set the minimum level of logging data to output. Messages with lower logging levels will not be recorded.
useOutputHandler Function¶
- tesseract_robotics.tesseract_common.useOutputHandler(oh)
Specify the instance of the OutputHandler to use. By default, this is OutputHandlerSTD
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
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>