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.
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 Primitive * | getMainPrimitive () 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 | |
OdeRobot * | robot |
std::list< Sensor * > | sensors |
std::list< Motor * > | motors |
bool | sensors_before_rest |
bool | initialized |
bool | askedfornumber |
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!
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
robot | robot the wrap and plug sensors in | |
sensors | list of sensors to add | |
motors | list of motors to add |
~AddSensors2RobotAdapter | ( | ) | [virtual] |
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] |
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.
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
sensors | sensors scaled to [-1,1] | |
sensornumber | length of the sensor array |
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] |
void sense | ( | GlobalData & | globalData | ) | [virtual] |
virtual void setColor | ( | const Color & | col | ) | [inline, virtual] |
void setMotors | ( | const motor * | motors, | |
int | motornumber | |||
) | [virtual] |
sets actual motorcommands
motors | motors scaled to [-1,1] | |
motornumber | length of the motor array |
Implements AbstractRobot.
void update | ( | ) | [virtual] |
update the OSG notes here
Implements OdeRobot.
bool askedfornumber [protected] |
bool initialized [protected] |
bool sensors_before_rest [protected] |