robokudo.io.semantic_digital_twin

Classes

Object

A wrapper around perception data that is used to store data used for object comparison.

TrackedObject

AddCollisionCommand

UpdateCollisionCommand

RemoveCollisionCommand

WorldDiff

Base class for protocol classes.

AddObjectDiff

UpdateObjectDiff

RemoveObjectDiff

SemanticDigitalTwinAdapter

Class to convert RoboKudo concepts to the SemanticWorld.

Module Contents

class robokudo.io.semantic_digital_twin.Object

A wrapper around perception data that is used to store data used for object comparison.

data: typing_extensions.Dict[str, typing_extensions.Any]

The actual data that is used for comparison.

__eq__(other: object) bool
class robokudo.io.semantic_digital_twin.TrackedObject
obj: Object

Object that stores relevant perception data for comparison with other objects.

body: semantic_digital_twin.world_description.world_entity.Body

Reference to the body representing the object in the world.

semantic_annotations: typing_extensions.List[semantic_digital_twin.world_description.world_entity.SemanticAnnotation]

References to semantic annotations attached to the bodies.

conns: typing_extensions.List[semantic_digital_twin.world_description.connections.Connection6DoF]

References to the connections used by the bodies.

uid: uuid.UUID

Unique identifier for the tracked object.

__eq__(other: object) bool
class robokudo.io.semantic_digital_twin.AddCollisionCommand(body: semantic_digital_twin.world_description.world_entity.Body, new_collision: semantic_digital_twin.world_description.geometry.Shape)

Bases: semantic_digital_twin.world_description.world_modification.WorldModification

body

The body to add the collision to.

new_collision

The collision to add to the body.

classmethod from_kwargs(kwargs: typing_extensions.Dict[str, typing_extensions.Any]) typing_extensions.Self
apply(world: semantic_digital_twin.world.World) None
undo(world: semantic_digital_twin.world.World) None
class robokudo.io.semantic_digital_twin.UpdateCollisionCommand(old_collision: semantic_digital_twin.world_description.geometry.Shape, new_collision: semantic_digital_twin.world_description.geometry.Shape)

Bases: semantic_digital_twin.world_description.world_modification.WorldModification

collision

The collision to update.

old_collision

A deep copy of the old collision for undo.

new_collision

The new collision to update to.

classmethod from_kwargs(kwargs: typing_extensions.Dict[str, typing_extensions.Any]) typing_extensions.Self
apply(world: semantic_digital_twin.world.World) None
undo(world: semantic_digital_twin.world.World) None
class robokudo.io.semantic_digital_twin.RemoveCollisionCommand(body: semantic_digital_twin.world_description.world_entity.Body, old_collision: semantic_digital_twin.world_description.geometry.Shape)

Bases: semantic_digital_twin.world_description.world_modification.WorldModification

body

The body to remove the collision from.

old_collision

The collision to remove from the body.

classmethod from_kwargs(kwargs: typing_extensions.Dict[str, typing_extensions.Any]) typing_extensions.Self
apply(world: semantic_digital_twin.world.World) None
undo(world: semantic_digital_twin.world.World) None
class robokudo.io.semantic_digital_twin.WorldDiff

Bases: typing_extensions.Protocol

Base class for protocol classes.

Protocol classes are defined as:

class Proto(Protocol):
    def meth(self) -> int:
        ...

Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing), for example:

class C:
    def meth(self) -> int:
        return 0

def func(x: Proto) -> int:
    return x.meth()

func(C())  # Passes static type check

See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as:

class GenProto(Protocol[T]):
    def meth(self) -> T:
        ...
apply() None

Apply the diff to the word stored in the adapter.

undo() None

Undo the diff in the world stored in the adapter.

class robokudo.io.semantic_digital_twin.AddObjectDiff(adapter: SemanticDigitalTwinAdapter, new_object: Object)
adapter

SemDT adapter instance that is used to store the diff.

new_object

The newly created object data.

tracked_object

A tracked object created from the newly created object data.

commands: typing_extensions.List[semantic_digital_twin.world_description.world_modification.WorldModification] = []

The commands to apply with this diff.

apply() None
undo() None
class robokudo.io.semantic_digital_twin.UpdateObjectDiff(adapter: SemanticDigitalTwinAdapter, old_object: TrackedObject, new_object: Object)
adapter

SemDT adapter instance used to store the diff.

old_tracked_object

The tracked object instance that will be updated.

old_object

A copy of the old object data that will be overwritten in the update.

new_object

The new object data that will be updated to.

new_tracked_object

The new object data as a tracked object for easier diff creation.

commands: typing_extensions.List[semantic_digital_twin.world_description.world_modification.WorldModification] = []

The commands to apply with this diff.

apply() None
undo() None
class robokudo.io.semantic_digital_twin.RemoveObjectDiff(adapter: SemanticDigitalTwinAdapter, old_object: TrackedObject)
adapter

The SemDT adapter instance used to store the diff.

old_object

The object to remove.

commands: typing_extensions.List[semantic_digital_twin.world_description.world_modification.WorldModification] = []

The commands to be executed by this diff.

apply() None
undo() None
class robokudo.io.semantic_digital_twin.SemanticDigitalTwinAdapter(cas_fn: typing_extensions.Callable[Ellipsis, robokudo.cas.CAS], urdf_path: typing_extensions.Optional[str] = None, semantic_annotation_sources: typing_extensions.Optional[typing_extensions.List] = None)

Class to convert RoboKudo concepts to the SemanticWorld.

world

World instance that will be modified by this adapter.

rk_logger = None

Logger instance for this adapter.

cas_fn

Callable that returns a cas instance when called.

tracked_objects: list[TrackedObject] = []

List of world objects currently tracked by the adapter.

comparators

Mapping of data keys to comparators that are used to compare objects.

semantic_color_to_rgb

Mapping of color names to actual color values used for visuals in created objects.

compute_diffs(new_objects: list[Object]) typing_extensions.List[WorldDiff]

Compute a list of diffs between the current tracked objects and the novel objects provided.

Parameters:

new_objects – List of new objects to compare to the current tracked objects.

Returns:

List of diffs between the current tracked objects and the novel objects provided.

compute_obj_diff(old_object: Object, new_object: Object) float

Compute similarity value between a known object and a novel object.

Parameters:
  • old_object – The known object to compare to.

  • new_object – The novel object to check for similarity with.

object_to_tracked_object(obj: Object) TrackedObject

Creates a TrackedObject from a RoboKudo object.

Parameters:

obj – Object to wrap into a TrackedObject.

Returns:

The object wrapped into a TrackedObject instance.

static class_to_semantic_annotation(class_name: str, **kwargs: typing_extensions.Any) semantic_digital_twin.world_description.world_entity.SemanticAnnotation

Convert a classification name to a SemanticWorld SemanticAnnotation.

Parameters:

class_name – Class to convert to a semantic annotation.

Returns:

SemanticAnnotation instance.

Raises:

ValueError – If there is no class name equivalent semantic annotation.

static apply_diffs(diffs: typing_extensions.List[WorldDiff]) None

Applies all the given diffs to the world stored in the adapter.

Parameters:

diffs – The diffs to apply to the world instance.