gymwipe.devices.core module

Core components for modelling physical devices

class Position(x, y, owner=None)[source]

Bases: object

A simple class for representing 2-dimensional positions, stored as two float values.

Parameters:
  • x (Union[float, int]) – The distance to a fixed origin in x direction, measured in meters
  • y (Union[float, int]) – The distance to a fixed origin in y direction, measured in meters
  • owner (Optional[Any]) – The object owning (having) the position.
nChange = None[source]

A notifier that is triggered when one or both of x and y is changed, providing the triggering position object.

Type:Notifier
x[source]

The distance to a fixed origin in x direction, measured in meters

Note

When setting both x and y, please use the set() method to trigger nChange only once.

Type:float
y[source]

The distance to a fixed origin in y direction, measured in meters

Note

When setting both x and y, please use the set() method to trigger nChange only once.

Type:float
set(x, y)[source]

Sets the x and the y value triggering the nChange notifier only once.

distanceTo(p)[source]

Returns the euclidean distance of this Position to p, measured in meters.

Parameters:p (Position) – The Position object to calculate the distance to
Return type:float
class Device(name, xPos, yPos)[source]

Bases: object

Represents a physical device that has a name and a position.

Parameters:
  • name (str) – The device name
  • xPos (float) – The device’s physical x position
  • yPos (float) – The device’s physical y position
name = None[source]

The device name (for debugging and plotting)

Type:str
position[source]

The device’s physical position

Type:Position