tesseract_robotics.collision¶
Collision detection managers and contact queries.
Contact Managers¶
DiscreteContactManager¶
Checks collision at a single configuration.
from tesseract_robotics.collision import ContactResultMap, DiscreteContactManager
# Get from environment
manager = env.getDiscreteContactManager()
# Clone for thread safety
my_manager = manager.clone()
# Set collision objects state
my_manager.setCollisionObjectsTransform(link_transforms)
# or K poses as one (K, 4, 4) float64 array, row k for link_ids[k] (both manager types);
# each row is checked as Isometry3d(matrix) checks it (NotRotationError names the row)
link_ids = list(link_transforms)
poses = np.stack([link_transforms[link_id].matrix for link_id in link_ids])
my_manager.setCollisionObjectsTransform(link_ids, poses)
# Run collision check — fills ContactResultMap
result_map = ContactResultMap()
my_manager.contactTest(result_map, request)
ContinuousContactManager¶
Checks collision along swept motion.
from tesseract_robotics.collision import ContactResultMap, ContinuousContactManager
# Get from environment
manager = env.getContinuousContactManager()
# Clone for thread safety
my_manager = manager.clone()
# Moving objects: start and end transforms (dict/dict, name + 2 poses, or names + 2 pose lists).
# Static objects take the single-pose overloads.
my_manager.setCollisionObjectsTransform(
link_transforms_start,
link_transforms_end
)
# Run continuous collision check
result_map = ContactResultMap()
my_manager.contactTest(result_map, request)
ContactManagersPluginFactory¶
Loads contact manager plugins (Bullet, FCL) from a YAML config and creates managers.
from pathlib import Path
from tesseract_robotics import get_tesseract_support_path
from tesseract_robotics.collision import ContactManagersPluginFactory
config = get_tesseract_support_path() / "urdf" / "contact_manager_plugins.yaml"
factory = ContactManagersPluginFactory(config, locator)
plugins = factory.getDiscreteContactManagerPlugins() # dict[str, PluginInfo]
factory.addDiscreteContactManagerPlugin("MyBullet", plugins["BulletDiscreteBVHManager"])
factory.setDefaultDiscreteContactManagerPlugin("MyBullet")
manager = factory.createDiscreteContactManager("MyBullet") # by registered name
manager = factory.createDiscreteContactManager("adhoc", plugins["BulletDiscreteBVHManager"])
print(factory.getConfig()) # the config as a YAML string
factory.saveConfig(Path("cm.yaml")) # OSError if the file cannot be written
The continuous methods mirror the discrete ones. remove…Plugin and
setDefault…Plugin raise KeyError for an unknown name; create…ContactManager(name)
returns None for one. A manager keeps its factory alive: its code lives in a
plugin library the factory loaded, so dropping the factory first is safe.
Contact Request¶
Configure what contacts to find.
from tesseract_robotics.collision import (
ContactRequest, ContactTestType
)
request = ContactRequest()
request.type = ContactTestType.ALL # find all contacts
# Alternatively
request.type = ContactTestType.FIRST # stop at first contact
request.type = ContactTestType.CLOSEST # only closest contact
request.type = ContactTestType.LIMITED # up to max contacts
| ContactTestType | Description |
|---|---|
FIRST |
Stop at first contact found |
CLOSEST |
Only return closest contact |
ALL |
Return all contacts |
LIMITED |
Return up to N contacts |
Validating contacts¶
ContactRequest.is_valid takes a ContactResultValidator: each contact the
manager finds is passed to it, and a False return drops that contact. Subclass
it and implement __call__. None (the default) disables validation.
from tesseract_robotics.collision import ContactResultValidator
class IgnoreGripper(ContactResultValidator):
def __call__(self, result):
return "gripper" not in result.link_ids
request.is_valid = IgnoreGripper() # the request keeps the validator alive
manager.contactTest(result_map, request)
contactTest releases the GIL; the validator takes it again for each call, so a
contact test with a Python validator also runs from a worker thread. An exception
raised in __call__ propagates out of contactTest. The result argument is a
copy, so keeping it beyond the call is safe.
Contact Results¶
ContactResult, ContactResultMap, ContactRequest, ContactManagerConfig and
CollisionCheckConfig compare by value (==, with the C++ tolerances) and are unhashable.
Two ContactRequests are equal only while they hold the same is_valid validator object.
ContactResult¶
Single contact between two objects.
from tesseract_robotics.collision import ContactResult, ContactResultVector
# ContactResultMap maps a link pair to its contacts.
# Flatten it to iterate individual contacts.
result_vector = ContactResultVector()
result_map.flattenMoveResults(result_vector) # or flattenCopyResults()
for contact in result_vector:
print(f"Contact: {contact.link_ids[0]} <-> {contact.link_ids[1]}")
print(f" Distance: {contact.distance}")
print(f" Point A: {contact.nearest_points[0]}")
print(f" Point B: {contact.nearest_points[1]}")
print(f" Normal: {contact.normal}")
| Attribute | Type | Description |
|---|---|---|
distance |
float |
Signed distance (negative = penetration) |
link_ids |
list[LinkId] (2) |
Colliding links (str(link_id) is the link name) |
type_id |
list[int] (2) |
Collision object type ids |
shape_id |
list[int] (2) |
Shape index within each link (-1 if unset) |
subshape_id |
list[int] (2) |
Sub-shape index within each shape (-1 if unset) |
nearest_points |
list[np.ndarray] (2) |
Nearest points, world frame |
nearest_points_local |
list[np.ndarray] (2) |
Nearest points, each link's frame |
transform |
list[Isometry3d] (2) |
Link transforms at the contact |
normal |
np.ndarray |
Unit contact normal, world frame, from link_ids[0] towards link_ids[1] |
cc_time |
list[float] (2) |
Continuous collision times (-1 if not continuous) |
cc_type |
list[ContinuousCollisionType] (2) |
Continuous collision type per link |
cc_transform |
list[Isometry3d] (2) |
Cast object's end transform, per link |
The pair fields hold exactly two items, one per link. Assigning a list of any
other length raises TypeError. Every read returns a new list, so
contact.link_ids[0] = "x" changes only that copy; assign the whole list instead.
Entry k of every pair field describes the same body, link_ids[k], and normal points from
link_ids[0] towards link_ids[1] (moving link_ids[1] along it separates the pair). Which body
is slot 0 is the contact manager's choice, not sorted: it is neither alphabetical nor the
ContactResultMap key's first(), and it changes with the order the objects were added, their
names, the backend and the build. Find a body by link_ids, never by slot.
ContactResultMap¶
Map from a LinkIdPair, in the order the manager reported the two links (at also takes a
(str, str) tuple in that order), to a ContactResultVector. count() is the number of contacts,
size() / len() the number of pairs that have at least one.
from tesseract_robotics.collision import ContactResultMap
from tesseract_robotics.planning import Pose, box, create_obstacle
# A box around the robot's base gives the manager something to report
create_obstacle(robot, "obstacle", box(0.6, 0.6, 0.6), Pose.from_xyz(0.0, 0.0, 0.0))
manager = env.getDiscreteContactManager()
manager.setCollisionObjectsTransform(env.getState().link_transforms)
result_map = ContactResultMap()
manager.contactTest(result_map, request)
print(f"{result_map.size()} contact pairs, {result_map.count()} contacts")
print(result_map.getSummary())
# Read: every value is a copy, never a view into the map
for pair, contacts in result_map: # (LinkIdPair, ContactResultVector) pairs
print(pair.first(), pair.second(), len(contacts))
pair, _ = next(iter(result_map))
contacts = result_map.at((str(pair.first()), str(pair.second()))) # KeyError if absent
as_dict = result_map.getContainer() # dict[LinkIdPair, ContactResultVector]
# Drop every contact that involves the gripper (the vector is live only during the call)
def drop_gripper(key, contacts):
if "gripper" in (str(key.first()), str(key.second())):
contacts.clear()
result_map.filter(drop_gripper)
Building a map: addContactResult(key, result) appends, setContactResult(key, result)
replaces the pair's results; both also take a ContactResultVector, and both return
a copy of the last result stored. A key whose names are out of order raises
UnorderedLinkPairError, and an empty vector raises EmptyContactResultsError
(both subclass ValueError; upstream only asserts these).
clear() empties every vector but keeps the keys, so iteration still yields them
with empty vectors until shrinkToFit() removes them. Iteration walks a snapshot,
so changing the map inside the loop is safe. addInterpolatedCollisionResults
merges a sub-segment's results, setting cc_time / cc_type for the active
links, with an optional filter callback.
ContactResultVector¶
Flat list of ContactResult. Use this for iteration.
from tesseract_robotics.collision import ContactResultVector
all_contacts = ContactResultVector()
result_map.flattenMoveResults(all_contacts) # or flattenCopyResults to keep map data
for contact in all_contacts:
print(contact.distance, contact.link_ids)
ContactArrays¶
ContactResultMap.to_arrays() and ContactResultVector.to_arrays() read every result into
numpy arrays in one call. Row r is result r of flattenCopyResults() (of the vector's own
order), so arrays.<field>[r] is results[r].<field> for every ContactResult field except
link_ids, which becomes links (the distinct links, in order of first appearance) and
link_index. Every array is a new C-contiguous copy that owns its buffer: it stays valid after
clear(), and writing to it does not change the results.
from tesseract_robotics.collision import ContactArrays, ContactResultMap
result_map = ContactResultMap()
manager.contactTest(result_map, request)
arrays: ContactArrays = result_map.to_arrays()
n = len(arrays.distance)
assert arrays.nearest_points.shape == (n, 2, 3)
for r in range(n):
a, b = (arrays.links[i] for i in arrays.link_index[r]) # link_ids of result r
print(a, b, arrays.distance[r], arrays.normal[r]) # normal points from a towards b
| Attribute | dtype, shape | Description |
|---|---|---|
distance |
float64 (n,) |
Signed distance, m (negative = penetration) |
normal |
float64 (n, 3) |
Unit normal, world frame, from slot 0 towards slot 1 |
nearest_points |
float64 (n, 2, 3) |
[r, k]: nearest point of slot k, world frame, m |
nearest_points_local |
float64 (n, 2, 3) |
[r, k]: the same point in slot k's frame |
transform |
float64 (n, 2, 4, 4) |
[r, k]: world pose of slot k (a cast's start pose) |
type_id, shape_id, subshape_id |
int32 (n, 2) |
As on ContactResult, per slot (int in C++) |
single_contact_point |
bool (n,) |
One contact point given: nearest_points[r, 0] == nearest_points[r, 1] |
cc_time |
float64 (n, 2) |
Contact time along slot k's cast, 0 to 1; -1 if not cast |
cc_type |
uint8 (n, 2) |
ContinuousCollisionType value of slot k (the enum's own uint8) |
cc_transform |
float64 (n, 2, 4, 4) |
[r, k]: end pose of slot k's cast |
link_index |
int32 (n, 2) |
links[link_index[r, k]] is link_ids[k] of result r |
links |
tuple[LinkId, ...] |
Distinct links, first appearance row by row, slot 0 before slot 1 |
Column k of every two-slot array describes links[link_index[r, k]], as on ContactResult.
Configuration¶
CollisionCheckConfig¶
Configure collision checking behavior.
from tesseract_robotics.collision import CollisionCheckConfig
config = CollisionCheckConfig()
config.contact_request = request
config.longest_valid_segment_length = 0.01 # for continuous
ContactManagerConfig¶
Configure contact manager settings.
from tesseract_robotics.collision import ContactManagerConfig
from tesseract_robotics.common import CollisionMarginPairOverrideType
config = ContactManagerConfig()
config.default_margin = 0.025
config.pair_margin_data.setCollisionMargin("link_a", "link_b", 0.05)
config.pair_margin_override_type = CollisionMarginPairOverrideType.REPLACE
manager.applyContactManagerConfig(config) # manager: a discrete or continuous contact manager
Convex Mesh Generation¶
Generate convex hulls for collision. makeConvexMesh turns a Mesh into a ConvexMesh;
createConvexHull works on a raw point set (Bullet's convex hull computer).
import numpy as np
from tesseract_robotics.collision import ConvexHullError, createConvexHull, makeConvexMesh
from tesseract_robotics.geometry import createMeshFromPath
mesh = createMeshFromPath("model.stl")[0] # a geometry.Mesh
convex = makeConvexMesh(mesh)
points = [np.array([x, y, z]) for x in (0.0, 1.0) for y in (0.0, 1.0) for z in (0.0, 1.0)]
n_faces, vertices, faces = createConvexHull(points)
# faces is flat: [count, i0, ..., i{count-1}] per face, indexing into vertices.
# shrink > 0 moves every face inwards by that many metres; shrink_clamp > 0 caps it at
# shrink_clamp * (smallest face distance from the hull centre).
n_faces, vertices, faces = createConvexHull(points, shrink=0.1)
A shrink that cannot be applied (larger than the hull, unclamped) raises ConvexHullError
(a RuntimeError). An empty point set is not an error: it gives 0 faces.
Convex decomposition (V-HACD)¶
ConvexDecompositionVHACD splits a triangle mesh into convex hulls, for meshes too concave
for a single hull. ConvexDecomposition is its abstract base (no constructor).
from tesseract_robotics.collision import ConvexDecompositionVHACD, FillMode, VHACDParameters
params = VHACDParameters() # header defaults: 64 hulls, 400000 voxels, FLOOD_FILL
params.max_convex_hulls = 16
params.fill_mode = FillMode.SURFACE_ONLY
# vertices: list of 3-vectors; faces: flat int32 array of [3, i0, i1, i2] per triangle
vertices = [np.array(v) for v in ((0, 0, 0), (1, 0, 0), (0, 1, 0), (0, 0, 1))]
faces = np.array([3, 0, 2, 1, 3, 0, 1, 3, 3, 0, 3, 2, 3, 1, 2, 3], dtype=np.int32)
hulls = ConvexDecompositionVHACD(params).compute(vertices, faces, verbose=False) # list[ConvexMesh]
compute releases the GIL, so it can run in a worker thread. faces is checked first:
a face that is not a triangle raises NonTriangleFaceError, and a count running past the end
or an index outside vertices raises MalformedFacesError (both ValueError). Upstream reads
faces unchecked. verbose=True (the default, as upstream) prints the parameters and progress
to stdout.
Collision Evaluator Types¶
Used with trajectory optimization.
from tesseract_robotics.collision import CollisionEvaluatorType
CollisionEvaluatorType.DISCRETE # single config
CollisionEvaluatorType.LVS_DISCRETE # interpolated discrete
CollisionEvaluatorType.LVS_CONTINUOUS # swept volume
CollisionEvaluatorType.CONTINUOUS # continuous
Usage Example¶
from tesseract_robotics.collision import (
ContactRequest, ContactTestType, ContactResultMap, ContactResultVector
)
# Setup
manager = env.getDiscreteContactManager().clone()
request = ContactRequest()
request.type = ContactTestType.ALL
# Set state
env.setState({"joint_1": 0.0, "joint_2": 0.0})
state = env.getState()
manager.setCollisionObjectsTransform(state.link_transforms)
# Check collision
results = ContactResultMap()
manager.contactTest(results, request)
# Process results
if not results.empty():
contacts = ContactResultVector()
results.flattenMoveResults(contacts)
for c in contacts:
if c.distance < 0:
print(f"Penetration: {c.link_ids} depth={-c.distance:.4f}")
Reference¶
tesseract_collision Python bindings
ContinuousCollisionType
¶
Bases: Enum
ContactTestType
¶
CollisionEvaluatorType
¶
Bases: Enum
CollisionCheckProgramType
¶
Bases: Enum
ACMOverrideType
¶
CollisionCheckExitType
¶
ContactResult
¶
One contact between two links. Entry k of every two-slot field (link_ids, type_id, shape_id, subshape_id, nearest_points, nearest_points_local, transform, cc_time, cc_type, cc_transform) describes the same body, link_ids[k]; normal points from link_ids[0] towards link_ids[1].
Which body is slot 0 is chosen by the contact manager, not sorted: it is neither alphabetical nor the ContactResultMap key's first(), and it can change with insertion order, object names, the backend and the build. Resolve a body by link_ids, never by slot.
distance
property
writable
¶
Signed distance between nearest_points[0] and nearest_points[1], in m: negative when the links penetrate.
type_id
property
writable
¶
[k]: the type id (the mask id given to addCollisionObject) of link_ids[k].
link_ids
property
writable
¶
The two links in contact. Entry k of every two-slot field describes link_ids[k]. Which link is first is the contact manager's choice (see the class docstring); never rely on it.
shape_id
property
writable
¶
[k]: index of the shape of link_ids[k] in contact (a link can have several).
subshape_id
property
writable
¶
[k]: sub-shape of link_ids[k] in contact (mesh triangle, octree box); -1 for none.
nearest_points
property
writable
¶
[k]: the point of link_ids[k] nearest the other link, world frame, in m.
nearest_points_local
property
writable
¶
[k]: nearest_points[k] in the frame of link_ids[k] (transform[k] is its world pose), in m.
transform
property
writable
¶
[k]: world pose of link_ids[k] (for a cast, its start pose).
normal
property
writable
¶
Unit vector, world frame: points from link_ids[0] towards link_ids[1], the direction to move link_ids[1] to separate the links.
cc_time
property
writable
¶
[k]: where along its cast link_ids[k] is in contact, 0 at its start pose and 1 at its end pose; -1 when link_ids[k] was not cast.
cc_type
property
writable
¶
[k]: the ContinuousCollisionType of link_ids[k]; CCType_None when it was not cast.
cc_transform
property
writable
¶
[k]: world end pose of the cast of link_ids[k] (identity when it was not cast). The pose at contact interpolates transform[k] and cc_transform[k] at cc_time[k].
single_contact_point
property
writable
¶
True when the checker gave one contact point, so nearest_points[0] == nearest_points[1].
ContactArrays
¶
Every ContactResult of a ContactResultMap or ContactResultVector as arrays, from to_arrays().
n rows, row r for result r in the container's order. Each array owns its buffer (each read
returns a view of that buffer), independent of the results it was read from. A field
of the same name on ContactResult reads results[r].<field> as arrays.<field>[r];
link_ids becomes links plus link_index.
Slots: column k (axis 1) of every two-slot field describes link_ids[k], the same body
for every field of a row. Which body is slot 0 is chosen by the contact manager, not by
the binding (see ContactResult.link_ids); resolve a body by links[link_index[r, k]],
never by k. normal[r] points from slot 0 towards slot 1.
distance
property
¶
(n,) float64, m: signed distance between the two nearest points; negative when the bodies penetrate.
normal
property
¶
(n, 3) float64, world frame, unit vector: points from link slot 0 towards slot 1, the direction to move slot 1 to separate the pair.
nearest_points
property
¶
(n, 2, 3) float64, world frame, m: [r, k] is the point of link slot k nearest the other.
nearest_points_local
property
¶
(n, 2, 3) float64, m: nearest_points[r, k] in the frame of link slot k (transform[r, k] is that frame's world pose).
transform
property
¶
(n, 2, 4, 4) float64, homogeneous, translation in m: [r, k] is the world pose of link slot k (for a cast, its start pose).
type_id
property
¶
(n, 2) int32: [r, k] is the type id (the mask id given to addCollisionObject) of link slot k.
shape_id
property
¶
(n, 2) int32: [r, k] is the index of the shape of link slot k in contact.
subshape_id
property
¶
(n, 2) int32: [r, k] is the sub-shape (mesh triangle, octree box) of link slot k; -1 for none.
single_contact_point
property
¶
(n,) bool: True when the checker gave one contact point, so nearest_points[r, 0] == nearest_points[r, 1].
cc_time
property
¶
(n, 2) float64, dimensionless: [r, k] is where in its cast link slot k is in contact, 0 at its start pose, 1 at its end pose; -1 when slot k was not cast.
cc_type
property
¶
(n, 2) uint8: [r, k] is the ContinuousCollisionType value of link slot k (0 CCType_None, 1 CCType_Time0, 2 CCType_Time1, 3 CCType_Between); ContinuousCollisionType(int(v)) gives the enum.
cc_transform
property
¶
(n, 2, 4, 4) float64, homogeneous, translation in m: [r, k] is the world end pose of the cast of link slot k (identity when slot k was not cast).
link_index
property
¶
(n, 2) int32: links[link_index[r, k]] is link_ids[k] of result r.
links
property
¶
The distinct links of the results, in order of first appearance (row by row, slot 0 before slot 1). A new tuple per read.
ContactResultHeldError
¶
Bases: BufferError
A ContactResultVector call would reallocate or destroy its elements while Python holds a reference to one (x = v[i]).
ContactResultVector
¶
List of ContactResult. v[i] is a reference into the vector: v[i].distance = d writes through. While Python holds such a reference, append, clear and ContactResultMap.flattenMoveResults(v) raise ContactResultHeldError and leave v unchanged; delete the reference, or hold a copy (copy.copy(v[i])), first.
__getitem__
¶
Reference to the element at the index (write-through), kept valid by refusing reallocation while it is held.
append
¶
Append a copy of item; raises ContactResultHeldError while an element is held.
clear
¶
Remove every element; raises ContactResultHeldError while an element is held.
to_arrays
¶
Every result as one ContactArrays: row r of each array is result r.
Rows follow this container's order: ContactResultMap.flattenCopyResults() order for a map, element order for a vector. Each array is a new C-contiguous copy that owns its buffer: it stays valid after clear(), and writing to it does not change the results. For n results it costs one pass in C++ instead of one Python object per field read.
TransformCountMismatchError
¶
Bases: ValueError
setCollisionObjectsTransform(ids, transforms) got a different number of ids than (K, 4, 4) transforms.
EmptyContactResultsError
¶
Bases: ValueError
A ContactResultMap vector overload got an empty ContactResultVector.
ContactResultMap
¶
to_arrays
¶
Every result as one ContactArrays: row r of each array is result r.
Rows follow this container's order: ContactResultMap.flattenCopyResults() order for a map, element order for a vector. Each array is a new C-contiguous copy that owns its buffer: it stays valid after clear(), and writing to it does not change the results. For n results it costs one pass in C++ instead of one Python object per field read.
flattenMoveResults
¶
Move every result into results (cleared first); raises ContactResultHeldError, before moving anything, while an element of results is held.
at
¶
Copy of the results stored under key; raises KeyError when it is absent.
getContainer
¶
Copy of the underlying map, keyed by LinkIdPair.
__iter__
¶
Iterate over (key, ContactResultVector) pairs, like C++ begin()/end(); a dict iterates keys only. Keys kept by clear() are included with empty vectors.
filter
¶
Call fn(key, results) for every pair; what results holds when fn returns replaces the pair's results (clear it to drop them). results is a copy: one kept past the call no longer edits the map.
addInterpolatedCollisionResults
¶
addInterpolatedCollisionResults(sub_segment_results: ContactResultMap, sub_segment_index: int, sub_segment_last_index: int, active_link_ids: Set[LinkId | str], segment_dt: float, discrete: bool, filter: Callable[[LinkIdPair | tuple[str, str], ContactResultVector], None] | None = None) -> None
ContactTrajectorySubstepResults
¶
addContact
¶
addContact(substep_number: int, start_substate: Annotated[NDArray[float64], dict(shape=(None,), order=C)] | Sequence[float], end_substate: Annotated[NDArray[float64], dict(shape=(None,), order=C)] | Sequence[float], new_contacts: ContactResultMap) -> None
ContactTrajectoryStepResults
¶
addContact
¶
addContact(step_number: int, substep_number: int, num_substeps: int, start_state: Annotated[NDArray[float64], dict(shape=(None,), order=C)] | Sequence[float], end_state: Annotated[NDArray[float64], dict(shape=(None,), order=C)] | Sequence[float], start_substate: Annotated[NDArray[float64], dict(shape=(None,), order=C)] | Sequence[float], end_substate: Annotated[NDArray[float64], dict(shape=(None,), order=C)] | Sequence[float], contacts: ContactResultMap) -> None
ContactTrajectoryResults
¶
addContact
¶
addContact(step_number: int, substep_number: int, num_substeps: int, start_state: Annotated[NDArray[float64], dict(shape=(None,), order=C)] | Sequence[float], end_state: Annotated[NDArray[float64], dict(shape=(None,), order=C)] | Sequence[float], start_substate: Annotated[NDArray[float64], dict(shape=(None,), order=C)] | Sequence[float], end_substate: Annotated[NDArray[float64], dict(shape=(None,), order=C)] | Sequence[float], contacts: ContactResultMap) -> None
ContactResultValidator
¶
ContactRequest
¶
is_valid
property
writable
¶
Validator called on each contact; return False to reject it. None disables validation.
CollisionCheckConfig
¶
CollisionObjectSpec
¶
A single collision object's definition, for addCollisionObjects.
DiscreteContactManager
¶
getActiveCollisionObjects
¶
setDefaultCollisionMargin
¶
setCollisionMarginPair
¶
setCollisionMarginPair(name1: LinkId | str, name2: LinkId | str, collision_margin: float) -> None
setCollisionMarginData
¶
setCollisionMarginPairData
¶
setCollisionMarginPairData(pair_margin_data: CollisionMarginPairData, override_type: CollisionMarginPairOverrideType = tesseract_robotics.common.CollisionMarginPairOverrideType.REPLACE) -> None
setContactAllowedValidator
¶
getContactAllowedValidator
¶
getCollisionMarginData
¶
addCollisionObject
¶
addCollisionObject(name: LinkId | str, mask_id: int, shapes: Sequence[Geometry], shape_poses: Sequence[Isometry3d], enabled: bool = True) -> bool
getCollisionObjectGeometries
¶
getCollisionObjectGeometries(name: LinkId | str) -> list[tesseract_robotics.geometry.Geometry]
getCollisionObjectGeometriesTransforms
¶
getCollisionObjectGeometriesTransforms(name: LinkId | str) -> list[tesseract_robotics.common.Isometry3d]
clone
¶
An independent copy; it keeps this object alive (gh-72).
addCollisionObjects
¶
Add the objects in order, as repeated addCollisionObject calls; a repeated id: the last entry decides. False if any failed; the rest are still added.
removeCollisionObjects
¶
Remove the objects; False if any id was absent (the present ones are still removed).
getCollisionObjectsTransform
¶
The object's world transform; raises IndexError for an id the manager does not hold.
ContinuousContactManager
¶
addCollisionObject
¶
addCollisionObject(name: LinkId | str, mask_id: int, shapes: Sequence[Geometry], shape_poses: Sequence[Isometry3d], enabled: bool = True) -> bool
getCollisionObjectGeometries
¶
getCollisionObjectGeometries(name: LinkId | str) -> list[tesseract_robotics.geometry.Geometry]
getCollisionObjectGeometriesTransforms
¶
getCollisionObjectGeometriesTransforms(name: LinkId | str) -> list[tesseract_robotics.common.Isometry3d]
getActiveCollisionObjects
¶
setCollisionMarginData
¶
getCollisionMarginData
¶
setDefaultCollisionMargin
¶
setCollisionMarginPair
¶
setCollisionMarginPair(name1: LinkId | str, name2: LinkId | str, collision_margin: float) -> None
setCollisionMarginPairData
¶
setCollisionMarginPairData(pair_margin_data: CollisionMarginPairData, override_type: CollisionMarginPairOverrideType = tesseract_robotics.common.CollisionMarginPairOverrideType.REPLACE) -> None
setContactAllowedValidator
¶
getContactAllowedValidator
¶
clone
¶
An independent copy; it keeps this object alive (gh-72).
addCollisionObjects
¶
Add the objects in order, as repeated addCollisionObject calls; a repeated id: the last entry decides. False if any failed; the rest are still added.
removeCollisionObjects
¶
Remove the objects; False if any id was absent (the present ones are still removed).
getCollisionObjectsTransform
¶
The object's world transform; raises IndexError for an id the manager does not hold.
ImplicitSDFShape
¶
Callback representation of a signed-distance shape in world coordinates.
distance
property
writable
¶
Signed distance at a world point (negative inside)
gradient
property
writable
¶
gradient: Callable[[Annotated[NDArray[float64], dict(shape=3, order=C)]], Annotated[NDArray[float64], dict(shape=3, order=C)]]
Gradient of distance at a world point
aabb
property
writable
¶
aabb: tuple[Annotated[NDArray[float64], dict(shape=3, order=C)], Annotated[NDArray[float64], dict(shape=3, order=C)]]
World axis-aligned bounds of the region searched for contacts, as (min, max)
ImplicitSDFCollisionConfig
¶
Settings of the multi-start implicit SDF collision solver.
ContactManagersPluginFactory
¶
ConvexHullError
¶
Bases: RuntimeError
createConvexHull failed: Bullet could not apply the requested shrink.
MalformedFacesError
¶
Bases: ValueError
A faces array has a count running past its end or an index outside the vertices.
NonTriangleFaceError
¶
Bases: ValueError
ConvexDecomposition.compute got a face that is not a triangle (count != 3).
FillMode
¶
ConvexDecomposition
¶
compute
¶
compute(vertices: Sequence[Annotated[NDArray[float64], dict(shape=3, order=C)] | Sequence[float]], faces: Annotated[NDArray[int32], dict(shape=(None,), order=C)] | Sequence[int], verbose: bool = True) -> list[tesseract_robotics.geometry.ConvexMesh]
Split a triangle mesh into convex hulls. faces is a flat array of [3, i0, i1, i2] per triangle. Raises NonTriangleFaceError for any other count, MalformedFacesError for a count running past the end or an index outside vertices.
ConvexDecompositionVHACD
¶
Bases: ConvexDecomposition
collideImplicitSDF
¶
collideImplicitSDF(shape0: ImplicitSDFShape, shape1: ImplicitSDFShape, config: ImplicitSDFCollisionConfig = ...) -> list[ImplicitSDFContact]
Contacts between two implicit shapes, within config.contact_margin.
makeImplicitSDFShape
¶
World-coordinate implicit shape of a box, sphere, cylinder, cone, capsule or SDF geometry; an invalid shape (isValid() False) for other geometry. The shape's callables keep the geometry alive.
makeConvexMesh
¶
Create a ConvexMesh from a Mesh using bullet's convex hull algorithm.
createConvexHull
¶
createConvexHull(input: Sequence[Annotated[NDArray[float64], dict(shape=3, order=C)] | Sequence[float]], shrink: float = -1.0, shrink_clamp: float = -1.0) -> tuple[int, list[Annotated[NDArray[numpy.float64], dict(shape=3, order=C)]], Annotated[NDArray[numpy.int32], dict(shape=(None,), order=C)]]
Convex hull of a point set (Bullet). Returns (n_faces, vertices, faces); faces is a flat array of [count, i0, i1, ...] per face. shrink > 0 moves each face inwards by that amount; shrink_clamp > 0 caps it at shrink_clamp times the hull's inner radius. Raises ConvexHullError when the shrink cannot be applied.