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

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages
- Examples

- Search for |

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# IRSensor Class Reference

Class for IR sensors. More...

`#include <irsensor.h>`

Inherits RaySensor.

Inheritance diagram for IRSensor:

[legend]
Collaboration diagram for IRSensor:

[legend]
List of all members.

## Public Member Functions
| IRSensor (float exponent=1, double size=0.05)
virtual | ~IRSensor ()
virtual void | init (const OdeHandle &odeHandle, const OsgHandle &osgHandle, Primitive *body, const osg::Matrix pose, float range, rayDrawMode drawMode=drawSensor)
virtual void | reset ()
| used for reseting the sensor value to a value of maximal distance.
virtual double | get ()
| returns the sensor value in the range [0,1]; 0 means nothing no object in the sensor distance range 1 means contact with another object
virtual void | update ()
| updates the position of the osg nodes
virtual void | setRange (float range)
| set the range of the sensor
virtual void | setLength (float len)
virtual RaySensor * | clone () const
double | getExponent () const
| returns the exponent of the sensor characteritic (default: 1 (linear))
void | setExponent (float exp)
| sets the exponent of the sensor characteritic (default: 1 (linear))
## Protected Member Functions
virtual float | characteritic (float len)
| describes the sensor characteritic An exponential curve is used.
## Protected Attributes
float | range
float | len
float | value
float | exponent
double | size
OSGCylinder * | sensorBody
OsgHandle | osgHandle
Transform * | transform
Ray * | ray
bool | initialised

## Detailed Description

Class for IR sensors.

IR sensors are based on distance measurements using the ODE geom class Ray. The sensor value is obtained by collisions, which are handled by the simulation environement. The information of a collision comes to the sensor via the collision callback of the substance used for the ray (actually for the transform). However of no collision is detected the sensor needs to ajust its output as well. Therefore a reset function is provided.

## Constructor & Destructor Documentation

IRSensor | ( | float | exponent = `1`,
|  | double | size = `0.05` |
| ) |  |  |

Parameters:

  | exponent | exponent of the sensor characteritic (default: 1 (linear))

~IRSensor | ( |  | ) | `[virtual]`

## Member Function Documentation

float characteritic | ( | float | len | ) | `[protected, virtual]`

describes the sensor characteritic An exponential curve is used.

See also:
  setExponent()

RaySensor * clone | ( |  | ) | const`[virtual]`

Implements RaySensor.

double get | ( |  | ) | `[virtual]`

returns the sensor value in the range [0,1]; 0 means nothing no object in the sensor distance range 1 means contact with another object

See also:
  characteritic()

Implements RaySensor.

double getExponent | ( |  | ) | const`[inline]`

returns the exponent of the sensor characteritic (default: 1 (linear))

void init | ( | const OdeHandle & | odeHandle,
|  | const OsgHandle & | osgHandle,
|  | Primitive * | body,
|  | const osg::Matrix | pose,
|  | float | range,
|  | rayDrawMode | drawMode = `drawSensor` |
| ) |  |  | `[virtual]`

void reset | ( |  | ) | `[virtual]`

used for reseting the sensor value to a value of maximal distance.

Implements RaySensor.

void setExponent | ( | float | exp | ) | `[inline]`

sets the exponent of the sensor characteritic (default: 1 (linear))

void setLength | ( | float | len | ) | `[virtual]`

void setRange | ( | float | range | ) | `[virtual]`

set the range of the sensor

Parameters:

  | range | new length of the sensor

Implements RaySensor.

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

updates the position of the osg nodes

Implements RaySensor.

## Member Data Documentation

float exponent`[protected]`

bool initialised`[protected]`

float len`[protected]`

OsgHandle osgHandle`[protected]`

float range`[protected]`

Ray* ray`[protected]`

OSGCylinder* sensorBody`[protected]`

double size`[protected]`

Transform* transform`[protected]`

float value`[protected]`

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

- irsensor.h
- irsensor.cpp