Robot Simulator of the Robotics Group for Self-Organization of Control: Sensor Class Reference

# Sensor Class Reference

Abstract class for sensors that can be plugged into a robot. More...

`#include <sensor.h>`

Inherited by AxisOrientationSensor, CameraSensor, RelativePositionSensor, SoundSensor, SpeedSensor, and TorqueSensor.

List of all members.

## Public Types
enum | Dimensions { X = 1, Y = 2, Z = 4, XY = X | Y, XZ = X | Z, YZ = Y | Z, XYZ = X | Y | Z }
| defines which dimensions should be sensed. The meaning is sensor specific. More...
## Public Member Functions
| Sensor ()
virtual | ~Sensor ()
virtual void | init (Primitive *own)=0
| initialises sensor with body of robot.
virtual bool | sense (const GlobalData &globaldata)=0
| performs sense action
virtual int | getSensorNumber () const =0
| returns the number of sensors values produced by this sensor
virtual std::list< sensor > | get () const =0
| returns a list of sensor values (usually in the range [0,1] ) This function should be overloaded.
virtual void | update ()
| to update any visual appearance
virtual int | get (sensor *sensors, int length) const
| writes the sensor values (usually in the range [0,1] ) into the given sensor array and returns the number of sensors written.
## Static Public Member Functions
static std::list< sensor > | selectrows (const matrix::Matrix &m, short dimensions)
| selects the rows specified by dimensions (X->0, Y->1, Z->2)
static int | selectrows (sensor *sensors, int length, const matrix::Matrix &m, short dimensions)
| selects the rows specified by dimensions (X->0, Y->1, Z->2)

## Detailed Description

Abstract class for sensors that can be plugged into a robot.

## Member Enumeration Documentation

enum Dimensions

defines which dimensions should be sensed. The meaning is sensor specific.

Enumerator:

  X |
  Y |
  Z |
  XY |
  XZ |
  YZ |
  XYZ |

## Constructor & Destructor Documentation

Sensor | ( |  | ) | `[inline]`

virtual ~Sensor | ( |  | ) | `[inline, virtual]`

## Member Function Documentation

virtual int get | ( | sensor * | sensors,
|  | int | length |
| ) |  |  | const`[inline, virtual]`

writes the sensor values (usually in the range [0,1] ) into the given sensor array and returns the number of sensors written.

A default implementation based on get() is provided. Only of performance matters overwrite this function.

Parameters:

  | sensors | call by refernce array which received the values
  | length | capacity of sensors array

Returns:
  number of sensor values written

Reimplemented in AxisOrientationSensor, CameraSensor, DirectCameraSensor, PositionCameraSensor, OpticalFlow, RelativePositionSensor, SoundSensor, and SpeedSensor.

virtual std::list<sensor> get | ( |  | ) | const`[pure virtual]`

returns a list of sensor values (usually in the range [0,1] ) This function should be overloaded.

Implemented in AxisOrientationSensor, CameraSensor, RelativePositionSensor, SoundSensor, SpeedSensor, and TorqueSensor.

virtual int getSensorNumber | ( |  | ) | const`[pure virtual]`

returns the number of sensors values produced by this sensor

Implemented in AxisOrientationSensor, CameraSensor, DirectCameraSensor, PositionCameraSensor, OpticalFlow, RelativePositionSensor, SoundSensor, SpeedSensor, and TorqueSensor.

virtual void init | ( | Primitive * | own | ) | `[pure virtual]`

initialises sensor with body of robot.

This is usually done by the robot itself.

Implemented in AxisOrientationSensor, CameraSensor, RelativePositionSensor, SoundSensor, SpeedSensor, and TorqueSensor.

static int selectrows | ( | sensor * | sensors,
|  | int | length,
|  | const matrix::Matrix & | m,
|  | short | dimensions |
| ) |  |  | `[inline, static]`

selects the rows specified by dimensions (X->0, Y->1, Z->2)

static std::list<sensor> selectrows | ( | const matrix::Matrix & | m,
|  | short | dimensions |
| ) |  |  | `[inline, static]`

selects the rows specified by dimensions (X->0, Y->1, Z->2)

virtual bool sense | ( | const GlobalData & | globaldata | ) | `[pure virtual]`

performs sense action

Implemented in AxisOrientationSensor, CameraSensor, DirectCameraSensor, PositionCameraSensor, MotionCameraSensor, OpticalFlow, RelativePositionSensor, SoundSensor, SpeedSensor, and TorqueSensor.

virtual void update | ( |  | ) | `[inline, virtual]`

to update any visual appearance

Reimplemented in CameraSensor.

The documentation for this class was generated from the following file:

- sensor.h