#include <irsensor.h>
Inherits RaySensor.
Inheritance diagram for IRSensor:
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 |
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.
IRSensor | ( | float | exponent = 1 , |
|
double | size = 0.05 | |||
) |
exponent | exponent of the sensor characteritic (default: 1 (linear)) |
~IRSensor | ( | ) | [virtual] |
float characteritic | ( | float | len | ) | [protected, virtual] |
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
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] |
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] |
void update | ( | ) | [virtual] |
float exponent [protected] |
bool initialised [protected] |
float len [protected] |
float range [protected] |
OSGCylinder* sensorBody [protected] |
double size [protected] |
float value [protected] |