Robotsystem of the Robot Group Leipzig: AddSensors2RobotAdapter Class Reference

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

- Search for |

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

# AddSensors2RobotAdapter Class Reference

Robot adapter to add sensors and also motors to robots without the need to modify the robot itself. More...

`#include <addsensors2robotadapter.h>`

Inherits OdeRobot.

Inheritance diagram for AddSensors2RobotAdapter:

[legend]
Collaboration diagram for AddSensors2RobotAdapter:

[legend]
List of all members.

## Public Member Functions
| AddSensors2RobotAdapter (const OdeHandle &odeHandle, const OsgHandle &osgHandle, OdeRobot *robot, const std::list< Sensor * > &sensors=std::list< Sensor * >(), const std::list< Motor * > &motors=std::list< Motor * >(), bool sensors_before_rest=false)
| constructor of adapter
virtual | ~AddSensors2RobotAdapter ()
virtual void | addSensor (Sensor *sensor)
| adds a sensor to the robot. Must be called before placement of the robot, otherwise it has no affect
virtual void | addMotor (Motor *motor)
| adds a motor to the robot. Must be called before placement of the robot, otherwise it has no affect
virtual void | update ()
| update the OSG notes here
virtual void | place (const osg::Matrix &pose)
| sets the pose of the vehicle
virtual bool | collisionCallback (void *data, dGeomID o1, dGeomID o2)
virtual int | getSensorNumber ()
| returns number of sensors
virtual int | getSensors (sensor *sensors_, int sensornumber)
| returns actual sensorvalues
virtual int | getMotorNumber ()
| returns number of motors
virtual void | setMotors (const motor *motors_, int motornumber)
| sets actual motorcommands
void | doInternalStuff (GlobalData &globalData)
| this function is called in each timestep after control.
virtual Primitive * | getMainPrimitive () const
| return the primitive of the robot that is used for tracking and camera following
## Protected Attributes
OdeRobot * | robot
std::list< Sensor * > | sensors
std::list< Motor * > | motors
bool | sensors_before_rest

## Detailed Description

Robot adapter to add sensors and also motors to robots without the need to modify the robot itself.

Examples are Speed sensors, microphons and beepers and so forth

## Constructor & Destructor Documentation

AddSensors2RobotAdapter | ( | const OdeHandle & | odeHandle,
|  | const OsgHandle & | osgHandle,
|  | OdeRobot * | robot,
|  | const std::list< Sensor * > & | sensors = `std::list< Sensor * >()`,
|  | const std::list< Motor * > & | motors = `std::list< Motor * >()`,
|  | bool | sensors_before_rest = `false` |
| ) |  |  |

constructor of adapter

Parameters:

  | robot | robot the wrap and plug sensors in
  | sensors | list of sensors to add
  | motors | list of motors to add

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

## Member Function Documentation

void addMotor | ( | Motor * | motor | ) | `[virtual]`

adds a motor to the robot. Must be called before placement of the robot, otherwise it has no affect

void addSensor | ( | Sensor * | sensor | ) | `[virtual]`

adds a sensor to the robot. Must be called before placement of the robot, otherwise it has no affect

virtual bool collisionCallback | ( | void * | data,
|  | dGeomID | o1,
|  | dGeomID | o2 |
| ) |  |  | `[inline, virtual]`

Deprecated:
  Do not use it anymore, collision control is done automatically. In case of a treatment return true (collision will be ignored by other objects and the default routine) else false (collision is passed to other objects and (if not treated) to the default routine).

Reimplemented from OdeRobot.

void doInternalStuff | ( | GlobalData & | globalData | ) | `[virtual]`

this function is called in each timestep after control.

It should perform robot-internal checks and actions, like acting and sensing of internal motors/sensors etc.

Parameters:

  | globalData | structure that contains global data from the simulation environment

Implements OdeRobot.

virtual Primitive* getMainPrimitive | ( |  | ) | const`[inline, virtual]`

return the primitive of the robot that is used for tracking and camera following

Implements OdeRobot.

int getMotorNumber | ( |  | ) | `[virtual]`

returns number of motors

Implements AbstractRobot.

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

returns number of sensors

Implements AbstractRobot.

int getSensors | ( | sensor * | sensors_,
|  | int | sensornumber |
| ) |  |  | `[virtual]`

returns actual sensorvalues

Parameters:

  | sensors | sensors scaled to [-1,1]
  | sensornumber | length of the sensor array

Returns:
  number of actually written sensors

Implements AbstractRobot.

void place | ( | const osg::Matrix & | pose | ) | `[virtual]`

sets the pose of the vehicle

Parameters:

  | pose | desired 4x4 pose matrix

Implements OdeRobot.

void setMotors | ( | const motor * | motors_,
|  | int | motornumber |
| ) |  |  | `[virtual]`

sets actual motorcommands

Parameters:

  | motors | motors scaled to [-1,1]
  | motornumber | length of the motor array

Implements AbstractRobot.

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

update the OSG notes here

Implements OdeRobot.

## Member Data Documentation

std::list<Motor*> motors`[protected]`

OdeRobot* robot`[protected]`

std::list<Sensor*> sensors`[protected]`

bool sensors_before_rest`[protected]`

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

- addsensors2robotadapter.h
- addsensors2robotadapter.cpp