concepts.simulator.mplib.client.MPLibClient#

class MPLibClient[source]#

Bases: object

Methods

add_object(fcl_object)

adds an object to the world

check_for_collision(collision_function[, states])

Helper function to check for collision

check_for_env_collision([state])

Check if the robot is in collision with the environment

check_for_general_collision(name[, state])

Check if the robot is in collision with the environment

check_for_general_pair_collision(a, b[, state])

Check if the robot is in collision with the environment

check_for_self_collision([state])

Check if the robot is in self-collision.

get_articulation(name)

get_object(name)

get_robot(name)

has_articulation(name)

has_object(name[, allow_articulation])

remove_object(name)

returns true if the object was removed, false if it was not found

remove_point_cloud([name])

Removes the point cloud collision object with given name

set_object_pose(name, pos, quat)

set_qpos_context(qposes)

sync_object_states(pb_client)

update_point_cloud(points[, pos, quat, ...])

Adds a point cloud as a collision object with given name to world.

__init__(robots, objects=tuple(), verbose=False)[source]#
Parameters:
__new__(**kwargs)#
add_object(fcl_object)[source]#

adds an object to the world

check_for_collision(collision_function, states=None)[source]#

Helper function to check for collision

Parameters:
  • state – all planned articulations qpos state. If None, use current qpos.

  • states (dict[str, ndarray] | None)

Returns:

A list of collisions.

Return type:

list[mplib.collision_detection.WorldCollisionResult]

check_for_env_collision(state=None)[source]#

Check if the robot is in collision with the environment

Parameters:

state (dict[str, ndarray] | None) – all planned articulations qpos state. If None, use current qpos.

Returns:

A list of collisions.

Return type:

list[mplib.collision_detection.WorldCollisionResult]

check_for_general_collision(name, state=None)[source]#

Check if the robot is in collision with the environment

Parameters:
  • state (dict[str, ndarray] | None) – all planned articulations qpos state. If None, use current qpos.

  • name (str)

Returns:

A list of collisions.

Return type:

list[mplib.collision_detection.WorldCollisionResult]

check_for_general_pair_collision(a, b, state=None)[source]#

Check if the robot is in collision with the environment

Parameters:
  • state (dict[str, ndarray] | None) – all planned articulations qpos state. If None, use current qpos.

  • a (str)

  • b (str)

Returns:

A list of collisions.

Return type:

list[mplib.collision_detection.WorldCollisionResult]

check_for_self_collision(state=None)[source]#

Check if the robot is in self-collision.

Parameters:

state (dict[str, ndarray] | None) – all planned articulations qpos state. If None, use current qpos.

Returns:

A list of collisions.

Return type:

list[mplib.collision_detection.WorldCollisionResult]

get_articulation(name)[source]#
Parameters:

name (str)

Return type:

mplib.pymp.ArticulatedModel

get_object(name)[source]#
Parameters:

name (str)

Return type:

mplib.collision_detection.fcl.FCLObject

get_robot(name)[source]#
Parameters:

name (str)

Return type:

MPLibRobot

has_articulation(name)[source]#
Parameters:

name (str)

has_object(name, allow_articulation=True)[source]#
Parameters:
  • name (str)

  • allow_articulation (bool)

remove_object(name)[source]#

returns true if the object was removed, false if it was not found

Return type:

bool

remove_point_cloud(name='scene_pcd')[source]#

Removes the point cloud collision object with given name

Parameters:

name – name of the point cloud collision object

Returns:

True if success, False if the non-articulation object with given name does not exist

Return type:

bool

set_object_pose(name, pos, quat)[source]#
set_qpos_context(qposes)[source]#
Parameters:

qposes (dict[str, ndarray])

sync_object_states(pb_client)[source]#
update_point_cloud(points, pos=(0, 0, 0), quat=(0, 0, 0, 1), resolution=1e-3, name='scene_pcd')[source]#

Adds a point cloud as a collision object with given name to world. If the name is the same, the point cloud is simply updated.

Parameters:
  • points – points, numpy array of shape (n, 3)

  • resolution – resolution of the point OcTree

  • name – name of the point cloud collision object