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

# ContactSensor Class Reference

Class for a contact sensor. More...

`#include <contactsensor.h>`

Collaboration diagram for ContactSensor:
[legend]

List of all members.

## Public Member Functions
| ContactSensor (bool binary=true, double forcescale=1, double radius=0.05)
virtual | ~ContactSensor ()
virtual void | init (const OdeHandle &odeHandle, const OsgHandle &osgHandle, Primitive *reference, bool createSphere=false, const osg::Matrix pose=osg::Matrix(), bool colorObject=true)
virtual void | reset ()
virtual double | get ()
| returns the sensor value in the range >=0; 0 means nothing no contact >0 means contact with another object: size is the force in arbitrary unit
virtual void | update ()
virtual void | setDepth (float depth)
Transform * | getTransformObject ()
## Protected Attributes
bool | binary
| if contact sensor is a switch
double | forcescale
double | value
| actual sensor value
double | lastvalue
| last value
double | size
| size of graphical sensor
Primitive * | reference
| primitive to which the sensor is bound
Sphere * | sensorBody
Transform * | transform
bool | colorObject
Color | origColor
bool | initialised

## Detailed Description

Class for a contact sensor.

The sensor is on if a collision occurs and stores the penetration depth (as a crude measure for the colission force). It can be either attached to an existing primitive (e.g. a leg) or create its own sensor object. The latter is recommended if you want very localized force sensors. The information of a collision comes to the sensor via the collision callback of the substance used for the primitive. However of no collision is detected the sensor needs to ajust its output as well. Therefore a reset function is provided.

## Constructor & Destructor Documentation

ContactSensor | ( | bool | binary = `true`,
|  | double | forcescale = `1`,
|  | double | radius = `0.05` |
| ) |  |  |

Parameters:

  | binary | if true then the sensor is 0 or 1 (for contact), no force value returned
  | forcescale | scale of the measured collision force (default: 1)
  | size | size of little box representing the sensor (if it has an own body) (default: 0.05)

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

## Member Function Documentation

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

returns the sensor value in the range >=0; 0 means nothing no contact >0 means contact with another object: size is the force in arbitrary unit

See also:
  characteritic()

Transform * getTransformObject | ( |  | ) |

void init | ( | const OdeHandle & | odeHandle,
|  | const OsgHandle & | osgHandle,
|  | Primitive * | reference,
|  | bool | createSphere = `false`,
|  | const osg::Matrix | pose = `osg::Matrix()`,
|  | bool | colorObject = `true` |
| ) |  |  | `[virtual]`

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

void setDepth | ( | float | depth | ) | `[virtual]`

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

## Member Data Documentation

bool binary`[protected]`

if contact sensor is a switch

bool colorObject`[protected]`

double forcescale`[protected]`

bool initialised`[protected]`

double lastvalue`[protected]`

last value

Color origColor`[protected]`

Primitive* reference`[protected]`

primitive to which the sensor is bound

Sphere* sensorBody`[protected]`

double size`[protected]`

size of graphical sensor

Transform* transform`[protected]`

double value`[protected]`

actual sensor value

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

- contactsensor.h
- contactsensor.cpp