robokudo.world

General methods to access the current World.

Reasoning about alternate world states is done in the corresponding Annotators.

Attributes

this

_rk_world_lock

Lock for safe creation of the central SemDT World and entity tracker.

_tracked_objects

Functions

get_world_entity_tracker(...)

Get the entity tracker instance of for the current world.

init_world_with_entity_tracker(...)

Initialize the world and entity tracker and return the entity tracker.

init_world_entity_tracker_from_world(...)

Initialize the entity tracker from the given world and return the entity tracker.

world_instance(→ semantic_digital_twin.world.World)

Return the world state for the currently running perception pipeline.

set_world(→ None)

Clear the world state safely by overwriting it with the given instance.

unsafe_set_world(→ None)

Unsafely set the world state without acquiring the lock.

clear_world(→ None)

Clear the world state by instantiating a new World.

unsafe_clear_world(→ None)

Unsafely clear the world state without acquiring the lock.

world_has_body_by_name(→ bool)

Check whether a body with a given name exists in the given world.

setup_world_for_camera_frame(→ None)

Set up the world and camera frames if they do not exist yet.

update_connection_transform(→ None)

Update the connection connecting from_name to to_name with the given transformation.

get_object_belief_states(...)

Get all object belief states as a map of UUID to belief state.

_get_world_body_from_cas(...)

Return the world-frame body referenced by the CAS, if available.

_create_world_origin_and_scale_from_latest_bbox(...)

Convert the latest camera-frame bbox into a world-frame SemDT origin and scale.

_update_belief_body_from_latest_bbox(→ None)

Update the SemDT body origin and box geometry from the latest bbox.

add_object_hypothesis_as_belief_state(...)

Create a new object belief from the given hypothesis and add it to the world.

update_belief_state_with_object_hypothesis(→ None)

Update the given object belief state with the object hypothesis.

get_object_belief_state(...)

Get an object belief state by UUID.

Module Contents

robokudo.world.this
robokudo.world._rk_world_lock

Lock for safe creation of the central SemDT World and entity tracker.

robokudo.world._tracked_objects: typing_extensions.Dict[uuid.UUID, robokudo.types.belief_state.ObjectBeliefState]
robokudo.world.get_world_entity_tracker() semantic_digital_twin.adapters.world_entity_kwargs_tracker.WorldEntityWithIDKwargsTracker

Get the entity tracker instance of for the current world.

Returns:

The current entity tracker instance.

robokudo.world.init_world_with_entity_tracker() semantic_digital_twin.adapters.world_entity_kwargs_tracker.WorldEntityWithIDKwargsTracker

Initialize the world and entity tracker and return the entity tracker.

Returns:

The newly created entity tracker instance.

robokudo.world.init_world_entity_tracker_from_world(world: semantic_digital_twin.world.World) semantic_digital_twin.adapters.world_entity_kwargs_tracker.WorldEntityWithIDKwargsTracker

Initialize the entity tracker from the given world and return the entity tracker.

Returns:

The newly created entity tracker instance.

robokudo.world.world_instance() semantic_digital_twin.world.World

Return the world state for the currently running perception pipeline.

This is NOT necessarily the belief state World based on the previous analysis results.

Returns:

A singleton-like World instance.

robokudo.world.set_world(world: semantic_digital_twin.world.World) None

Clear the world state safely by overwriting it with the given instance.

Parameters:

world – The new world state.

robokudo.world.unsafe_set_world(world: semantic_digital_twin.world.World) None

Unsafely set the world state without acquiring the lock.

Warning

Always acquire the lock manually before calling this method. Take a look at this.set_world() or this.init_world_with_entity_tracker() for example.

Parameters:

world – The new world state to set.

robokudo.world.clear_world() None

Clear the world state by instantiating a new World.

robokudo.world.unsafe_clear_world() None

Unsafely clear the world state without acquiring the lock.

Warning

Always acquire the lock manually before calling this method. Take a look at this.clear_world() or this.world_instance() for examples.

robokudo.world.world_has_body_by_name(world: semantic_digital_twin.world.World, body_name: str) bool

Check whether a body with a given name exists in the given world.

Parameters:
  • world – The world to check in.

  • body_name – The body name to search for.

Returns:

True if the body exists, False otherwise.

robokudo.world.setup_world_for_camera_frame(world_frame: str, camera_frame: str) None

Set up the world and camera frames if they do not exist yet.

Parameters:
  • world_frame – The name of the world frame.

  • camera_frame – The name of the camera frame.

robokudo.world.update_connection_transform(to_name: semantic_digital_twin.datastructures.prefixed_name.PrefixedName, from_name: semantic_digital_twin.datastructures.prefixed_name.PrefixedName, transform: semantic_digital_twin.spatial_types.spatial_types.HomogeneousTransformationMatrix) None

Update the connection connecting from_name to to_name with the given transformation.

Parameters:
  • to_name – The connection target name.

  • from_name – The connection source name.

  • transform – The transformation matrix.

robokudo.world.get_object_belief_states() typing_extensions.Dict[uuid.UUID, robokudo.types.belief_state.ObjectBeliefState]

Get all object belief states as a map of UUID to belief state.

Returns:

A map of all UUIDs to their object belief states.

robokudo.world._get_world_body_from_cas(cas: robokudo.cas.CAS, rk_world: semantic_digital_twin.world.World) semantic_digital_twin.world.Body | None

Return the world-frame body referenced by the CAS, if available.

robokudo.world._create_world_origin_and_scale_from_latest_bbox(object_belief: robokudo.types.belief_state.ObjectBeliefState, cas: robokudo.cas.CAS, world_body: semantic_digital_twin.world.Body) tuple[semantic_digital_twin.spatial_types.spatial_types.HomogeneousTransformationMatrix, semantic_digital_twin.world_description.geometry.Scale] | None

Convert the latest camera-frame bbox into a world-frame SemDT origin and scale.

robokudo.world._update_belief_body_from_latest_bbox(object_belief: robokudo.types.belief_state.ObjectBeliefState, cas: robokudo.cas.CAS, rk_world: semantic_digital_twin.world.World, world_body: semantic_digital_twin.world.Body, world_T_object_belief: semantic_digital_twin.world_description.connections.Connection6DoF, replace_existing_visuals: bool) None

Update the SemDT body origin and box geometry from the latest bbox.

robokudo.world.add_object_hypothesis_as_belief_state(object_hypothesis: robokudo.types.scene.ObjectHypothesis, cas: robokudo.cas.CAS) robokudo.types.belief_state.ObjectBeliefState

Create a new object belief from the given hypothesis and add it to the world.

Note

This currently assumes that all object hypotheses are rooted in the camera space.

Parameters:
  • object_hypothesis – The object hypothesis to create a belief from.

  • cas – The CAS to use for transform lookups.

Returns:

The new object belief.

robokudo.world.update_belief_state_with_object_hypothesis(object_belief: robokudo.types.belief_state.ObjectBeliefState, object_hypothesis: robokudo.types.scene.ObjectHypothesis, cas: robokudo.cas.CAS) None

Update the given object belief state with the object hypothesis.

Note

This currently assumes that all object hypotheses are rooted in the camera space.

Parameters:
  • object_belief – Object belief state to update.

  • object_hypothesis – Object hypothesis state to update the belief state with.

  • cas – The CAS to use for transform lookups.

robokudo.world.get_object_belief_state(uuid: uuid.UUID) robokudo.types.belief_state.ObjectBeliefState

Get an object belief state by UUID.

Parameters:

uuid – The UUID of the object.

Returns:

The object belief state corresponding to the given UUID.