World Object

For clients to use the world object service

class bosdyn.client.world_object.WorldObjectClient[source]

Bases: BaseClient

Client for World Object service.

default_service_name = 'world-objects'
service_type = 'bosdyn.api.WorldObjectService'
update_from(other)[source]

Adopt key objects like processors, logger, and wallet from other.

property timesync_endpoint

Accessor for timesync-endpoint that is grabbed via ‘update_from()’.

Raises:

bosdyn.client.robot_command.NoTimeSyncError – Could not find the timesync endpoint for the robot.

list_world_objects(object_type=None, time_start_point=None, **kwargs)[source]

Get a list of World Objects.

Parameters:
  • object_type (list of bosdyn.api.WorldObjectType) – Specific types to include in the response, all other types will be filtered out.

  • time_start_point (float) – A client timestamp to filter objects in the response. All objects will have a timestamp after this time.

Returns:

The response message, which includes the filtered list of all world objects.

Raises:
list_world_objects_async(object_type=None, time_start_point=None, **kwargs)[source]

Async version of list_world_objects().

mutate_world_objects(mutation_req, **kwargs)[source]

Mutate (add, change, delete) world objects.

Parameters:

mutation_req (world_object_pb2.MutateWorldObjectRequest) – The request including the object to be mutated and the type of mutation.

Returns:

The response, which includes the id of the mutated object.

Raises:
mutate_world_objects_async(mutation_req, **kwargs)[source]

Async version of mutate_world_objects().

draw_sphere(name, x_rt_frame_name, y_rt_frame_name, z_rt_frame_name, frame_name, radius=0.05, rgba=(255, 0, 0, 1), list_objects_now=True)[source]

Create a drawable sphere world object that will be sent to the world object service with a mutation request.

Parameters:
  • name (string) – The human-readable name of the world object.

  • x_rt_frame_name (int) – The coordinate position (x,y,z) of the drawable sphere.

  • y_rt_frame_name (int) – The coordinate position (x,y,z) of the drawable sphere.

  • z_rt_frame_name (int) – The coordinate position (x,y,z) of the drawable sphere.

  • frame_name (string) – the frame in which the sphere’s position is described.

  • radius (float) – The radius for the drawn sphere.

  • rgba (4 valued tuple) – The RGBA color, where RGB are int values in [0,255] and A is a float in [0,1].

  • list_objects_now (boolean) – Should the ListWorldObjects request be made after creating the sphere world object.

Returns:

The MutateWorldObjectResponse for the addition of the sphere world object.

draw_oriented_bounding_box(name, drawable_box_frame_name, frame_name, frame_name_tform_drawable_box, size_ewrt_box_vec3, rgba=(255, 0, 0, 1), wireframe=True, list_objects_now=False)[source]

Create a drawable 3D box world object that will be sent to the world object service with a mutation request.

Parameters:
  • name (string) – The human-readable name of the world object.

  • drawable_box_frame_name (string) – The frame name for the drawable box frame.

  • frame_name (string) – The frame name which the drawable box is described relative to.

  • frame_name_tform_drawable_box (geometry_pb2.SE3Pose) – the SE3 pose of the drawable box relative to frame name.

  • size_ewrt_box_vec3 (float) – The size of the box (x,y,z) expressed with respect to the drawable box frame.

  • rgba (4 valued tuple) – The RGBA color, where RGB are int values in [0,255] and A is a float in [0,1].

  • wireframe (boolean) – Should this be drawn as a wireframe [wireframe=true] or a solid object [wireframe=false].

  • list_objects_now (boolean) – Should the ListWorldObjects request be made after creating the sphere world object.

Returns:

The MutateWorldObjectResponse for the addition of the sphere world object.

bosdyn.client.world_object.make_add_world_object_req(world_obj)[source]

Add a world object to the scene.

Parameters:

world_obj (WorldObject) – The world object to be added into the robot’s perception scene.

Returns:

A MutateWorldObjectRequest where the action is to “add” the object to the scene.

bosdyn.client.world_object.make_delete_world_object_req(world_obj)[source]

Delete a world object from the scene.

Parameters:

world_obj (WorldObject) – The world object to be deleted in the robot’s perception scene. The object must be a client-added object and have the correct world object id returned by the service after adding the object.

Returns:

A MutateWorldObjectRequest where the action is to “delete” the object to the scene.

bosdyn.client.world_object.make_change_world_object_req(world_obj)[source]

Change/update an existing world object in the scene.

Parameters:

world_obj (WorldObject) – The world object to be changed/updated in the robot’s perception scene. The object must be a client-added object and have the correct world object id returned by the service after adding the object.

Returns:

A MutateWorldObjectRequest where the action is to “change” the object to the scene.

bosdyn.client.world_object.send_add_mutation_requests(world_object_client, world_object_array)[source]

Create and send an “add” mutation request for each world object in an array. Return a matching array of the object id’s that are assigned when the object is created, so that each object we add can be identified and removed individually (if desired) later.

Parameters:
  • world_object_client (WorldObjectClient) – Client for World Object service.

  • world_object_array (List) – List of objects to add.

Returns:

A List containing the object ids associated with the objects created.

bosdyn.client.world_object.send_delete_mutation_requests(world_object_client, delete_object_id_array)[source]

Create and send a “delete” mutation request for each world object successfully identified from a given list of object id’s.

Parameters:
  • world_object_client (WorldObjectClient) – Client for World Object service.

  • delete_object_id_array (List) – List of object id’s to send delete requests for.