ed.entity

Classes

Entity

Holds all data concerning entities

PersonProperties

Container for several properties related to a person

Functions

from_entity_info(e)

Converts ed_msgs.msg.EntityInfo to an Entity

Module Contents

class ed.entity.Entity(identifier, object_type, frame_id, pose, shape, volumes, super_types, last_update_time, person_properties=None)[source]

Bases: ed.util.equal_hash_mixin.EqualHashMixin

Holds all data concerning entities

Constructor

Parameters:
  • identifier (str) – str with the id of this entity

  • object_type (str) – str with the type of this entity

  • frame_id (str) – str frame id w.r.t. which the pose is defined

  • pose (pykdl_ros.FrameStamped) – kdl.Frame with the pose of this entity

  • shape (ed.shape.Shape) – Shape of this entity

  • volumes (Mapping[str, ed.volume.Volume]) – dict mapping strings to Volume

  • super_types (List[str]) – list with strings representing super types in an ontology of object types

  • last_update_time (genpy.Time) – Time of last update

uuid
etype
frame_id
_pose
shape
_volumes
super_types
_last_update_time
_person_properties
property volumes
in_volume(point, volume_id, padding=0)[source]

Checks if the point is in the volume identified by the volume id

Parameters:
  • point (pykdl_ros.VectorStamped) – VectorStamped with the point to check

  • volume_id (str) – string with the volume

  • padding (float) – Padding to take into account. Positive values make the volume bigger, negative values smaller.

Returns:

boolean indicating whether the point is in the designated volume. If an error occurs, False is returned

Return type:

bool

entities_in_volume(entities, volume_id)[source]

Filter the collection of entities down to only those in the given volume

Parameters:
  • entities (List[Entity]) – collection/sequence of entities

  • volume_id (str) – volume these entities need to be in

Returns:

entities that are both in the given volume and in the list ‘entities’

Return type:

List[Entity]

property last_update_time
distance_to_2d(point)[source]

Calculate the distance between this entity’s pose and the given point.

Parameters:

point (PyKDL.Vector) – Assumed to be in the same frame_id as the entity itself

Returns:

the distance between the entity’s pose and the point

Return type:

float

>>> pose = kdl.Frame(kdl.Rotation.RPY(1, 0, 0), kdl.Vector(3, 3, 3))
>>> e = Entity("dummy", None, "map", pose, None, {}, None, rospy.Time())
>>> point = kdl.Vector(1, 1, 1)
>>> e.distance_to_2d(point)
2.8284271247461903
distance_to_3d(point)[source]

Calculate the distance between this entity’s pose and the given point.

Parameters:

point (PyKDL.Vector) – Assumed to be in the same frame_id as the entity itself

Returns:

the distance between the entity’s pose and the point

Return type:

PyKDL.Vector

>>> pose = kdl.Frame(kdl.Rotation.RPY(1, 0, 0), kdl.Vector(3, 3, 3))
>>> e = Entity("dummy", None, "map", pose, None, {}, None, rospy.Time())
>>> point = kdl.Vector(1, 1, 1)
>>> e.distance_to_3d(point)
3.4641016151377544
is_a(super_type)[source]

Check whether the entity is a (subclass of) some supertype

Parameters:

super_type (str) – Representing the name of the super_type

Returns:

True if the entity is a (sub)type of the given super_type

Return type:

bool

>>> e = Entity("dummy", "coffee_table", None, None, None, {}, ["coffee_table", "table", "furniture", "thing"], 0)
>>> e.is_a("furniture")
True
>>> e.is_a("food")
False
property pose: pykdl_ros.FrameStamped

Returns the pose of the Entity as a FrameStamped

Return type:

pykdl_ros.FrameStamped

property person_properties: PersonProperties | None
Return type:

Optional[PersonProperties]

__repr__()[source]
class ed.entity.PersonProperties(name, age, emotion, gender, gender_confidence, pointing_pose, posture, reliability, shirt_colors, tags, tagnames, velocity, parent_entity)[source]

Bases: object

Container for several properties related to a person

Parameters:
  • name (str) – the person’s name. This is separate from the entity, which is unique while this doesn’t have to be

  • age (int) – Estimated age of the person

  • emotion (str) – Indicating the emotion

  • gender (str) – Predicted gender of the person

  • gender_confidence (float) – Confidence of the classifier in the gender above.

  • pointing_pose – In which direction is the person pointing

  • posture (str) – String with a value like ‘sitting’, ‘laying’, ‘standing’ etc.

  • reliability – ToDO

  • shirt_colors (List[str]) – list of 3 shirt colors, sorted from most dominant to less dominant

  • tags – Other tags

  • tagnames – Other tagnames

  • velocity – Velocity with which the person in moving

  • parent_entity – The Entity that these properties belong to

_name
age
emotion
gender
gender_confidence
pointing_pose
posture
reliability
shirt_colors
tags
tagnames
velocity
_parent_entity
property name: str
Return type:

str

__repr__()[source]
ed.entity.from_entity_info(e)[source]

Converts ed_msgs.msg.EntityInfo to an Entity

Parameters:

e (ed_msgs.msg.EntityInfo) – ed_msgs.msg.EntityInfo

Returns:

Entity

Return type:

Entity