PyBulletClient

class compas_fab.backends.PyBulletClient(connection_type='gui', verbose=False)[source]

Bases: compas_fab.backends.pybullet.client.PyBulletBase, compas_fab.backends.interfaces.client.ClientInterface

Interface to use pybullet as backend.

compasfab.backends.PyBulletClient is a context manager type, so it’s best used in combination with the with statement to ensure resource deallocation.

Thanks to Yijiang Huang and his work in pybullet_planning for much inspiration.

Parameters
  • connection_type (str) – Sets the connection type. Defaults to 'gui'.

  • verbose (bool) – Use verbose logging. Defaults to False.

Examples

>>> from compas_fab.backends import PyBulletClient
>>> with PyBulletClient(connection_type='direct') as client:
...     print('Connected: %s' % client.is_connected)
Connected: True

Methods

__init__([connection_type, verbose])

Initialize self.

add_attached_collision_mesh(*args, **kwargs)

Forwards call to appropriate method in the planner.

add_collision_mesh(*args, **kwargs)

Forwards call to appropriate method in the planner.

append_collision_mesh(*args, **kwargs)

Forwards call to appropriate method in the planner.

body_from_obj(path[, scale, concavity, …])

Create a PyBullet body from an OBJ file.

cache_robot(robot)

Saves an editable copy of the robot’s model and its meshes for shadowing the state of the robot on the PyBullet server.

check_collision_objects_for_collision()

Checks whether any of the collision objects are colliding.

check_collision_with_objects(robot)

Checks whether the robot and its attached collision objects with its current configuration is is colliding with any collision objects.

check_collisions(robot[, configuration])

Checks whether the current or given configuration is in collision.

check_robot_self_collision(robot)

Checks whether the robot and its attached collision objects with its current configuration is colliding with itself.

connect([shadows, color, width, height])

Connect from the PyBullet server.

convert_mesh_to_body(mesh, frame[, _name, …])

Convert compas mesh and its frame to a pybullet body

disconnect()

Disconnect from the PyBullet server.

ensure_cached_robot(robot)

Checks if a compas_fab.robots.Robot has been cached for use with PyBullet.

ensure_cached_robot_geometry(robot)

Checks if the geometry of a compas_fab.robots.Robot has been cached for use with PyBullet.

filter_configurations_in_collision(robot, …)

Filters from a list of configurations those which are in collision.

forward_kinematics(*args, **kwargs)

Forwards call to appropriate method in the planner.

get_cached_robot(robot)

Returns the editable copy of the robot’s model for shadowing the state of the robot on the PyBullet server.

get_cached_robot_filepath(robot)

Returns the filepath of the editable copy of the robot’s model for shadowing the state of the robot on the PyBullet server.

get_planning_scene(*args, **kwargs)

Forwards call to appropriate method in the planner.

get_robot_configuration(robot)

Gets the robot’s current pose.

get_uid(cached_robot)

Returns the internal PyBullet id of the robot’s model for shadowing the state of the robot on the PyBullet server.

inverse_kinematics(*args, **kwargs)

Forwards call to appropriate method in the planner.

load_robot(urdf_file[, resource_loaders])

Create a pybullet robot using the input urdf file.

plan_cartesian_motion(*args, **kwargs)

Forwards call to appropriate method in the planner.

plan_motion(*args, **kwargs)

Forwards call to appropriate method in the planner.

reload_from_cache(robot)

Reloads the PyBullet server with the robot’s cached model.

remove_attached_collision_mesh(*args, **kwargs)

Forwards call to appropriate method in the planner.

remove_collision_mesh(*args, **kwargs)

Forwards call to appropriate method in the planner.

reset_planning_scene(*args, **kwargs)

Forwards call to appropriate method in the planner.

set_robot_configuration(robot, configuration)

Sets the robot’s pose to the given configuration.

step_simulation()

By default, the physics server will not step the simulation, unless you explicitly send a step_simulation command.

Attributes

is_connected

Indicates whether the client has an active connection.