robokudo.utils.annotation_conversion

This module provides conversion methods from Annotations to other types, such as ROS Message types. It’s mainly used to in the result generation to fill the query result from the available annotations, hence it requires a target ObjectDesignator to act on.

Attributes

T

S

Classes

Annotation2AnnotationConverter

An abstract converter class for converting annotations to other annotations.

Annotation2ODConverter

An abstract converter class for converting annotations to object designators.

PoseAnnotationToStampedPoseAnnotationConverter

Extended Annotation2AnnotationConverter that converts a PoseAnnotation to a StampedPoseAnnotation.

PositionAnnotationToStampedPoseAnnotationConverter

Extended Annotation2AnnotationConverter that converts a Positionnnotation to a StampedPoseAnnotation.

SemanticColor2ODConverter

Extended Annotation2AnnotationConverter that converts a SemanticColor annotation to ObjectDesignator data.

Classification2ODConverter

Extended Annotation2AnnotationConverter that converts a Classification annotation to ObjectDesignator data.

StampedPose2ODConverter

Extended Annotation2AnnotationConverter that converts a StampedPoseAnnotation to ObjectDesignator data.

Pose2ODConverter

Extended StampedPose2ODConverter that converts a PoseAnnotation to ObjectDesignator data.

Position2ODConverter

Extended Annotation2AnnotationConverter that converts a PositionAnnotation to ObjectDesignator data.

StampedPosition2ODConverter

Extended Annotation2AnnotationConverter that converts a StampedPositionAnnotation to ObjectDesignator data.

BoundingBox3DForShapeSizeConverter

Extended Annotation2AnnotationConverter that converts a robokudo.types.cv.BoundingBox3D to ObjectDesignator data.

Shape2ODConverter

Extended Annotation2AnnotationConverter that converts a Shape annotation to ObjectDesignator data.

Cuboid2ODConverter

Extended Shape2ODConverter that converts a Cuboid annotation to ObjectDesignator data.

Cylinder2ODConverter

Extended Shape2ODConverter that converts a Cylinder annotation to ObjectDesignator data.

Sphere2ODConverter

Extended Shape2ODConverter that converts a Sphere annotation to ObjectDesignator data.

Location2ODConverter

Extended Shape2ODConverter that converts a LocationAnnotation to ObjectDesignator data.

Module Contents

robokudo.utils.annotation_conversion.T
robokudo.utils.annotation_conversion.S
class robokudo.utils.annotation_conversion.Annotation2AnnotationConverter

Bases: abc.ABC, typing_extensions.Generic[T]

An abstract converter class for converting annotations to other annotations.

abstract can_convert(annotation: robokudo.types.core.Annotation, target_annotation_type: typing_extensions.Type) bool

Checks whether the converter can convert the given annotation to the given target annotation type.

Parameters:
  • annotation – The annotation to check for conversion.

  • target_annotation_type – The target annotation type to convert annotation to.

Returns:

Whether the converter can convert annotation to target_annotation_type.

abstract convert(annotation: T, cas: typing_extensions.Optional[robokudo.cas.CAS] = None) robokudo.types.core.Annotation

Converts the given annotation to the given target annotation type.

Use self.can_convert to check whether the converter is able to convert the given annotation to the desired type.

Parameters:
  • annotation – The annotation to convert.

  • cas – The CAS to use for conversion.

Returns:

The converted annotation.

class robokudo.utils.annotation_conversion.Annotation2ODConverter

Bases: abc.ABC, typing_extensions.Generic[T]

An abstract converter class for converting annotations to object designators.

abstract can_convert(annotation: robokudo.types.core.Annotation) bool

Checks whether the converter can convert the given annotation to an object designator.

Parameters:

annotation – The annotation to check for conversion.

Returns:

Whether the converter can convert annotation to ObjectDesignator.

abstract convert(annotation: T, cas: robokudo.cas.CAS, object_designator: robokudo_msgs.msg.ObjectDesignator) None

Converts the data of the given annotation to data in the given object designator. Modifies the object designator in-place.

Use self.can_convert to check whether the converter is able to convert the given annotation to an object designator.

Parameters:
  • annotation – The annotation to convert.

  • cas – The CAS to use for conversion.

  • object_designator – The object designator to fill with the data of annotation

class robokudo.utils.annotation_conversion.PoseAnnotationToStampedPoseAnnotationConverter

Bases: Annotation2AnnotationConverter[robokudo.types.annotation.PoseAnnotation]

Extended Annotation2AnnotationConverter that converts a PoseAnnotation to a StampedPoseAnnotation.

can_convert(annotation: robokudo.types.core.Annotation, target_annotation_type: typing_extensions.Type) bool
convert(annotation: robokudo.types.annotation.PoseAnnotation, cas: typing_extensions.Optional[robokudo.cas.CAS] = None) robokudo.types.annotation.StampedPoseAnnotation
class robokudo.utils.annotation_conversion.PositionAnnotationToStampedPoseAnnotationConverter

Bases: Annotation2AnnotationConverter[robokudo.types.annotation.PositionAnnotation]

Extended Annotation2AnnotationConverter that converts a Positionnnotation to a StampedPoseAnnotation.

can_convert(annotation: robokudo.types.core.Annotation, target_annotation_type: typing_extensions.Type) bool
convert(annotation: robokudo.types.annotation.PositionAnnotation, cas: typing_extensions.Optional[robokudo.cas.CAS] = None) robokudo.types.annotation.StampedPoseAnnotation
class robokudo.utils.annotation_conversion.SemanticColor2ODConverter

Bases: Annotation2ODConverter[robokudo.types.annotation.SemanticColor]

Extended Annotation2AnnotationConverter that converts a SemanticColor annotation to ObjectDesignator data.

can_convert(annotation: robokudo.types.core.Annotation) bool
convert(annotation: robokudo.types.annotation.SemanticColor, cas: robokudo.cas.CAS, object_designator: robokudo_msgs.msg.ObjectDesignator) None
class robokudo.utils.annotation_conversion.Classification2ODConverter

Bases: Annotation2ODConverter[robokudo.types.annotation.Classification]

Extended Annotation2AnnotationConverter that converts a Classification annotation to ObjectDesignator data.

can_convert(annotation: robokudo.types.core.Annotation) bool
convert(annotation: robokudo.types.annotation.Classification, cas: robokudo.cas.CAS, object_designator: robokudo_msgs.msg.ObjectDesignator) None
class robokudo.utils.annotation_conversion.StampedPose2ODConverter

Bases: Annotation2ODConverter[robokudo.types.annotation.StampedPoseAnnotation]

Extended Annotation2AnnotationConverter that converts a StampedPoseAnnotation to ObjectDesignator data.

can_convert(annotation: robokudo.types.core.Annotation) bool
convert(annotation: robokudo.types.annotation.StampedPoseAnnotation, cas: robokudo.cas.CAS, object_designator: robokudo_msgs.msg.ObjectDesignator) None
class robokudo.utils.annotation_conversion.Pose2ODConverter

Bases: Annotation2ODConverter[robokudo.types.annotation.PoseAnnotation]

Extended StampedPose2ODConverter that converts a PoseAnnotation to ObjectDesignator data.

pose_converter
stamped_pose_converter
can_convert(annotation: robokudo.types.core.Annotation) bool
convert(annotation: robokudo.types.annotation.PoseAnnotation, cas: robokudo.cas.CAS, object_designator: robokudo_msgs.msg.ObjectDesignator) None

Converts the data of the given annotation to data in the given object designator. Modifies the object designator in-place.

Use self.can_convert to check whether the converter is able to convert the given annotation to an object designator. Conversion requires a valid cam to world transform in the given CAS.

Parameters:
  • annotation – The annotation to convert.

  • cas – The CAS to use for conversion.

  • object_designator – The object designator to fill with the data of annotation

class robokudo.utils.annotation_conversion.Position2ODConverter

Bases: Annotation2ODConverter[robokudo.types.annotation.PositionAnnotation]

Extended Annotation2AnnotationConverter that converts a PositionAnnotation to ObjectDesignator data.

can_convert(annotation: robokudo.types.core.Annotation) bool
convert(annotation: robokudo.types.annotation.PositionAnnotation, cas: robokudo.cas.CAS, object_designator: robokudo_msgs.msg.ObjectDesignator) None

Converts the data of the given annotation to data in the given object designator. Modifies the object designator in-place.

Use self.can_convert to check whether the converter is able to convert the given annotation to an object designator. Conversion requires a valid cam to world transform in the given CAS.

Parameters:
  • annotation – The annotation to convert.

  • cas – The CAS to use for conversion.

  • object_designator – The object designator to fill with the data of annotation

class robokudo.utils.annotation_conversion.StampedPosition2ODConverter

Bases: Annotation2ODConverter[robokudo.types.annotation.StampedPositionAnnotation]

Extended Annotation2AnnotationConverter that converts a StampedPositionAnnotation to ObjectDesignator data.

can_convert(annotation: robokudo.types.core.Annotation) bool
convert(annotation: robokudo.types.annotation.StampedPositionAnnotation, cas: robokudo.cas.CAS, object_designator: robokudo_msgs.msg.ObjectDesignator) None

Converts the data of the given annotation to data in the given object designator. Modifies the object designator in-place.

Use self.can_convert to check whether the converter is able to convert the given annotation to an object designator. Conversion requires a valid cam to world transform in the given CAS.

Parameters:
  • annotation – The annotation to convert.

  • cas – The CAS to use for conversion.

  • object_designator – The object designator to fill with the data of annotation

class robokudo.utils.annotation_conversion.BoundingBox3DForShapeSizeConverter

Bases: Annotation2ODConverter[robokudo.types.cv.BoundingBox3D]

Extended Annotation2AnnotationConverter that converts a robokudo.types.cv.BoundingBox3D to ObjectDesignator data.

can_convert(annotation: robokudo.types.core.Annotation) bool
convert(annotation: robokudo.types.cv.BoundingBox3D, cas: robokudo.cas.CAS, object_designator: robokudo_msgs.msg.ObjectDesignator) None
class robokudo.utils.annotation_conversion.Shape2ODConverter

Bases: Annotation2ODConverter[robokudo.types.annotation.Shape]

Extended Annotation2AnnotationConverter that converts a Shape annotation to ObjectDesignator data.

can_convert(annotation: robokudo.types.core.Annotation) bool
convert(annotation: robokudo.types.annotation.Shape, cas: robokudo.cas.CAS, object_designator: robokudo_msgs.msg.ObjectDesignator) None
class robokudo.utils.annotation_conversion.Cuboid2ODConverter

Bases: Annotation2ODConverter[robokudo.types.annotation.Cuboid]

Extended Shape2ODConverter that converts a Cuboid annotation to ObjectDesignator data.

shape_converter
can_convert(annotation: robokudo.types.core.Annotation) bool
convert(annotation: robokudo.types.annotation.Cuboid, cas: robokudo.cas.CAS, object_designator: robokudo_msgs.msg.ObjectDesignator) None
class robokudo.utils.annotation_conversion.Cylinder2ODConverter

Bases: Annotation2ODConverter[robokudo.types.annotation.Cylinder]

Extended Shape2ODConverter that converts a Cylinder annotation to ObjectDesignator data.

shape_converter
can_convert(annotation: robokudo.types.core.Annotation) bool
convert(annotation: robokudo.types.annotation.Cylinder, cas: robokudo.cas.CAS, object_designator: robokudo_msgs.msg.ObjectDesignator) None
class robokudo.utils.annotation_conversion.Sphere2ODConverter

Bases: Annotation2ODConverter[robokudo.types.annotation.Sphere]

Extended Shape2ODConverter that converts a Sphere annotation to ObjectDesignator data.

shape_converter
can_convert(annotation: robokudo.types.core.Annotation) bool
convert(annotation: robokudo.types.annotation.Sphere, cas: robokudo.cas.CAS, object_designator: robokudo_msgs.msg.ObjectDesignator) None
class robokudo.utils.annotation_conversion.Location2ODConverter

Bases: Annotation2ODConverter[robokudo.types.annotation.LocationAnnotation]

Extended Shape2ODConverter that converts a LocationAnnotation to ObjectDesignator data.

can_convert(annotation: robokudo.types.core.Annotation) bool
convert(annotation: robokudo.types.annotation.LocationAnnotation, cas: robokudo.cas.CAS, object_designator: robokudo_msgs.msg.ObjectDesignator) None