ed.volume

Classes

Volume

Represents a volume of an entity

BoxVolume

Represents a box shaped volume

CompositeBoxVolume

Represents a composite box shaped volume

OffsetVolume

Represents a volume with a certain offset from the convex hull of the entity

Functions

volume_from_entity_volume_msg(msg)

Creates a dict mapping strings to Volumes from the EntityInfo data dictionary

volumes_from_entity_volumes_msg(msgs)

Module Contents

class ed.volume.Volume[source]

Bases: ed.util.equal_hash_mixin.EqualHashMixin

Represents a volume of an entity

Points are defined relative to the object they belong to

Constructor

property center_point: PyKDL.Vector

Get the center of the Volume

Return type:

PyKDL.Vector

abstract _calc_center_point()[source]
Return type:

PyKDL.Vector

abstract contains(point, padding=0)[source]

Checks if the point is inside this volume

Parameters:
  • point (PyKDL.Vector) – kdl Vector w.r.t. the same frame as this volume

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

Returns:

True if inside, False otherwise

Return type:

bool

property size: float
Return type:

float

abstract _calc_size()[source]
Return type:

float

class ed.volume.BoxVolume(min_corner, max_corner)[source]

Bases: Volume

Represents a box shaped volume

Constructor

Points are defined relative to the object they belong to

Parameters:
  • min_corner (PyKDL.Vector) – Vector with the minimum bounding box corner

  • max_corner (PyKDL.Vector) – Vector with the maximum bounding box corner

_min_corner
_max_corner
_calc_center_point()[source]

Calculate where the center of the box is located

>>> b = BoxVolume(kdl.Vector(0,0,0), kdl.Vector(1,1,1))
>>> b.center_point
[         0.5,         0.5,         0.5]
Return type:

PyKDL.Vector

_calc_size()[source]

Calculate the size of a volume

>>> BoxVolume(kdl.Vector(0, 0, 0), kdl.Vector(1, 1, 1)).size
1.0
>>> BoxVolume(kdl.Vector(0, 0, 0), kdl.Vector(10, 10, 0.1)).size
10.0
>>> BoxVolume(kdl.Vector(0, 0, 0), kdl.Vector(1, 1, 10)).size
10.0
Return type:

float

property min_corner: PyKDL.Vector
Return type:

PyKDL.Vector

property max_corner: PyKDL.Vector
Return type:

PyKDL.Vector

property bottom_area: List[PyKDL.Vector]
Return type:

List[PyKDL.Vector]

contains(point, padding=0)[source]

Checks if the point is inside this volume

>>> b = BoxVolume(kdl.Vector(0,0,0), kdl.Vector(1,1,1))
>>> b.contains(kdl.Vector(0.1, 0.1, 0.1))
True
>>> b.contains(kdl.Vector(0.1, 0.1, 0.1), padding=0.2)
True
>>> b.contains(kdl.Vector(0.1, 0.1, 0.1), padding=-0.2)
False
>>> b.contains(kdl.Vector(-0.1, -0.1, -0.1))
False
>>> b.contains(kdl.Vector(-0.1, -0.1, -0.1), padding=0.2)
True
>>> b.contains(kdl.Vector(-0.1, -0.1, -0.1), padding=-0.2)
False
Parameters:
  • point (PyKDL.Vector) – Vector w.r.t. the same frame as this volume

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

Returns:

True if inside, False otherwise

Return type:

bool

__repr__()[source]
class ed.volume.CompositeBoxVolume(boxes)[source]

Bases: Volume

Represents a composite box shaped volume

Constructor

Points are defined relative to the object they belong to.

Parameters:

boxes (Iterable[Tuple[PyKDL.Vector, PyKDL.Vector]]) – list of tuples of two vectors. First one with the minimum bounding box corners, second one with the maximum bounding box corners

_min_corners
_max_corners
_calc_center_point()[source]

Calculate where the center of the box is located

>>> b = CompositeBoxVolume([(kdl.Vector(0,0,0), kdl.Vector(1,1,1))])
>>> b.center_point
[         0.5,         0.5,         0.5]
Return type:

PyKDL.Vector

property min_corner: PyKDL.Vector
Return type:

PyKDL.Vector

property max_corner: PyKDL.Vector
Return type:

PyKDL.Vector

property bottom_area: List[PyKDL.Vector]
Return type:

List[PyKDL.Vector]

contains(point, padding=0)[source]

Checks if the point is inside this volume

>>> b = CompositeBoxVolume([(kdl.Vector(0,0,0), kdl.Vector(1,1,1))])
>>> b.contains(kdl.Vector(0.1, 0.1, 0.1))
True
>>> b.contains(kdl.Vector(0.1, 0.1, 0.1), padding=0.2)
True
>>> b.contains(kdl.Vector(0.1, 0.1, 0.1), padding=-0.2)
False
>>> b.contains(kdl.Vector(-0.1, -0.1, -0.1))
False
>>> b.contains(kdl.Vector(-0.1, -0.1, -0.1), padding=0.2)
True
>>> b.contains(kdl.Vector(-0.1, -0.1, -0.1), padding=-0.2)
False
Parameters:
  • point (PyKDL.Vector) – Vector w.r.t. the same frame as this volume

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

Returns:

True if inside, False otherwise

Return type:

bool

__repr__()[source]
class ed.volume.OffsetVolume(offset)[source]

Bases: Volume

Represents a volume with a certain offset from the convex hull of the entity

Constructor

Parameters:

offset – Offset [m]

_offset
__repr__()[source]
ed.volume.volume_from_entity_volume_msg(msg)[source]

Creates a dict mapping strings to Volumes from the EntityInfo data dictionary

Parameters:

msg (ed_msgs.msg.Volume) – ed_msgs.msg.Volume

Returns:

tuple of name and volume object

Return type:

Tuple[Optional[str], Optional[Volume]]

ed.volume.volumes_from_entity_volumes_msg(msgs)[source]
Parameters:

msgs (Iterable[ed_msgs.msg.Volume]) –

Return type:

Dict[str, Volume]