semantic_digital_twin.world_description.world_entity#
Attributes#
Classes#
A class representing an entity in the world. |
|
An entity that is part of the kinematic structure of the world. |
|
Represents a body in the world. |
|
Virtual KinematicStructureEntity representing a semantic region in the world. |
|
Represents a semantic annotation on a set of bodies in the world. |
|
Represents a semantic annotation that is rooted in a specific KinematicStructureEntity. |
|
Represents a semantic annotation of the environment. |
|
Represents a connection between two entities in the world. |
Module Contents#
- semantic_digital_twin.world_description.world_entity.id_generator#
- class semantic_digital_twin.world_description.world_entity.WorldEntity#
Bases:
krrood.entity_query_language.predicate.SymbolA class representing an entity in the world.
- name: semantic_digital_twin.datastructures.prefixed_name.PrefixedName = None#
The identifier for this world entity.
- class semantic_digital_twin.world_description.world_entity.CollisionCheckingConfig#
- buffer_zone_distance: typing_extensions.Optional[float] = None#
Distance defining a buffer zone around the entity. The buffer zone represents a soft boundary where proximity should be monitored but minor violations are acceptable.
- violated_distance: float = 0.0#
Critical distance threshold that must not be violated. Any proximity below this threshold represents a severe collision risk requiring immediate attention.
- disabled: typing_extensions.Optional[bool] = None#
Flag to enable/disable collision checking for this entity. When True, all collision checks are ignored.
- max_avoided_bodies: int = 1#
Maximum number of other bodies this body should avoid simultaneously. If more bodies than this are in the buffer zone, only the closest ones are avoided.
- class semantic_digital_twin.world_description.world_entity.KinematicStructureEntity#
Bases:
WorldEntity,random_events.utils.SubclassJSONSerializer,abc.ABCAn entity that is part of the kinematic structure of the world.
- index: typing_extensions.Optional[int] = None#
The index of the entity in _world.kinematic_structure.
- property global_pose: semantic_digital_twin.spatial_types.spatial_types.TransformationMatrix#
Computes the pose of the KinematicStructureEntity in the world frame. :return: TransformationMatrix representing the global pose.
- property parent_connection: Connection#
Returns the parent connection of this KinematicStructureEntity.
- property child_kinematic_structure_entities: typing_extensions.List[KinematicStructureEntity]#
Returns the direct child KinematicStructureEntity of this entity.
- property parent_kinematic_structure_entity: KinematicStructureEntity#
Returns the parent KinematicStructureEntity of this entity.
- get_first_parent_connection_of_type(connection_type: typing_extensions.Type[GenericConnection]) GenericConnection#
Traverse the chain up until an active connection is found.
- class semantic_digital_twin.world_description.world_entity.Body#
Bases:
KinematicStructureEntity,random_events.utils.SubclassJSONSerializerRepresents a body in the world. A body is a semantic atom, meaning that it cannot be decomposed into meaningful smaller parts.
- visual: semantic_digital_twin.world_description.shape_collection.ShapeCollection#
List of shapes that represent the visual appearance of the link. The poses of the shapes are relative to the link.
- collision: semantic_digital_twin.world_description.shape_collection.ShapeCollection#
List of shapes that represent the collision geometry of the link. The poses of the shapes are relative to the link.
- collision_config: typing_extensions.Optional[CollisionCheckingConfig]#
Configuration for collision checking.
- temp_collision_config: typing_extensions.Optional[CollisionCheckingConfig] = None#
Temporary configuration for collision checking, takes priority over collision_config.
- index: typing_extensions.Optional[int] = None#
The index of the entity in _world.kinematic_structure.
- get_collision_config() CollisionCheckingConfig#
- set_static_collision_config(collision_config: CollisionCheckingConfig)#
- set_static_collision_distances(buffer_zone_distance: float, violated_distance: float)#
- set_temporary_collision_config(collision_config: CollisionCheckingConfig)#
- reset_temporary_collision_config()#
- has_collision(volume_threshold: float = 1.001e-06, surface_threshold: float = 0.00061) bool#
Check if collision geometry is mesh or simple shape with volume/surface bigger than thresholds.
- Parameters:
volume_threshold – Ignore simple geometry shapes with a volume less than this (in m^3)
surface_threshold – Ignore simple geometry shapes with a surface area less than this (in m^2)
- Returns:
True if collision geometry is mesh or simple shape exceeding thresholds
- compute_closest_points_multi(others: list[Body], sample_size=25) typing_extensions.Tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray]#
Computes the closest points to each given body respectively.
- Parameters:
others – The list of bodies to compute the closest points to.
sample_size – The number of samples to take from the surface of the other bodies.
- Returns:
A tuple containing: The points on the self body, the points on the other bodies, and the distances. All points are in the of this body.
- to_json() typing_extensions.Dict[str, typing_extensions.Any]#
- class semantic_digital_twin.world_description.world_entity.Region#
Bases:
KinematicStructureEntityVirtual KinematicStructureEntity representing a semantic region in the world.
- area: semantic_digital_twin.world_description.shape_collection.ShapeCollection#
The shapes that represent the area of the region.
- classmethod from_3d_points(name: semantic_digital_twin.datastructures.prefixed_name.PrefixedName, points_3d: typing_extensions.List[semantic_digital_twin.spatial_types.spatial_types.Point3], reference_frame: typing_extensions.Optional[Body] = None, minimum_thickness: float = 0.005, sv_ratio_tol: float = 1e-07) typing_extensions.Self#
Constructs a Region from a list of 3D points by creating a convex hull around them. The points are analyzed to determine if they are approximately planar. If they are, a minimum thickness is added to ensure the region has a non-zero volume.
- Parameters:
name – Prefixed name for the region.
points_3d – List of 3D points.
reference_frame – Optional reference frame.
minimum_thickness – Minimum thickness to add if points are near-planar.
sv_ratio_tol – Tolerance for determining planarity based on singular value ratio.
- Returns:
Region object.
- to_json() typing_extensions.Dict[str, typing_extensions.Any]#
- semantic_digital_twin.world_description.world_entity.GenericKinematicStructureEntity#
- class semantic_digital_twin.world_description.world_entity.SemanticAnnotation#
Bases:
WorldEntity,random_events.utils.SubclassJSONSerializerRepresents a semantic annotation on a set of bodies in the world.
This class can hold references to certain bodies that gain meaning in this context.
Warning
The hash of a semantic annotation is based on the hash of its type and kinematic structure entities. Overwrite this with extreme care and only if you know what you are doing. Hashes are used inside rules to check if a new semantic annotation has been created. If you, for instance, just use the object identity, this will fail since python assigns new memory pointers always. The same holds for the equality operator. If you do not want to change the behavior, make sure to use @dataclass(eq=False) to decorate your class.
- to_json() typing_extensions.Dict[str, typing_extensions.Any]#
- property kinematic_structure_entities: collections.abc.Iterable[KinematicStructureEntity]#
Returns a Iterable of all relevant KinematicStructureEntity in this semantic annotation. The default behaviour is to aggregate all KinematicStructureEntity that are accessible through the properties and fields of this semantic annotation, recursively. If this behaviour is not desired for a specific semantic annotation, it can be overridden by implementing the KinematicStructureEntity property.
- property bodies: collections.abc.Iterable[Body]#
Returns an Iterable of all relevant bodies in this semantic annotation. The default behaviour is to aggregate all bodies that are accessible through the properties and fields of this semantic annotation, recursively. If this behaviour is not desired for a specific semantic annotation, it can be overridden by implementing the bodies property.
- property regions: collections.abc.Iterable[Region]#
Returns an Iterable of all relevant regions in this semantic annotation. The default behaviour is to aggregate all regions that are accessible through the properties and fields of this semantic annotation, recursively. If this behaviour is not desired for a specific semantic annotation, it can be overridden by implementing the regions property.
- as_bounding_box_collection_at_origin(origin: semantic_digital_twin.spatial_types.spatial_types.TransformationMatrix) semantic_digital_twin.world_description.shape_collection.BoundingBoxCollection#
Returns a bounding box collection that contains the bounding boxes of all bodies in this semantic annotation. :param reference_frame: The reference frame to express the bounding boxes in. :returns: A collection of bounding boxes in world-space coordinates.
- as_bounding_box_collection_in_frame(reference_frame: KinematicStructureEntity) semantic_digital_twin.world_description.shape_collection.BoundingBoxCollection#
Provides the bounding box collection for this entity in the given reference frame. :param reference_frame: The reference frame to express the bounding boxes in. :returns: A collection of bounding boxes in world-space coordinates.
- class semantic_digital_twin.world_description.world_entity.RootedSemanticAnnotation#
Bases:
SemanticAnnotationRepresents a semantic annotation that is rooted in a specific KinematicStructureEntity.
- property connections: typing_extensions.List[Connection]#
- property bodies: typing_extensions.List[Body]#
Returns an Iterable of all relevant bodies in this semantic annotation. The default behaviour is to aggregate all bodies that are accessible through the properties and fields of this semantic annotation, recursively. If this behaviour is not desired for a specific semantic annotation, it can be overridden by implementing the bodies property.
- class semantic_digital_twin.world_description.world_entity.SemanticEnvironmentAnnotation#
Bases:
RootedSemanticAnnotationRepresents a semantic annotation of the environment.
- property kinematic_structure_entities: typing_extensions.Set[KinematicStructureEntity]#
Returns a set of all KinematicStructureEntity in the environment semantic annotation.
- class semantic_digital_twin.world_description.world_entity.Connection#
Bases:
WorldEntityRepresents a connection between two entities in the world.
- parent: KinematicStructureEntity#
The parent KinematicStructureEntity of the connection.
- child: KinematicStructureEntity#
The child KinematicStructureEntity of the connection.
- parent_T_connection_expression: semantic_digital_twin.spatial_types.spatial_types.TransformationMatrix#
- connection_T_child_expression: semantic_digital_twin.spatial_types.spatial_types.TransformationMatrix#
The origin expression of a connection is split into 2 transforms: 1. parent_T_connection describes the pose of the connection and is always constant.
It typically describes the fixed part of the origin expression, equivalent to the origin tag in urdf. For example, it is the point about which a revolute joint rotates.
connection_T_child describes the pose of the child relative to the connection. This typically contains only the expressions that describe how the degrees of freedom move the child. For example, it describes how the angle of a revolute joint affects the child pose.
This split is necessary for copying Connections, because they need parent_T_connection as an input parameter and connection_T_child is generated in the __post_init__ method.
- property origin_expression: semantic_digital_twin.spatial_types.spatial_types.TransformationMatrix#
- property has_hardware_interface: bool#
- add_to_world(world: semantic_digital_twin.world.World)#
- property origin: semantic_digital_twin.spatial_types.spatial_types.TransformationMatrix#
- Returns:
The relative transform between the parent and child frame.
- origin_as_position_quaternion() semantic_digital_twin.spatial_types.spatial_types.Expression#
- property dofs: typing_extensions.Set[semantic_digital_twin.world_description.degree_of_freedom.DegreeOfFreedom]#
Returns the degrees of freedom associated with this connection.
- semantic_digital_twin.world_description.world_entity.GenericConnection#