Env
- class Env.Client(cfg)[source]
Pybullet client, Provides some interfaces for interacting with simulation scenes
- __init__(cfg)[source]
Initialize a new PyBullet Client object.
- Parameters:
cfg (Config) – Configuration object with various settings for the simulation.
- get_client_id()[source]
Get the PyBullet client ID.
- Returns:
The PyBullet client ID.
- Return type:
int
- get_datapath()[source]
Get the path to the PyBullet data files.
- Returns:
The path to the PyBullet data files.
- Return type:
str
- disconnect()[source]
Disconnect from the PyBullet simulation. Save the recorder data if Blender is enabled.
- wait(x)[source]
Pause the execution for a given number of seconds.
- Parameters:
x (float) – Number of seconds to wait.
- run(x=1)[source]
Step the simulation for a given number of steps.
- Parameters:
x (int) – Number of simulation steps to run.
- load_object(obj_name, model_path, object_position=[0, 0, 0], object_orientation=[0, 0, 0], scale=1, fixed_base=False)[source]
Load a given object into the PyBullet simulation environment.
- Parameters:
obj_name (str) – The name of the object.
model_path (str) – The path to the URDF file for the object.
object_position (list) – The initial position of the object.
object_orientation (list) – The initial orientation of the object.
scale (float) – The scale of the object.
fixed_base (bool) – If True, the object is fixed in place.
- Returns:
The ID of the loaded object in the PyBullet simulation.
- Return type:
int
- create_scene(json_path)[source]
Import the complete environment from the environment file based on the basic environment.
- Parameters:
json_path (str) – Path to the scene JSON file.
- remove_object(object)[source]
Remove an object from the scene.
- Parameters:
object (int / str) – The ID or name of the object to remove.
- change_object_joint_angle(object, joint_index, target_position, max_force=5)[source]
Change the state of a specific joint of the object.
- Parameters:
object (int / str) – The ID or name of the object.
joint_index (int) – The index of the joint to be changed.
target_position (float) – The target position of the joint in radians.
max_force (float) – The maximum force to be applied to achieve the target position.
- get_object_id(object_name)[source]
Get the ID of an object by its name.
- Parameters:
object_name (str) – The name of the object.
- Returns:
The ID of the object.
- Return type:
int
- resolve_object_id(object)[source]
Resolve the object ID from either an ID or name.
- Parameters:
object (int / str) – The ID or name of the object.
- Returns:
The ID of the object.
- Return type:
int
- Raises:
AssertionError – If the object name does not exist or the input type is incorrect.
- print_object_joint_info(object)[source]
Print information about the links and joints of an object.
- Parameters:
object (int / str) – The ID or name of the object.
- get_object_pose(object)[source]
Retrieve the pose of a object.
- Parameters:
object (int / str) – The ID or name of the object.
- Returns:
The pose of the object.
- Return type:
- get_object_link_pose(object, link_id)[source]
Retrieve the pose of a given link of an object.
- Parameters:
object (int / str) – The ID or name of the object.
link_id (int) – The ID of the link.
- Returns:
The pose of the link.
- Return type:
- get_link_bounding_box(object, link_id)[source]
Retrieve the bounding box of a specific link of an object in the PyBullet simulation environment.
- Parameters:
object (int / str) – The ID or name of the object.
link_id (int) – The ID of the link.
- Returns:
The minimum and maximum x, y, z coordinates of the bounding box.
- Return type:
list
- get_bounding_box(object)[source]
Retrieve the bounding box of a given object in the PyBullet simulation environment.
- Parameters:
object (int / str) – The ID or name of the object.
- Returns:
The minimum and maximum x, y, z coordinates of the bounding box.
- Return type:
list
- get_all_link_bounding_box(object)[source]
Retrieve all bounding box of a given object in the PyBullet simulation environment.
- Parameters:
object (int / str) – The ID or name of the object.
- Returns:
The minimum and maximum x, y, z coordinates of the bounding box for all object link.
- Return type:
list