World Object¶
For clients to use the world object service
-
class
bosdyn.client.world_object.
WorldObjectClient
[source]¶ Bases:
bosdyn.client.common.BaseClient
Client for World Object service.
-
default_service_name
= 'world-objects'¶
-
service_type
= 'bosdyn.api.WorldObjectService'¶
-
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
RpcError – Problem communicating with the robot.
bosdyn.client.robot_command.NoTimeSyncError – Couldn’t convert the timestamp into robot time.
-
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
RpcError – Problem communicating with the robot.
bosdyn.client.robot_command.NoTimeSyncError – Couldn’t convert the timestamp into robot time.
-
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.