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 lpzrobots::OdeRobot.

Collaboration diagram for AddSensors2RobotAdapter:
Collaboration graph
[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 void setColor (const Color &col)
 sets color of the robot
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
virtual std::list< Sensor * > getAttachedSensors ()
void sense (GlobalData &globalData)
 this function is called each controlstep before control.
void doInternalStuff (GlobalData &globalData)
 this function is called in each simulation timestep (always after control).
virtual void notifyOnChange (const paramkey &key)
 Is called when a parameter was changes via setParam().
virtual PrimitivegetMainPrimitive () const
 return the primitive of the robot that is used for tracking and camera following
virtual std::vector< Primitive * > getAllPrimitives () const
 returns a list of all primitives of the robot (used to store and restore the robot)
virtual std::vector< Primitive * > & getAllPrimitives ()

Protected Attributes

OdeRobotrobot
std::list< Sensor * > sensors
std::list< Motor * > motors
bool sensors_before_rest
bool initialized
bool askedfornumber

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 TODO: add inspectable, make configurable work! Maybe it is easier to add this into OdeRobot itself!


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:
This function will be removed in 0.8 Do not use it anymore, collision control is done automatically. In case of a routine 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 simulation timestep (always after control).

It should perform robot-internal checks and actions like resetting certain sensors or implement velocity dependend friction and the like. The attached Motors should act here.

Parameters:
globalData structure that contains global data from the simulation environment

Reimplemented from OdeRobot.

virtual std::vector<Primitive*>& getAllPrimitives (  )  [inline, virtual]

Reimplemented from OdeRobot.

virtual std::vector<Primitive*> getAllPrimitives (  )  const [inline, virtual]

returns a list of all primitives of the robot (used to store and restore the robot)

Reimplemented from OdeRobot.

virtual std::list<Sensor*> getAttachedSensors (  )  [inline, virtual]
virtual Primitive* getMainPrimitive (  )  const [inline, virtual]

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

Reimplemented from 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 notifyOnChange ( const paramkey key  )  [virtual]

Is called when a parameter was changes via setParam().

Note that it is not called of parameters of childs are changed, then there notifyOnChange() method is called. The key and of the changed parameter (use getParam() to retrieve its actual value). Overload this function when special actions have to be taken on parameter changes.

Reimplemented from Configurable.

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

sets the pose of the vehicle

Parameters:
pose desired 4x4 pose matrix

Implements OdeRobot.

void sense ( GlobalData globalData  )  [virtual]

this function is called each controlstep before control.

This is the place the perform active sensing (e.g. Image processing)

Parameters:
globalData structure that contains global data from the simulation environment

Reimplemented from OdeRobot.

virtual void setColor ( const Color col  )  [inline, virtual]

sets color of the robot

Parameters:
col Color struct with desired Color

Reimplemented from 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.

void update (  )  [virtual]

update the OSG notes here

Implements OdeRobot.


Member Data Documentation

bool askedfornumber [protected]
bool initialized [protected]
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:
Generated on Thu Jun 28 14:48:52 2012 for Robot Simulator of the Robotics Group for Self-Organization of Control by  doxygen 1.6.3