PlanningWorld#

class mplib.pymp.PlanningWorld#

Bases: pybind11_object

Planning world for collision checking

add_articulation(self: mplib.pymp.PlanningWorld, model: mplib.pymp.ArticulatedModel, name: str) None#

Add an articulated model to the planning world.

Parameters:
  • model – articulated model to be added

  • name – name of the articulated model

add_articulations(self: mplib.pymp.PlanningWorld, models: list[mplib.pymp.ArticulatedModel], names: list[str]) None#

Add a list of articulated models to the planning world.

Parameters:
  • models – list of articulated models to be added

  • names – list of names of the articulated models

collide(self: mplib.pymp.PlanningWorld, request: mplib.pymp.collision_detection.fcl.CollisionRequest = <mplib.pymp.collision_detection.fcl.CollisionRequest object at 0x7fee815e91b0>) bool#

Check collision in the planning world.

Parameters:

request – collision request params. Can leave empty for default value

Returns:

True if collision exists

collide_full(self: mplib.pymp.PlanningWorld, index: int = 0, request: mplib.pymp.collision_detection.fcl.CollisionRequest = <mplib.pymp.collision_detection.fcl.CollisionRequest object at 0x7fee8b96a8f0>) list[mplib.pymp.collision_detection.WorldCollisionResult]#

Check collision between the articulated model and all objects.

Parameters:
  • index – index of the articulated model

  • request – collision request params. Can leave empty for default value

Returns:

List of WorldCollisionResult objects

collide_with_others(self: mplib.pymp.PlanningWorld, index: int = 0, request: mplib.pymp.collision_detection.fcl.CollisionRequest = <mplib.pymp.collision_detection.fcl.CollisionRequest object at 0x7fee8b8a9430>) list[mplib.pymp.collision_detection.WorldCollisionResult]#

Check collision between the articulated model and other objects.

Parameters:
  • index – index of the articulated model

  • request – collision request params. Can leave empty for default value

Returns:

List of WorldCollisionResult objects

get_articulation_names(self: mplib.pymp.PlanningWorld) list[str]#

Get the names of articulated models.

Returns:

list of names of articulated models

get_articulations(self: mplib.pymp.PlanningWorld) list[mplib.pymp.ArticulatedModel]#

Get the list of articulated models.

Returns:

list of articulated models

get_normal_object_names(self: mplib.pymp.PlanningWorld) list[str]#

Get the names of non-articulated collision objects.

Returns:

list of names of non-articulated collision objects

get_normal_objects(self: mplib.pymp.PlanningWorld) list[mplib.pymp.collision_detection.fcl.CollisionObject]#

Get the list of non-articulated collision objects.

Returns:

list of non-articulated collision objects

print_attached_tool_pose(self: mplib.pymp.PlanningWorld) None#

Print the pose of the attached tool.

remove_attach(self: mplib.pymp.PlanningWorld) None#

Remove attach object so there won’t be anything on the end effector when use_attach is set to True again

remove_normal_object(self: mplib.pymp.PlanningWorld, name: str) bool#

Remove am non-articulated object

Parameters:

name – name of the non-articulated collision object

Returns:

True if the item exists and False otherwise

self_collide(self: mplib.pymp.PlanningWorld, index: int = 0, request: mplib.pymp.collision_detection.fcl.CollisionRequest = <mplib.pymp.collision_detection.fcl.CollisionRequest object at 0x7fee815e92f0>) list[mplib.pymp.collision_detection.WorldCollisionResult]#

Check collision between the articulated model and itself.

Parameters:
  • index – index of the articulated model

  • request – collision request params. Can leave empty for default value

Returns:

List of WorldCollisionResult objects

set_normal_object(self: mplib.pymp.PlanningWorld, collision_object: str, name: mplib.pymp.collision_detection.fcl.CollisionObject) None#

Add a non-articulated collision object to the planning world.

Parameters:
  • name – name of the non-articulated collision object

  • collision_object – the non-articulated collision object to be added

set_qpos(self: mplib.pymp.PlanningWorld, index: int, qpos: numpy.ndarray[numpy.float64[m, 1]]) None#

Set the joint qpos of the articulated model.

Parameters:
  • index – index of the articulated model

  • qpos – joint angles of the movegroup only

set_qpos_all(self: mplib.pymp.PlanningWorld, qpos: numpy.ndarray[numpy.float64[m, 1]]) None#

Set the joint qpos of all articulated models.

Parameters:

qpos – joint angles of all the models (movegroup only)

set_use_attach(self: mplib.pymp.PlanningWorld, use: bool) None#

Set whether to use attached tool for collision checking.

Parameters:

use – whether to use attached tool

set_use_point_cloud(self: mplib.pymp.PlanningWorld, use: bool) None#

Set whether to use point cloud for collision checking.

Parameters:

use – whether to use point cloud

update_attached_box(self: mplib.pymp.PlanningWorld, size: numpy.ndarray[numpy.float64[3, 1]], link_id: int, pose: numpy.ndarray[numpy.float64[7, 1]]) None#

Add a box as the attached tool.

Parameters:
  • size – size of the box, [size_x, size_y, size_z]

  • link_id – link id of the attached box

  • pose – pose of the attached box w.r.t. the link it’s attached to. [x, y, z, qw, qx, qy, qz]

update_attached_mesh(self: mplib.pymp.PlanningWorld, mesh_path: str, link_id: int, pose: numpy.ndarray[numpy.float64[7, 1]]) None#

Add a mesh as the attached tool.

Parameters:
  • mesh_path – path to the mesh file

  • link_id – link id of the attached mesh

  • pose – pose of the attached mesh w.r.t. the link it’s attached to. [x, y, z, qw, qx, qy, qz]

update_attached_sphere(self: mplib.pymp.PlanningWorld, radius: float, link_id: int, pose: numpy.ndarray[numpy.float64[7, 1]]) None#

Add a sphere as the attached tool.

Parameters:
  • radius – radius of the sphere

  • link_id – link id of the attached sphere

  • pose – pose of the attached sphere w.r.t. the link it’s attached to. [x, y, z, qw, qx, qy, qz]

update_attached_tool(self: mplib.pymp.PlanningWorld, p_geom: mplib.pymp.collision_detection.fcl.CollisionGeometry, link_id: int, pose: numpy.ndarray[numpy.float64[7, 1]]) None#

Attach or update the attached object

Parameters:
  • p_geom – fcl collision geometry of the attached tool

  • link_id – id of the link to which the object is attached

  • pose – pose of the attached object w.r.t. the link it’s attached to. [x, y, z, qw, qx, qy, qz]

update_point_cloud(self: mplib.pymp.PlanningWorld, vertices: numpy.ndarray[numpy.float64[m, 3]], radius: float) None#

Update the point cloud for collision checking.

Parameters:
  • vertices – vertices of the point cloud

  • radius – radius of each point in the point cloud

property use_attach#
property use_point_cloud#