fcl

class mplib.collision_detection.fcl.BVHModel

Bases: CollisionGeometry

BVHModel collision geometry.

Inheriting from CollisionGeometry, this class specializes to a mesh geometry represented by a BVH tree.

__init__(self: mplib.pymp.collision_detection.fcl.BVHModel) None
property aabb_center
property aabb_radius
add_sub_model(*args, **kwargs)

Overloaded function.

  1. add_sub_model(self: mplib.pymp.collision_detection.fcl.BVHModel, vertices: list[numpy.ndarray[numpy.float64[3, 1]]]) -> int

Add a sub-model to the BVHModel.

Parameters:

vertices – vertices of the sub-model

  1. add_sub_model(self: mplib.pymp.collision_detection.fcl.BVHModel, vertices: list[numpy.ndarray[numpy.float64[3, 1]]], faces: list[mplib.pymp.collision_detection.fcl.Triangle]) -> int

Add a sub-model to the BVHModel.

Parameters:
  • vertices – vertices of the sub-model

  • faces – faces of the sub-model represented by a list of vertex indices

  1. add_sub_model(self: mplib.pymp.collision_detection.fcl.BVHModel, vertices: list[numpy.ndarray[numpy.float64[3, 1]]], faces: list[numpy.ndarray[numpy.int32[3, 1]]]) -> None

Add a sub-model to the BVHModel.

Parameters:
  • vertices – vertices of the sub-model

  • faces – faces of the sub-model represented by a list of vertex indices

begin_model(
self: mplib.pymp.collision_detection.fcl.BVHModel,
num_faces: int = 0,
num_vertices: int = 0,
) int

Begin to construct a BVHModel.

Parameters:
  • num_faces – number of faces of the mesh

  • num_vertices – number of vertices of the mesh

compute_com(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) numpy.ndarray[numpy.float64[3, 1]]
compute_local_aabb(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) None
compute_moment_of_inertia(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) numpy.ndarray[numpy.float64[3, 3]]
compute_volume(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) float
property cost_density
end_model(self: mplib.pymp.collision_detection.fcl.BVHModel) int

End the construction of a BVHModel.

get_faces(
self: mplib.pymp.collision_detection.fcl.BVHModel,
) list[mplib.pymp.collision_detection.fcl.Triangle]

Get the faces of the BVHModel.

Returns:

faces of the BVHModel

get_vertices(
self: mplib.pymp.collision_detection.fcl.BVHModel,
) list[numpy.ndarray[numpy.float64[3, 1]]]

Get the vertices of the BVHModel.

Returns:

vertices of the BVHModel

is_free(self: mplib.pymp.collision_detection.fcl.CollisionGeometry) bool
is_occupied(self: mplib.pymp.collision_detection.fcl.CollisionGeometry) bool
is_uncertain(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) bool
property num_faces
property num_vertices
class mplib.collision_detection.fcl.Box

Bases: CollisionGeometry

Box collision geometry.

Inheriting from CollisionGeometry, this class specializes to a box geometry.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: mplib.pymp.collision_detection.fcl.Box, side: numpy.ndarray[numpy.float64[3, 1]]) -> None

Construct a box with given side length.

Parameters:

side – side length of the box in an array [x, y, z]

  1. __init__(self: mplib.pymp.collision_detection.fcl.Box, x: float, y: float, z: float) -> None

Construct a box with given side length.

Parameters:
  • x – side length of the box in x direction

  • y – side length of the box in y direction

  • z – side length of the box in z direction

property aabb_center
property aabb_radius
compute_com(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) numpy.ndarray[numpy.float64[3, 1]]
compute_local_aabb(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) None
compute_moment_of_inertia(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) numpy.ndarray[numpy.float64[3, 3]]
compute_volume(self: mplib.pymp.collision_detection.fcl.CollisionGeometry) float
property cost_density
is_free(self: mplib.pymp.collision_detection.fcl.CollisionGeometry) bool
is_occupied(self: mplib.pymp.collision_detection.fcl.CollisionGeometry) bool
is_uncertain(self: mplib.pymp.collision_detection.fcl.CollisionGeometry) bool
property side
class mplib.collision_detection.fcl.Capsule

Bases: CollisionGeometry

Capsule collision geometry.

Inheriting from CollisionGeometry, this class specializes to a capsule geometry.

__init__(
self: mplib.pymp.collision_detection.fcl.Capsule,
radius: float,
lz: float,
) None

Construct a capsule with given radius and height.

Parameters:
  • radius – radius of the capsule

  • lz – height of the capsule along z axis

property aabb_center
property aabb_radius
compute_com(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) numpy.ndarray[numpy.float64[3, 1]]
compute_local_aabb(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) None
compute_moment_of_inertia(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) numpy.ndarray[numpy.float64[3, 3]]
compute_volume(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) float
property cost_density
is_free(self: mplib.pymp.collision_detection.fcl.CollisionGeometry) bool
is_occupied(self: mplib.pymp.collision_detection.fcl.CollisionGeometry) bool
is_uncertain(self: mplib.pymp.collision_detection.fcl.CollisionGeometry) bool
property lz
property radius
class mplib.collision_detection.fcl.CollisionGeometry

Bases: pybind11_object

Collision geometry base class.

This is an FCL class so you can refer to the FCL doc here. https://flexible-collision-library.github.io/d6/d5d/classfcl_1_1CollisionGeometry.html

__init__(*args, **kwargs)
property aabb_center
property aabb_radius
compute_com(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) numpy.ndarray[numpy.float64[3, 1]]
compute_local_aabb(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) None
compute_moment_of_inertia(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) numpy.ndarray[numpy.float64[3, 3]]
compute_volume(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) float
property cost_density
is_free(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) bool
is_occupied(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) bool
is_uncertain(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) bool
class mplib.collision_detection.fcl.CollisionObject

Bases: pybind11_object

Collision object class.

This class contains the collision geometry and the transformation of the geometry.

__init__(
self: mplib.pymp.collision_detection.fcl.CollisionObject,
collision_geometry: mplib.pymp.collision_detection.fcl.CollisionGeometry,
pose: mplib.pymp.Pose = Pose([0, 0, 0], [1, 0, 0, 0]),
) None

Construct a collision object with given collision geometry and transformation.

Parameters:
  • collision_geometry – collision geometry of the object

  • pose – pose of the object

get_collision_geometry(
self: mplib.pymp.collision_detection.fcl.CollisionObject,
) mplib.pymp.collision_detection.fcl.CollisionGeometry
get_pose(
self: mplib.pymp.collision_detection.fcl.CollisionObject,
) mplib.pymp.Pose

Gets the current pose of the collision object in world

Returns:

The current pose of the collision object

property pose

Pose of the collision object in world

set_pose(
self: mplib.pymp.collision_detection.fcl.CollisionObject,
pose: mplib.pymp.Pose,
) None

Sets the pose of the collision object in world

Parameters:

pose – New pose of the collision object

class mplib.collision_detection.fcl.CollisionRequest

Bases: pybind11_object

__init__(
self: mplib.pymp.collision_detection.fcl.CollisionRequest,
num_max_contacts: int = 1,
enable_contact: bool = False,
num_max_cost_sources: int = 1,
enable_cost: bool = False,
use_approximate_cost: bool = True,
gjk_solver_type: mplib.pymp.collision_detection.fcl.GJKSolverType = <GJKSolverType.GST_LIBCCD: 0>,
gjk_tolerance: float = 1e-06,
) None
is_satisfied(
self: mplib.pymp.collision_detection.fcl.CollisionRequest,
result: fcl::CollisionResult<double>,
) bool
class mplib.collision_detection.fcl.CollisionResult

Bases: pybind11_object

__init__(
self: mplib.pymp.collision_detection.fcl.CollisionResult,
) None
add_contact(
self: mplib.pymp.collision_detection.fcl.CollisionResult,
c: fcl::Contact<double>,
) None
add_cost_source(
self: mplib.pymp.collision_detection.fcl.CollisionResult,
c: fcl::CostSource<double>,
num_max_cost_sources: int,
) None
clear(self: mplib.pymp.collision_detection.fcl.CollisionResult) None
get_contact(
self: mplib.pymp.collision_detection.fcl.CollisionResult,
i: int,
) fcl::Contact<double>
get_contacts(
self: mplib.pymp.collision_detection.fcl.CollisionResult,
) list[fcl::Contact<double>]
get_cost_sources(
self: mplib.pymp.collision_detection.fcl.CollisionResult,
) list[fcl::CostSource<double>]
is_collision(
self: mplib.pymp.collision_detection.fcl.CollisionResult,
) bool
num_contacts(
self: mplib.pymp.collision_detection.fcl.CollisionResult,
) int
num_cost_sources(
self: mplib.pymp.collision_detection.fcl.CollisionResult,
) int
class mplib.collision_detection.fcl.Cone

Bases: CollisionGeometry

Cone collision geometry.

Inheriting from CollisionGeometry, this class specializes to a cone geometry.

__init__(
self: mplib.pymp.collision_detection.fcl.Cone,
radius: float,
lz: float,
) None

Construct a cone with given radius and height.

Parameters:
  • radius – radius of the cone

  • lz – height of the cone along z axis

property aabb_center
property aabb_radius
compute_com(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) numpy.ndarray[numpy.float64[3, 1]]
compute_local_aabb(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) None
compute_moment_of_inertia(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) numpy.ndarray[numpy.float64[3, 3]]
compute_volume(self: mplib.pymp.collision_detection.fcl.CollisionGeometry) float
property cost_density
is_free(self: mplib.pymp.collision_detection.fcl.CollisionGeometry) bool
is_occupied(self: mplib.pymp.collision_detection.fcl.CollisionGeometry) bool
is_uncertain(self: mplib.pymp.collision_detection.fcl.CollisionGeometry) bool
property lz
property radius
class mplib.collision_detection.fcl.Contact

Bases: pybind11_object

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: mplib.pymp.collision_detection.fcl.Contact) -> None

  2. __init__(self: mplib.pymp.collision_detection.fcl.Contact, o1: mplib.pymp.collision_detection.fcl.CollisionGeometry, o2: mplib.pymp.collision_detection.fcl.CollisionGeometry, b1: int, b2: int) -> None

  3. __init__(self: mplib.pymp.collision_detection.fcl.Contact, o1: mplib.pymp.collision_detection.fcl.CollisionGeometry, o2: mplib.pymp.collision_detection.fcl.CollisionGeometry, b1: int, b2: int, pos: numpy.ndarray[numpy.float64[3, 1]], normal: numpy.ndarray[numpy.float64[3, 1]], depth: float) -> None

property normal
property penetration_depth
property pos
class mplib.collision_detection.fcl.ContactPoint

Bases: pybind11_object

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: mplib.pymp.collision_detection.fcl.ContactPoint) -> None

  2. __init__(self: mplib.pymp.collision_detection.fcl.ContactPoint, normal: numpy.ndarray[numpy.float64[3, 1]], pos: numpy.ndarray[numpy.float64[3, 1]], penetration_depth: float) -> None

property normal
property penetration_depth
property pos
class mplib.collision_detection.fcl.Convex

Bases: CollisionGeometry

Convex collision geometry.

Inheriting from CollisionGeometry, this class specializes to a convex geometry.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: mplib.pymp.collision_detection.fcl.Convex, vertices: std::vector<Eigen::Matrix<double, 3, 1, 0, 3, 1>, std::allocator<Eigen::Matrix<double, 3, 1, 0, 3, 1> > >, num_faces: int, faces: std::vector<int, std::allocator<int> >, throw_if_invalid: bool = True) -> None

Construct a convex with given vertices and faces.

Parameters:
  • vertices – vertices of the convex

  • num_faces – number of faces of the convex

  • faces – faces of the convex geometry represented by a list of vertex indices

  • throw_if_invalid – if True, throw an exception if the convex is invalid

  1. __init__(self: mplib.pymp.collision_detection.fcl.Convex, vertices: numpy.ndarray[numpy.float64[m, 3]], faces: numpy.ndarray[numpy.int32[m, 3]], throw_if_invalid: bool = True) -> None

Construct a convex with given vertices and faces.

Parameters:
  • vertices – vertices of the convex

  • faces – faces of the convex geometry represented by a list of vertex indices

  • throw_if_invalid – if True, throw an exception if the convex is invalid

property aabb_center
property aabb_radius
compute_com(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) numpy.ndarray[numpy.float64[3, 1]]
compute_local_aabb(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) None
compute_moment_of_inertia(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) numpy.ndarray[numpy.float64[3, 3]]
compute_volume(self: mplib.pymp.collision_detection.fcl.Convex) float

Compute the volume of the convex.

Returns:

volume of the convex

property cost_density
get_face_count(self: mplib.pymp.collision_detection.fcl.Convex) int

Get the number of faces of the convex.

Returns:

number of faces of the convex

get_faces(self: mplib.pymp.collision_detection.fcl.Convex) list[int]

Get the faces of the convex.

Returns:

faces of the convex represented by a list of vertex indices

get_interior_point(
self: mplib.pymp.collision_detection.fcl.Convex,
) numpy.ndarray[numpy.float64[3, 1]]

Sample a random interior point of the convex geometry

Returns:

interior point of the convex

get_vertices(
self: mplib.pymp.collision_detection.fcl.Convex,
) list[numpy.ndarray[numpy.float64[3, 1]]]

Get the vertices of the convex.

Returns:

vertices of the convex

is_free(self: mplib.pymp.collision_detection.fcl.CollisionGeometry) bool
is_occupied(self: mplib.pymp.collision_detection.fcl.CollisionGeometry) bool
is_uncertain(self: mplib.pymp.collision_detection.fcl.CollisionGeometry) bool
class mplib.collision_detection.fcl.CostSource

Bases: pybind11_object

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: mplib.pymp.collision_detection.fcl.CostSource) -> None

  2. __init__(self: mplib.pymp.collision_detection.fcl.CostSource, aabb_min: numpy.ndarray[numpy.float64[3, 1]], aabb_max: numpy.ndarray[numpy.float64[3, 1]], cost_density: float) -> None

property aabb_max
property aabb_min
property cost_density
property total_cost
class mplib.collision_detection.fcl.Cylinder

Bases: CollisionGeometry

Cylinder collision geometry.

Inheriting from CollisionGeometry, this class specializes to a cylinder geometry.

__init__(
self: mplib.pymp.collision_detection.fcl.Cylinder,
radius: float,
lz: float,
) None

Construct a cylinder with given radius and height.

Parameters:
  • radius – radius of the cylinder

  • lz – height of the cylinder along z axis

property aabb_center
property aabb_radius
compute_com(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) numpy.ndarray[numpy.float64[3, 1]]
compute_local_aabb(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) None
compute_moment_of_inertia(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) numpy.ndarray[numpy.float64[3, 3]]
compute_volume(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) float
property cost_density
is_free(self: mplib.pymp.collision_detection.fcl.CollisionGeometry) bool
is_occupied(self: mplib.pymp.collision_detection.fcl.CollisionGeometry) bool
is_uncertain(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) bool
property lz
property radius
class mplib.collision_detection.fcl.DistanceRequest

Bases: pybind11_object

__init__(
self: mplib.pymp.collision_detection.fcl.DistanceRequest,
enable_nearest_points: bool = False,
enable_signed_distance: bool = False,
rel_err: float = 0.0,
abs_err: float = 0.0,
distance_tolerance: float = 1e-06,
gjk_solver_type: mplib.pymp.collision_detection.fcl.GJKSolverType = <GJKSolverType.GST_LIBCCD: 0>,
) None
is_satisfied(
self: mplib.pymp.collision_detection.fcl.DistanceRequest,
result: fcl::DistanceResult<double>,
) bool
class mplib.collision_detection.fcl.DistanceResult

Bases: pybind11_object

__init__(
self: mplib.pymp.collision_detection.fcl.DistanceResult,
min_distance: float = 1.7976931348623157e+308,
) None
clear(self: mplib.pymp.collision_detection.fcl.DistanceResult) None
property min_distance
property nearest_points
class mplib.collision_detection.fcl.Ellipsoid

Bases: CollisionGeometry

Ellipsoid collision geometry.

Inheriting from CollisionGeometry, this class specializes to a ellipsoid geometry.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: mplib.pymp.collision_detection.fcl.Ellipsoid, a: float, b: float, c: float) -> None

Construct a ellipsoid with given parameters.

Parameters:
  • a – length of the x semi-axis

  • b – length of the y semi-axis

  • c – length of the z semi-axis

  1. __init__(self: mplib.pymp.collision_detection.fcl.Ellipsoid, radii: numpy.ndarray[numpy.float64[3, 1]]) -> None

Construct a ellipsoid with given parameters.

Parameters:

radii – vector of the length of the x, y, and z semi-axes

property aabb_center
property aabb_radius
compute_com(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) numpy.ndarray[numpy.float64[3, 1]]
compute_local_aabb(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) None
compute_moment_of_inertia(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) numpy.ndarray[numpy.float64[3, 3]]
compute_volume(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) float
property cost_density
is_free(self: mplib.pymp.collision_detection.fcl.CollisionGeometry) bool
is_occupied(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) bool
is_uncertain(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) bool
property radii
class mplib.collision_detection.fcl.FCLModel

Bases: pybind11_object

FCL collision model of an articulation

See https://github.com/flexible-collision-library/fcl

__init__(
self: mplib.pymp.collision_detection.fcl.FCLModel,
urdf_filename: str,
*,
convex: bool = False,
verbose: bool = False,
) None

Construct an FCL model from URDF and SRDF files.

Parameters:
  • urdf_filename – path to URDF file, can be relative to the current working directory

  • convex – use convex decomposition for collision objects. Default: False.

  • verbose – print debug information. Default: False.

check_collision_with(*args, **kwargs)

Overloaded function.

  1. check_collision_with(self: mplib.pymp.collision_detection.fcl.FCLModel, other: mplib.pymp.collision_detection.fcl.FCLModel, request: mplib.pymp.collision_detection.fcl.CollisionRequest = <mplib.pymp.collision_detection.fcl.CollisionRequest object at 0x7f0b46adeef0>, *, acm: mplib.pymp.collision_detection.AllowedCollisionMatrix = <mplib.pymp.collision_detection.AllowedCollisionMatrix object at 0x7f0b4d1ef630>) -> list[mplib.pymp.collision_detection.WorldCollisionResult]

Check for collision in the current state with another FCLModel, ignoring the distances between links that are allowed to always collide (as specified by acm).

Parameters:
  • other – another FCLModel to check collision with

  • acm – allowed collision matrix.

  • request – collision request

Returns:

List of WorldCollisionResult objects. If empty, no collision.

  1. check_collision_with(self: mplib.pymp.collision_detection.fcl.FCLModel, object: mplib::collision_detection::fcl::FCLObject<double>, request: mplib.pymp.collision_detection.fcl.CollisionRequest = <mplib.pymp.collision_detection.fcl.CollisionRequest object at 0x7f0b46adf1b0>, *, acm: mplib.pymp.collision_detection.AllowedCollisionMatrix = <mplib.pymp.collision_detection.AllowedCollisionMatrix object at 0x7f0b46abf170>) -> list[mplib.pymp.collision_detection.WorldCollisionResult]

Check for collision in the current state with an FCLObject, ignoring the distances between objects that are allowed to always collide (as specified by acm).

Parameters:
  • object – an FCLObject to check collision with

  • acm – allowed collision matrix.

  • request – collision request

Returns:

List of WorldCollisionResult objects. If empty, no collision.

check_self_collision(
self: mplib.pymp.collision_detection.fcl.FCLModel,
request: mplib.pymp.collision_detection.fcl.CollisionRequest = <mplib.pymp.collision_detection.fcl.CollisionRequest object at 0x7f0b46aded70>,
*,
acm: mplib.pymp.collision_detection.AllowedCollisionMatrix = <mplib.pymp.collision_detection.AllowedCollisionMatrix object at 0x7f0b46aded30>,
) list[mplib.pymp.collision_detection.WorldCollisionResult]

Check for self-collision in the current state and returns all found collisions, ignoring the distances between links that are allowed to always collide (as specified by acm).

Parameters:
  • request – collision request

  • acm – allowed collision matrix.

Returns:

List of WorldCollisionResult objects. If empty, no self-collision.

static create_from_urdf_string(urdf_string: str, collision_links: list[mplib::collision_detection::fcl::FCLObject<double>], *, verbose: bool = False) mplib.pymp.collision_detection.fcl.FCLModel

Constructs a FCLModel from URDF string and collision links

Parameters:
  • urdf_string – URDF string (without visual/collision elements for links)

  • collision_links – Vector of collision links as FCLObjectPtr. Format is: [FCLObjectPtr, ...]. The collision objects are at the shape’s local_pose.

  • verbose – print debug information. Default: False.

Returns:

a unique_ptr to FCLModel

distance_self(
self: mplib.pymp.collision_detection.fcl.FCLModel,
request: mplib.pymp.collision_detection.fcl.DistanceRequest = <mplib.pymp.collision_detection.fcl.DistanceRequest object at 0x7f0b46adf3b0>,
*,
acm: mplib.pymp.collision_detection.AllowedCollisionMatrix = <mplib.pymp.collision_detection.AllowedCollisionMatrix object at 0x7f0b46adf370>,
) mplib.pymp.collision_detection.WorldDistanceResult

Get the minimum distance to self-collision given the robot in current state, ignoring the distances between links that are allowed to always collide (as specified by acm).

Parameters:
  • request – distance request.

  • acm – allowed collision matrix.

Returns:

a WorldDistanceResult object

distance_to_collision_with(*args, **kwargs)

Overloaded function.

  1. distance_to_collision_with(self: mplib.pymp.collision_detection.fcl.FCLModel, other: mplib.pymp.collision_detection.fcl.FCLModel, *, acm: mplib.pymp.collision_detection.AllowedCollisionMatrix = <mplib.pymp.collision_detection.AllowedCollisionMatrix object at 0x7f0b46adf570>) -> float

The minimum distance to collision with another FCLModel given the robot in current state, ignoring the distances between links that are allowed to always collide (as specified by acm).

Parameters:
  • other – another FCLModel to get minimum distance-to-collision with

  • acm – allowed collision matrix.

Returns:

minimum distance-to-collision with the other FCLModel

  1. distance_to_collision_with(self: mplib.pymp.collision_detection.fcl.FCLModel, object: mplib::collision_detection::fcl::FCLObject<double>, *, acm: mplib.pymp.collision_detection.AllowedCollisionMatrix = <mplib.pymp.collision_detection.AllowedCollisionMatrix object at 0x7f0b46adf7f0>) -> float

The minimum distance to collision with an FCLObject given the robot in current state, ignoring the distances between objects that are allowed to always collide (as specified by acm).

Parameters:
  • object – an FCLObject to get minimum distance-to-collision with

  • acm – allowed collision matrix.

Returns:

minimum distance-to-collision with the FCLObject

distance_to_self_collision(
self: mplib.pymp.collision_detection.fcl.FCLModel,
*,
acm: mplib.pymp.collision_detection.AllowedCollisionMatrix = <mplib.pymp.collision_detection.AllowedCollisionMatrix object at 0x7f0b46ad2170>,
) float

The minimum distance to self-collision given the robot in current state, ignoring the distances between links that are allowed to always collide (as specified by acm). Calls distanceSelf().

Parameters:

acm – allowed collision matrix.

Returns:

minimum distance-to-self-collision

distance_with(*args, **kwargs)

Overloaded function.

  1. distance_with(self: mplib.pymp.collision_detection.fcl.FCLModel, other: mplib.pymp.collision_detection.fcl.FCLModel, request: mplib.pymp.collision_detection.fcl.DistanceRequest = <mplib.pymp.collision_detection.fcl.DistanceRequest object at 0x7f0b473e1230>, *, acm: mplib.pymp.collision_detection.AllowedCollisionMatrix = <mplib.pymp.collision_detection.AllowedCollisionMatrix object at 0x7f0b46ad2470>) -> mplib.pymp.collision_detection.WorldDistanceResult

Get the minimum distance to collision with another FCLModel given the robot in current state, ignoring the distances between links that are allowed to always collide (as specified by acm).

Parameters:
  • other – another FCLModel to get minimum distance-to-collision with

  • request – distance request.

  • acm – allowed collision matrix.

Returns:

a WorldDistanceResult object

  1. distance_with(self: mplib.pymp.collision_detection.fcl.FCLModel, object: mplib::collision_detection::fcl::FCLObject<double>, request: mplib.pymp.collision_detection.fcl.DistanceRequest = <mplib.pymp.collision_detection.fcl.DistanceRequest object at 0x7f0b46adf930>, *, acm: mplib.pymp.collision_detection.AllowedCollisionMatrix = <mplib.pymp.collision_detection.AllowedCollisionMatrix object at 0x7f0b46adf8f0>) -> mplib.pymp.collision_detection.WorldDistanceResult

Get the minimum distance to collision with an FCLObject given the robot in current state, ignoring the distances between objects that are allowed to always collide (as specified by acm).

Parameters:
  • object – an FCLObject to get minimum distance-to-collision with

  • request – distance request.

  • acm – allowed collision matrix.

Returns:

a WorldDistanceResult object

get_collision_objects(
self: mplib.pymp.collision_detection.fcl.FCLModel,
) list[mplib::collision_detection::fcl::FCLObject<double>]

Get the collision objects of the FCL model.

Returns:

all collision objects of the FCL model

get_collision_pairs(
self: mplib.pymp.collision_detection.fcl.FCLModel,
) list[tuple[int, int]]

Get the collision pairs of the FCL model.

Returns:

collision pairs of the FCL model. If the FCL model has N collision objects, the collision pairs is a list of N*(N-1)/2 pairs minus the disabled collision pairs

get_name(self: mplib.pymp.collision_detection.fcl.FCLModel) str

Get name of the articulated model.

Returns:

name of the articulated model

is_state_colliding(
self: mplib.pymp.collision_detection.fcl.FCLModel,
*,
acm: mplib.pymp.collision_detection.AllowedCollisionMatrix = <mplib.pymp.collision_detection.AllowedCollisionMatrix object at 0x7f0b54383f70>,
) bool

Check if the current state is in self-collision, ignoring the distances between links that are allowed to always collide (as specified by acm).

Parameters:

acm – allowed collision matrix.

Returns:

True if any collision pair collides and False otherwise.

property name

Name of the fcl model

remove_collision_pairs_from_srdf(
self: mplib.pymp.collision_detection.fcl.FCLModel,
srdf_filename: str,
) None

Remove collision pairs from SRDF file.

Parameters:

srdf_filename – path to SRDF file, can be relative to the current working directory

Set the link order of the FCL model.

Parameters:

names – list of link names in the order that you want to set.

update_collision_objects(
self: mplib.pymp.collision_detection.fcl.FCLModel,
link_poses: list[mplib.pymp.Pose],
) None

Update the collision objects of the FCL model.

Parameters:

link_poses – list of link poses in the order of the link order

class mplib.collision_detection.fcl.FCLObject

Bases: pybind11_object

A general high-level object which consists of multiple FCLCollisionObjects. It is the top level data structure which is used in the collision checking process.

Mimicking MoveIt2’s collision_detection::FCLObject and collision_detection::World::Object

https://moveit.picknik.ai/main/api/html/structcollision__detection_1_1FCLObject.html https://moveit.picknik.ai/main/api/html/structcollision__detection_1_1World_1_1Object.html

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: mplib.pymp.collision_detection.fcl.FCLObject, name: str) -> None

Construct a new FCLObject with the given name

Parameters:

name – name of this FCLObject

  1. __init__(self: mplib.pymp.collision_detection.fcl.FCLObject, name: str, pose: mplib.pymp.Pose, shapes: list[mplib.pymp.collision_detection.fcl.CollisionObject], shape_poses: list[mplib.pymp.Pose]) -> None

Construct a new FCLObject with the given name and shapes

Parameters:
  • name – name of this FCLObject

  • pose – pose of this FCLObject. All shapes are relative to this pose

  • shapes – all collision shapes as a vector of fcl::CollisionObjectPtr

  • shape_poses – relative poses from this FCLObject to each collision shape

property name

Name of this FCLObject

property pose

Pose of this FCLObject. All shapes are relative to this pose

property shape_poses

Relative poses from this FCLObject to each collision shape

property shapes

All collision shapes (fcl::CollisionObjectPtr) making up this FCLObject

class mplib.collision_detection.fcl.GJKSolverType

Bases: pybind11_object

Members:

GST_LIBCCD

GST_INDEP

GST_INDEP = <GJKSolverType.GST_INDEP: 1>
GST_LIBCCD = <GJKSolverType.GST_LIBCCD: 0>
__init__(
self: mplib.pymp.collision_detection.fcl.GJKSolverType,
value: int,
) None
property name
property value
class mplib.collision_detection.fcl.Halfspace

Bases: CollisionGeometry

Infinite halfspace collision geometry.

Inheriting from CollisionGeometry, this class specializes to a halfspace geometry.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: mplib.pymp.collision_detection.fcl.Halfspace, n: numpy.ndarray[numpy.float64[3, 1]], d: float) -> None

Construct a halfspace with given normal direction and offset where n * p = d. Points in the negative side of the separation plane {p | n * p < d} are inside the half space (will have collision).

Parameters:
  • n – normal direction of the halfspace

  • d – offset of the halfspace

  1. __init__(self: mplib.pymp.collision_detection.fcl.Halfspace, a: float, b: float, c: float, d: float) -> None

Construct a halfspace with given halfspace parameters where ax + by + cz = d. Points in the negative side of the separation plane {(x, y, z) | ax + by + cz < d} are inside the half space (will have collision).

property aabb_center
property aabb_radius
compute_com(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) numpy.ndarray[numpy.float64[3, 1]]
compute_local_aabb(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) None
compute_moment_of_inertia(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) numpy.ndarray[numpy.float64[3, 3]]
compute_volume(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) float
property cost_density
property d
distance(
self: mplib.pymp.collision_detection.fcl.Halfspace,
p: numpy.ndarray[numpy.float64[3, 1]],
) float

Compute the distance of a point to the halfspace as abs(n * p - d).

Parameters:

p – a point in 3D space

Returns:

distance of the point to the halfspace

is_free(self: mplib.pymp.collision_detection.fcl.CollisionGeometry) bool
is_occupied(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) bool
is_uncertain(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) bool
property n
signed_distance(
self: mplib.pymp.collision_detection.fcl.Halfspace,
p: numpy.ndarray[numpy.float64[3, 1]],
) float

Compute the signed distance of a point to the halfspace as n * p - d.

Parameters:

p – a point in 3D space

Returns:

signed distance of the point to the halfspace

class mplib.collision_detection.fcl.OcTree

Bases: CollisionGeometry

OcTree collision geometry.

Inheriting from CollisionGeometry, this class specializes to a point cloud geometry represented by an OcTree.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: mplib.pymp.collision_detection.fcl.OcTree, resolution: float = 0.01) -> None

Construct an OcTree with given resolution.

Parameters:

resolution – resolution of the OcTree (smallest size of a voxel). You can treat this is as the diameter of a point. Default is 0.01.

  1. __init__(self: mplib.pymp.collision_detection.fcl.OcTree, vertices: numpy.ndarray[numpy.float64[m, 3]], resolution: float = 0.01) -> None

Construct an OcTree with given vertices and resolution.

Parameters:
  • vertices – vertices of the point cloud

  • resolution – resolution of the OcTree. Default is 0.01

property aabb_center
property aabb_radius
compute_com(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) numpy.ndarray[numpy.float64[3, 1]]
compute_local_aabb(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) None
compute_moment_of_inertia(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) numpy.ndarray[numpy.float64[3, 3]]
compute_volume(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) float
property cost_density
is_free(self: mplib.pymp.collision_detection.fcl.CollisionGeometry) bool
is_occupied(self: mplib.pymp.collision_detection.fcl.CollisionGeometry) bool
is_uncertain(self: mplib.pymp.collision_detection.fcl.CollisionGeometry) bool
class mplib.collision_detection.fcl.Plane

Bases: CollisionGeometry

Infinite plane collision geometry.

Inheriting from CollisionGeometry, this class specializes to a plane geometry.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: mplib.pymp.collision_detection.fcl.Plane, n: numpy.ndarray[numpy.float64[3, 1]], d: float) -> None

Construct a plane with given normal direction and offset where n * p = d.

Parameters:
  • n – normal direction of the plane

  • d – offset of the plane

  1. __init__(self: mplib.pymp.collision_detection.fcl.Plane, a: float, b: float, c: float, d: float) -> None

Construct a plane with given plane parameters where ax + by + cz = d.

property aabb_center
property aabb_radius
compute_com(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) numpy.ndarray[numpy.float64[3, 1]]
compute_local_aabb(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) None
compute_moment_of_inertia(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) numpy.ndarray[numpy.float64[3, 3]]
compute_volume(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) float
property cost_density
property d
distance(
self: mplib.pymp.collision_detection.fcl.Plane,
p: numpy.ndarray[numpy.float64[3, 1]],
) float

Compute the distance of a point to the plane as abs(n * p - d).

Parameters:

p – a point in 3D space

Returns:

distance of the point to the plane

is_free(self: mplib.pymp.collision_detection.fcl.CollisionGeometry) bool
is_occupied(self: mplib.pymp.collision_detection.fcl.CollisionGeometry) bool
is_uncertain(self: mplib.pymp.collision_detection.fcl.CollisionGeometry) bool
property n
signed_distance(
self: mplib.pymp.collision_detection.fcl.Plane,
p: numpy.ndarray[numpy.float64[3, 1]],
) float

Compute the signed distance of a point to the plane as n * p - d.

Parameters:

p – a point in 3D space

Returns:

signed distance of the point to the plane

class mplib.collision_detection.fcl.Sphere

Bases: CollisionGeometry

Sphere collision geometry.

Inheriting from CollisionGeometry, this class specializes to a sphere geometry.

__init__(self: mplib.pymp.collision_detection.fcl.Sphere, radius: float) None

Construct a sphere with given radius.

Parameters:

radius – radius of the sphere

property aabb_center
property aabb_radius
compute_com(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) numpy.ndarray[numpy.float64[3, 1]]
compute_local_aabb(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) None
compute_moment_of_inertia(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) numpy.ndarray[numpy.float64[3, 3]]
compute_volume(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) float
property cost_density
is_free(self: mplib.pymp.collision_detection.fcl.CollisionGeometry) bool
is_occupied(self: mplib.pymp.collision_detection.fcl.CollisionGeometry) bool
is_uncertain(self: mplib.pymp.collision_detection.fcl.CollisionGeometry) bool
property radius
class mplib.collision_detection.fcl.Triangle

Bases: pybind11_object

Triangle with 3 indices for points.

This is an FCL class so you can refer to the FCL doc here. https://flexible-collision-library.github.io/de/daa/classfcl_1_1Triangle.html

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: mplib.pymp.collision_detection.fcl.Triangle) -> None

  2. __init__(self: mplib.pymp.collision_detection.fcl.Triangle, p1: int, p2: int, p3: int) -> None

get(self: mplib.pymp.collision_detection.fcl.Triangle, arg0: int) int
set(
self: mplib.pymp.collision_detection.fcl.Triangle,
arg0: int,
arg1: int,
arg2: int,
) None
class mplib.collision_detection.fcl.TriangleP

Bases: CollisionGeometry

TriangleP collision geometry.

Inheriting from CollisionGeometry, this class specializes to a triangleP geometry.

__init__(
self: mplib.pymp.collision_detection.fcl.TriangleP,
a: numpy.ndarray[numpy.float64[3, 1]],
b: numpy.ndarray[numpy.float64[3, 1]],
c: numpy.ndarray[numpy.float64[3, 1]],
) None

Construct a set of triangles from vectors of point coordinates.

Parameters:
  • a – vector of point x coordinates

  • b – vector of point y coordinates

  • c – vector of point z coordinates

property a
property aabb_center
property aabb_radius
property b
property c
compute_com(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) numpy.ndarray[numpy.float64[3, 1]]
compute_local_aabb(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) None
compute_moment_of_inertia(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) numpy.ndarray[numpy.float64[3, 3]]
compute_volume(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) float
property cost_density
is_free(self: mplib.pymp.collision_detection.fcl.CollisionGeometry) bool
is_occupied(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) bool
is_uncertain(
self: mplib.pymp.collision_detection.fcl.CollisionGeometry,
) bool
mplib.collision_detection.fcl.collide(*args, **kwargs)

Overloaded function.

  1. collide(obj1: mplib.pymp.collision_detection.fcl.CollisionObject, obj2: mplib.pymp.collision_detection.fcl.CollisionObject, request: mplib.pymp.collision_detection.fcl.CollisionRequest = <mplib.pymp.collision_detection.fcl.CollisionRequest object at 0x7f0b46ade5b0>) -> mplib.pymp.collision_detection.fcl.CollisionResult

  2. collide(obj1: mplib.pymp.collision_detection.fcl.FCLObject, obj2: mplib.pymp.collision_detection.fcl.FCLObject, request: mplib.pymp.collision_detection.fcl.CollisionRequest = <mplib.pymp.collision_detection.fcl.CollisionRequest object at 0x7f0b46adc230>) -> mplib.pymp.collision_detection.fcl.CollisionResult

mplib.collision_detection.fcl.distance(*args, **kwargs)

Overloaded function.

  1. distance(obj1: mplib.pymp.collision_detection.fcl.CollisionObject, obj2: mplib.pymp.collision_detection.fcl.CollisionObject, request: mplib.pymp.collision_detection.fcl.DistanceRequest = <mplib.pymp.collision_detection.fcl.DistanceRequest object at 0x7f0b46ade730>) -> mplib.pymp.collision_detection.fcl.DistanceResult

  2. distance(obj1: mplib.pymp.collision_detection.fcl.FCLObject, obj2: mplib.pymp.collision_detection.fcl.FCLObject, request: mplib.pymp.collision_detection.fcl.DistanceRequest = <mplib.pymp.collision_detection.fcl.DistanceRequest object at 0x7f0b46ae8330>) -> mplib.pymp.collision_detection.fcl.DistanceResult

mplib.collision_detection.fcl.load_mesh_as_BVH(
mesh_path: str,
scale: numpy.ndarray[numpy.float64[3, 1]],
) mplib.pymp.collision_detection.fcl.BVHModel

Load a triangle mesh from mesh_path as a non-convex collision object.

Parameters:
  • mesh_path – path to the mesh

  • scale – mesh scale factor

Returns:

a shared_ptr to an fcl::BVHModel_OBBRSS<S> collision object

mplib.collision_detection.fcl.load_mesh_as_Convex(
mesh_path: str,
scale: numpy.ndarray[numpy.float64[3, 1]],
) mplib.pymp.collision_detection.fcl.Convex

Load a convex mesh from mesh_path.

Parameters:
  • mesh_path – path to the mesh

  • scale – mesh scale factor

Returns:

a shared_ptr to an fcl::Convex<S> collision object

Raises:

RuntimeError – if the mesh is not convex.