roboglia.base.PVL

class PVL(p=nan, v=nan, ld=nan)[source]

Bases: object

A representation of a (position, value, load) command that supports nan value components and implements a number of help functions like addition, substraction, negation, equality (with error margin) and representation.

Parameters
  • p (float or nan) – The position value of the PVL

  • v (float or nan) – The velocity value of the PVL

  • ld (float or nan) – The load value of the PVL

__init__(p=nan, v=nan, ld=nan)[source]

Initialize self. See help(type(self)) for accurate signature.

property p

The position value in PVL.

property v

The velocity value in PVL.

property ld

The load value in PVL.

__eq__(other)[source]

Comparison of two PVLs with margin of error.

Compare components of PVL one to one. nan are the same if both are nan. Numbers are the same if the relative difference between them is less than 0.1% (to account for small rounding errors that might result from conversion of values from external to internal format).

Parameters

other (PVL) – The PVL to compare to

Returns

  • True – if all components match (are nan in the same place) or the differences are bellow the threshold

  • False – if there are differences on any component of the PVLs.

__sub__(other)[source]

Substracts other from a PVL (self - other).

Parameters

other (PVL or float or int or list of float or int with size 3) –

You can substract from a PVL:

  • another PVL

  • a number (float or int)

  • a list of 3 numbers (float or int)

Substracting nan with anything results in nan. Numbers are substracted normally.

Returns

The result as a PVL.

Return type

PVL

__add__(other)[source]

Addition to a PVL.

Parameters

other (PVL or float or int or list of float or int with size 3) –

You can add to a PVL:

  • another PVL

  • a number (float or int)

  • a list of 3 numbers (float or int)

Adding nan with anything results in nan. Numbers are added normally.

Returns

The result as a PVL.

Return type

PVL

__neg__()[source]

Returns the inverse of a PVL. nan values stay the same, floats are negated.

__repr__()[source]

Convenience representation of a PVL.