concepts.simulator.pybullet.world.BulletWorld#

class BulletWorld[source]#

Bases: object

Methods

change_dynamics(body_id, mass, lateral_friction)

change_visual_color(body_id, rgba[, link_id])

get_all_mesh_info(body_id)

Get the mesh filenames and transforms of all links of a body.

get_batched_qpos(names[, numpy])

get_batched_qpos_by_id(body_id, joint_ids[, ...])

get_body_index(body_name)

get_body_name(body_id)

get_body_state(body_name)

get_body_state_by_id(body_id)

get_collision_shape_data(body_name)

get_collision_shape_data_by_id(body_id)

get_constraint(constraint_id)

get_contact([a, b, update])

get_debug_camera()

get_free_joints(body_id)

Get a list of indices corresponding to all non-fixed joints in the body.

get_joint_info(joint_name)

get_joint_info_by_body(body_id)

get_joint_info_by_id(body_id, joint_id)

get_joint_state(joint_name)

get_joint_state_by_id(body_id, joint_id)

get_link_index(link_name)

get_link_index_with_body(body_id, link_name)

get_link_name(body_id, link_id)

get_link_state(link_name[, fk])

get_link_state_by_id(body_id, link_id[, fk])

get_mesh(body_id[, zero_center, verbose, ...])

Get the point cloud of a body.

get_mesh_box(*args, **kwargs)

get_mesh_info(body_id[, link_id])

Get the mesh filename and transform of a body or link.

get_mesh_mesh(*args, **kwargs)

get_pointcloud(body_id[, points_per_geom, ...])

Get the point cloud of a body.

get_pointcloud_box(*args, **kwargs)

get_pointcloud_mesh(*args, **kwargs)

get_qpos(name)

get_qpos_by_id(body_id, joint_id)

get_state(name[, type])

get_support_by_id(body_id[, return_name])

Get the bodies that are supporting the given body.

get_visual_shape_data(body_name)

get_visual_shape_data_by_id(body_id)

get_xmat(name[, type])

get_xpos(name[, type])

get_xquat(name[, type])

is_collision_free(a, b)

notify_update(body_id[, body_name, group])

perform_collision_detection()

refresh_names()

register_additional_state_saver(name, ...)

register_managed_interface(name, interface)

render_image(config[, image_size, ...])

save_bodies(body_identifiers)

save_body(body_identifier)

save_world()

save_world_builtin()

set_batched_qpos(names, qpos)

set_batched_qpos_by_id(body_index, ...)

set_body_state(body_name, state)

set_body_state2(body_name, position, orientation)

set_body_state2_by_id(body_id, position, ...)

set_body_state_by_id(body_id, state)

set_client_id(client_id)

set_debug_camera(distance, yaw, pitch, target)

set_joint_state(joint_name, state)

set_joint_state2(joint_name, position[, ...])

set_joint_state2_by_id(body_id, joint_id, ...)

set_joint_state_by_id(body_id, joint_id, state)

set_qpos(name, qpos)

set_qpos_by_id(body_id, joint_id, qpos)

transform_mesh(mesh, pos, quat_xyzw)

transform_mesh2(mesh, pos, quat_xyzw, ...)

transform_pcd(raw_pcd, pos, quat_xyzw)

unregister_additional_state_saver(name)

unregister_managed_interface(name)

update_contact()

Attributes

nr_bodies

nr_joints

nr_links

body_names

The mapping from body name to body index.

link_names

The mapping from link name to link index.

joint_names

The mapping from joint name to joint index.

global_names

The mapping from global name to global identifier.

body_base_link

The mapping from body name to base link name.

body_groups

The mapping from group name to body indices.

managed_interfaces

The mapping from identifiers to interface objects.

additional_state_savers

The mapping from identifiers to additional state savers.

__getitem__(item)[source]#
__init__(client_id=None)[source]#
__new__(**kwargs)#
change_dynamics(body_id, mass, lateral_friction, link_id=-1)[source]#
Parameters:
change_visual_color(body_id, rgba, link_id=None)[source]#
get_all_mesh_info(body_id)[source]#

Get the mesh filenames and transforms of all links of a body.

Parameters:

body_id (int)

Return type:

List[Tuple[str, float, ndarray, ndarray]]

get_batched_qpos(names, numpy=True)[source]#
get_batched_qpos_by_id(body_id, joint_ids, numpy=True)[source]#
get_body_index(body_name)[source]#
Parameters:

body_name (str | int)

Return type:

int

get_body_name(body_id)[source]#
Parameters:

body_id (int)

Return type:

str

get_body_state(body_name)[source]#
Parameters:

body_name (str)

Return type:

BodyState

get_body_state_by_id(body_id)[source]#
Parameters:

body_id (int)

Return type:

BodyState

get_collision_shape_data(body_name)[source]#
Parameters:

body_name (str)

Return type:

List[CollisionShapeData]

get_collision_shape_data_by_id(body_id)[source]#
Parameters:

body_id (int)

Return type:

List[CollisionShapeData]

get_constraint(constraint_id)[source]#
Parameters:

constraint_id (int)

Return type:

ConstraintInfo

get_contact(a=None, b=None, update=False)[source]#
Parameters:
Return type:

List[ContactInfo]

get_debug_camera()[source]#
Return type:

DebugCameraState

get_free_joints(body_id)[source]#

Get a list of indices corresponding to all non-fixed joints in the body.

Parameters:

body_id (int)

Return type:

List[int]

get_joint_info(joint_name)[source]#
Parameters:

joint_name (str)

Return type:

JointInfo

get_joint_info_by_body(body_id)[source]#
Parameters:

body_id (int)

Return type:

List[JointInfo]

get_joint_info_by_id(body_id, joint_id)[source]#
Parameters:
  • body_id (int)

  • joint_id (int)

Return type:

JointInfo

get_joint_state(joint_name)[source]#
Parameters:

joint_name (str)

Return type:

JointState

get_joint_state_by_id(body_id, joint_id)[source]#
Parameters:
  • body_id (int)

  • joint_id (int)

Return type:

JointState

Parameters:

link_name (str | LinkIdentifier | Tuple[int, int])

Return type:

LinkIdentifier

Parameters:
  • body_id (int)

  • link_name (str)

Return type:

int

Parameters:
Return type:

str

Parameters:

link_name (str)

Return type:

LinkState

Parameters:
Return type:

LinkState

get_mesh(body_id, zero_center=True, verbose=False, mesh_filename=None, mesh_scale=1.0)[source]#

Get the point cloud of a body.

Parameters:
  • body_id (int) – the ID of the body.

  • zero_center (bool) – whether to zero-center the mesh (i.e., move the center of the mesh to the origin).

  • verbose (bool) – whether to print debug information.

  • mesh_filename (str | None) – the filename of the mesh. This should be provided if the body has a mesh shape but we can’t get it from the collision shape data.

  • mesh_scale (float) – the scale of the mesh. This should be provided if the body has a mesh shape but we can’t get it from the collision shape data.

Return type:

TriangleMesh

get_mesh_box(*args, **kwargs)[source]#
Parameters:

self (BulletWorld)

get_mesh_info(body_id, link_id=-1)[source]#

Get the mesh filename and transform of a body or link.

Parameters:
Return type:

Tuple[str, float, ndarray, ndarray]

get_mesh_mesh(*args, **kwargs)[source]#
Parameters:

self (BulletWorld)

get_pointcloud(body_id, points_per_geom=1000, zero_center=True)[source]#

Get the point cloud of a body.

Parameters:
  • body_id (int)

  • points_per_geom (int)

  • zero_center (bool)

Return type:

ndarray

get_pointcloud_box(*args, **kwargs)[source]#
Parameters:

self (BulletWorld)

get_pointcloud_mesh(*args, **kwargs)[source]#
Parameters:

self (BulletWorld)

get_qpos(name)[source]#
get_qpos_by_id(body_id, joint_id)[source]#
get_state(name, type=None)[source]#
Parameters:
  • name (str)

  • type (str | None)

Return type:

BodyState | LinkState | JointState

get_support_by_id(body_id, return_name=True)[source]#

Get the bodies that are supporting the given body.

Parameters:
Return type:

List[str | int]

get_visual_shape_data(body_name)[source]#
Parameters:

body_name (str)

Return type:

List[VisualShapeData]

get_visual_shape_data_by_id(body_id)[source]#
Parameters:

body_id (int)

Return type:

List[VisualShapeData]

get_xmat(name, type=None)[source]#
get_xpos(name, type=None)[source]#
get_xquat(name, type=None)[source]#
is_collision_free(a, b)[source]#
Parameters:
Return type:

bool

notify_update(body_id, body_name=None, group=None)[source]#
perform_collision_detection()[source]#
refresh_names()[source]#
register_additional_state_saver(name, saver_factory)[source]#
Parameters:
register_managed_interface(name, interface)[source]#
Parameters:
render_image(config, image_size=None, normalize_depth=False)[source]#
Parameters:
Return type:

Tuple[ndarray, ndarray, ndarray]

save_bodies(body_identifiers)[source]#
Parameters:

body_identifiers (List[str | int])

Return type:

GroupSaver

save_body(body_identifier)[source]#
Parameters:

body_identifier (str | int)

Return type:

BodyFullStateSaver

save_world()[source]#
Return type:

WorldSaver

save_world_builtin()[source]#
Return type:

WorldSaverBuiltin

set_batched_qpos(names, qpos)[source]#
set_batched_qpos_by_id(body_index, joint_indices, qpos)[source]#
set_body_state(body_name, state)[source]#
Parameters:
set_body_state2(body_name, position, orientation)[source]#
Parameters:
set_body_state2_by_id(body_id, position, orientation)[source]#
Parameters:
set_body_state_by_id(body_id, state)[source]#
Parameters:
set_client_id(client_id)[source]#
set_debug_camera(distance, yaw, pitch, target)[source]#
Parameters:
set_joint_state(joint_name, state)[source]#
Parameters:
set_joint_state2(joint_name, position, velocity=0.0)[source]#
Parameters:
set_joint_state2_by_id(body_id, joint_id, position, velocity=0.0)[source]#
Parameters:
set_joint_state_by_id(body_id, joint_id, state)[source]#
Parameters:
set_qpos(name, qpos)[source]#
set_qpos_by_id(body_id, joint_id, qpos)[source]#
transform_mesh(mesh, pos, quat_xyzw)[source]#
Parameters:

mesh (TriangleMesh)

transform_mesh2(mesh, pos, quat_xyzw, current_pos, current_quat_xyzw)[source]#
Parameters:
transform_pcd(raw_pcd, pos, quat_xyzw)[source]#
unregister_additional_state_saver(name)[source]#
Parameters:

name (str)

unregister_managed_interface(name)[source]#
Parameters:

name (str)

update_contact()[source]#
additional_state_savers: Dict[str, Callable[[], BulletSaver]]#

The mapping from identifiers to additional state savers.

The mapping from body name to base link name.

body_groups: Dict[str, List[int]]#

The mapping from group name to body indices.

body_names: _NameToIdentifier#

The mapping from body name to body index.

global_names: _NameToIdentifier#

The mapping from global name to global identifier.

joint_names: _NameToIdentifier#

The mapping from joint name to joint index.

The mapping from link name to link index.

managed_interfaces: Dict[str, Any]#

The mapping from identifiers to interface objects.

property nr_bodies#
property nr_joints#