roboglia.base.SensorXYZ

class SensorXYZ(name='SENSOR-XYZ', device=None, x_read=None, x_inverse=False, x_offset=0.0, y_read=None, y_inverse=False, y_offset=0.0, z_read=None, z_inverse=False, z_offset=0.0, activate=None, auto=True, **kwargs)[source]

Bases: object

An XYZ sensor.

A sensor is associated with a device and has connections to 3 registers in that device that represents the X, Y and Z values the sensor is representing. In addition a sensor can have an optional register used to activate or deactivate the device and can publish X, Y and Z values that are floats where the sensor applies an inverse and and offset to the values read from the device registry.

Parameters
  • name (str) – The name of the sensor

  • device (BaseDevice or subclass) – The device associated with the sensor

  • x_read (str) – The name of the register in device used to retrieve the sensor’s value for x

  • x_inverse (bool) – Indicates if the value read from the x register should be inverted before being presented to the user in the x(). The inverse operation is performed before the x_offset (see below). Default is False.

  • x_offset (float) – Indicates an offest to be adder to the value read from the register x (after x_inverse if True). Default is 0.0.

  • y_read (str) – The name of the register in device used to retrieve the sensor’s value for y

  • y_inverse (bool) – Indicates if the value read from the y register should be inverted before being presented to the user in the y(). The inverse operation is performed before the y_offset (see below). Default is False.

  • y_offset (float) – Indicates an offest to be adder to the value read from the register y (after y_inverse if True). Default is 0.0.

  • z_read (str) – The name of the register in device used to retrieve the sensor’s value for z

  • z_inverse (bool) – Indicates if the value read from the x register should be inverted before being presented to the user in the z(). The inverse operation is performed before the z_offset (see below). Default is False.

  • z_offset (float) – Indicates an offest to be adder to the value read from the register z (after z_inverse if True). Default is 0.0.

  • activate (str or None) – The name of the register used to activate the device. If None is used no activation for the device can be done and the sensor is by default assumed to be activated.

  • auto (bool) – Indicates if the sensor should be automatically activated when the robot is started (:py:meth:roboglia.base.BaseRobot.`start` method). Default is True.

__init__(name='SENSOR-XYZ', device=None, x_read=None, x_inverse=False, x_offset=0.0, y_read=None, y_inverse=False, y_offset=0.0, z_read=None, z_inverse=False, z_offset=0.0, activate=None, auto=True, **kwargs)[source]

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

property name

The name of the sensor.

property device

The devices associated with the sensor.

property x_register

The register used to access the sensor X value.

property x_inverse

(read-only) Sensor uses inverse coordinates versus the device for X value.

property x_offset

(read-only) The offset between sensor coords and device coords for X value.

property y_register

The register used to access the sensor Y value.

property y_inverse

(read-only) Sensor uses inverse coordinates versus the device for Y value.

property y_offset

(read-only) The offset between sensor coords and device coords for Y value.

property z_register

The register used to access the sensor Z value.

property z_inverse

(read-only) Sensor uses inverse coordinates versus the device for Z value.

property z_offset

(read-only) The offset between sensor coords and device coords for Z value.

property activate_register

(read-only) The register for activation sensor.

property active

(read-write) Accessor for activating the senser. If the activation registry was not specified (None) the method will return True (assumes the sensors are active by default if not controllable.

The setter will log a warning if you try to assign a value to this property if there is no register assigned to it.

Returns

Value of the activate register or True if no register was specified when the sensor was created.

Return type

bool

property auto_activate

Indicates if the joint should automatically be activated when the robot starts.

property x

Returns the processed X value of register.

property y

Returns the processed Y value of register.

property z

Returns the processed Z value of register.

property value

Returns the value of the sensor as a tuple (X, Y, Z).