Robot Simulator of the Robotics Group for Self-Organization of Control
0.8.0
|
Abstract class for ODE robots. More...
#include <oderobot.h>
Public Member Functions | |
OdeRobot (const OdeHandle &odeHandle, const OsgHandle &osgHandle, const std::string &name, const std::string &revision) | |
Constructor. More... | |
virtual | ~OdeRobot () |
calls cleanup() More... | |
virtual int | getSensors (double *sensors, int sensornumber) final |
returns actual sensorvalues More... | |
virtual void | setMotors (const double *motors, int motornumber) final |
sets actual motorcommands More... | |
virtual int | getSensorNumber () final |
returns number of sensors More... | |
virtual int | getMotorNumber () final |
returns number of motors More... | |
virtual std::list < SensorMotorInfo > | getSensorInfos () override |
returns the information for the sensors. More... | |
virtual std::list < SensorMotorInfo > | getMotorInfos () override |
returns the information for the motors. More... | |
virtual int | getSensorsIntern (double *sensors, int sensornumber) |
overload this function in a subclass to do specific sensor handling, not needed for generic sensors More... | |
virtual void | setMotorsIntern (const double *motors, int motorsnumber) |
overload this function in a subclass to do specific sensor handling, not needed for generic motors More... | |
virtual int | getSensorNumberIntern () |
overload this function in a subclass to specific the number of custom sensors More... | |
virtual int | getMotorNumberIntern () |
overload this function in a subclass to specific the number of custom sensors More... | |
virtual void | addSensor (std::shared_ptr< Sensor > sensor, Attachment attachment=Attachment()) |
adds a sensor to the robot. More... | |
virtual void | addMotor (std::shared_ptr< Motor > motor, Attachment attachment=Attachment()) |
adds a motor to the robot. More... | |
virtual std::list < SensorAttachment > | getAttachedSensors () |
returns all generic sensors with their attachment More... | |
virtual std::list < MotorAttachment > | getAttachedMotors () |
returns all generic motors with their attachment More... | |
virtual void | addTorqueSensors (double maxtorque=1.0, int avg=1) |
adds a torque sensor to each joint. Call it after placement of robot. More... | |
virtual void | update () |
update the OSG notes here, if overwritten, call OdeRobot::update()! More... | |
virtual void | place (const Pos &pos) final |
sets the vehicle to position pos More... | |
virtual void | place (const osg::Matrix &pose) final |
sets the pose of the vehicle More... | |
virtual void | placeIntern (const osg::Matrix &pose)=0 |
wrapper to for More... | |
virtual bool | collisionCallback (void *data, dGeomID o1, dGeomID o2) |
virtual void | sense (GlobalData &globalData) |
this function is called each controlstep before control. More... | |
virtual void | doInternalStuff (GlobalData &globalData) |
this function is called in each simulation timestep (always after control). More... | |
virtual void | setColor (const Color &col) |
sets color of the robot More... | |
virtual Position | getPosition () const |
returns position of the object More... | |
virtual Position | getSpeed () const |
returns linear speed vector of the object More... | |
virtual Position | getAngularSpeed () const |
returns angular velocity vector of the object More... | |
virtual matrix::Matrix | getOrientation () const |
returns the orientation of the object More... | |
virtual Primitive * | getMainPrimitive () const |
return the primitive of the robot that is used for tracking and camera following More... | |
virtual Primitives | getAllPrimitives () const |
returns a list of all primitives of the robot (used to store and restore the robot) More... | |
virtual Primitives & | getAllPrimitives () |
virtual Joints | getAllJoints () const |
returns a list of all primitives of the robot (const version) (used to store and restore the robot) More... | |
virtual Joints & | getAllJoints () |
virtual bool | store (FILE *f) const |
returns a list of all joints of the robot (const version) More... | |
virtual bool | restore (FILE *f) |
loads the object from the given file stream (ASCII preferred). More... | |
virtual void | moveToPosition (Pos pos=Pos(0, 0, 0.5), int primitiveID=-1) |
relocates robot such its primitive with the given ID is at the new postion (keep current pose). More... | |
virtual void | moveToPose (Pose pose, int primitiveID=-1) |
relocates robot such its primitive with the given ID is at the new pose (keep relative pose of all primitives). More... | |
virtual Pose | getInitialPose () |
returns the initial pose of the main primitive (use it e.g. with moveToPose) More... | |
virtual Pose | getRelativeInitialPose () |
returns the initial relative pose of the main primitive (use it with moveToPose to further translate or rotate). More... | |
virtual void | fixate (GlobalData &global, int primitiveID=-1, double duration=0) |
fixates the given primitive of the robot at its current position to the world for a certain time. More... | |
virtual bool | unFixate (GlobalData &global) |
release the robot in case it is fixated and return true in this case More... | |
Public Member Functions inherited from AbstractRobot | |
AbstractRobot (const std::string &name="abstractRobot", const std::string &revision="$ID$") | |
Constructor. More... | |
virtual | ~AbstractRobot () |
virtual std::string | getTrackableName () const |
returns name of trackable More... | |
Public Member Functions inherited from Trackable | |
Trackable () | |
Constructor. More... | |
virtual | ~Trackable () |
Public Member Functions inherited from Configurable | |
Configurable () | |
Configurable (const std::string &name, const std::string &revision) | |
intialise with name and revision (use "$ID$") More... | |
virtual | ~Configurable () |
virtual void | notifyOnChange (const paramkey &key) |
Is called when a parameter was changes via setParam(). More... | |
virtual void | addParameter (const paramkey &key, paramval *val, paramval minBound, paramval maxBound, const paramdescr &descr=paramdescr()) |
This is the new style for adding configurable parameters. More... | |
virtual void | addParameter (const paramkey &key, paramval *val, const paramdescr &descr=paramdescr()) |
See addParameter(const paramkey& key, paramval* val, paramval minBound, paramval maxBound, const paramdescr& descr) More... | |
virtual void | addParameter (const paramkey &key, parambool *val, const paramdescr &descr=paramdescr()) |
See addParameter(const paramkey& key, paramval* val) but for bool values. More... | |
virtual void | addParameter (const paramkey &key, paramint *val, paramint minBound, paramint maxBound, const paramdescr &descr=paramdescr()) |
See addParameter(const paramkey& key, paramval* val) but for int values. More... | |
virtual void | addParameter (const paramkey &key, paramint *val, const paramdescr &descr=paramdescr()) |
virtual void | addParameterDef (const paramkey &key, paramval *val, paramval def, paramval minBound, paramval maxBound, const paramdescr &descr=paramdescr()) |
This function is only provided for convenience. More... | |
virtual void | addParameterDef (const paramkey &key, paramval *val, paramval def, const paramdescr &descr=paramdescr()) |
virtual void | addParameterDef (const paramkey &key, parambool *val, parambool def, const paramdescr &descr=paramdescr()) |
See addParameterDef(const paramkey&, paramval*, paramval) More... | |
virtual void | addParameterDef (const paramkey &key, paramint *val, paramint def, paramint minBound, paramint maxBound, const paramdescr &descr=paramdescr()) |
See addParameterDef(const paramkey&, paramval*, paramval) More... | |
virtual void | addParameterDef (const paramkey &key, paramint *val, paramint def, const paramdescr &descr=paramdescr()) |
virtual void | setParamDescr (const paramkey &key, const paramdescr &descr, bool traverseChildren=true) |
sets a description for the given parameter More... | |
int | getId () const |
return the id of the configurable objects, which is created by random on initialisation More... | |
virtual paramkey | getName () const |
return the name of the object More... | |
virtual paramkey | getRevision () const |
returns the revision of the object More... | |
virtual void | setName (const paramkey &name, bool callSetNameOfInspectable=true) |
Sets the name of the configurable. More... | |
virtual void | setRevision (const paramkey &revision) |
sets the revision Hint: { return "$ID$"; } More... | |
virtual paramval | getParam (const paramkey &key, bool traverseChildren=true) const |
returns the value of the requested parameter or 0 (+ error message to stderr) if unknown. More... | |
virtual bool | hasParam (const paramkey &key, bool traverseChildren=true) const |
Returns if the requested parameter is part of the configurable or their children. More... | |
virtual bool | setParam (const paramkey &key, paramval val, bool traverseChildren=true) |
sets the value of the given parameter or does nothing if unknown. More... | |
virtual void | setParamBounds (const paramkey &key, paramval minBound, paramval maxBound, bool traverseChildren=true) |
Sets the bounds (minBound and maxBound) of the given parameter. More... | |
virtual void | setParamBounds (const paramkey &key, paramint minBound, paramint maxBound, bool traverseChildren=true) |
virtual void | setParamBounds (const paramkey &key, paramvalBounds bounds, bool traverseChildren=true) |
virtual void | setParamBounds (const paramkey &key, paramintBounds bounds, bool traverseChildren=true) |
virtual paramlist | getParamList () const |
The list of all parameters with there value as allocated lists. More... | |
virtual std::list< paramkey > | getAllParamNames (bool traverseChildren=true) |
returns all names that are configureable More... | |
virtual parammap | getParamValMap () const |
virtual paramintmap | getParamIntMap () const |
virtual paramboolmap | getParamBoolMap () const |
virtual paramdescr | getParamDescr (const paramkey &key, bool traverseChildren=true) const |
returns the description for the given parameter More... | |
virtual paramvalBounds | getParamvalBounds (const paramkey &key, bool traverseChildren=true) const |
virtual paramintBounds | getParamintBounds (const paramkey &key, bool traverseChildren=true) const |
virtual bool | hasParamDescr (const paramkey &key, bool traverseChildren=true) const |
virtual bool | hasParamvalBounds (const paramkey &key, bool traverseChildren=true) const |
virtual bool | hasParamintBounds (const paramkey &key, bool traverseChildren=true) const |
virtual bool | storeCfg (const char *filenamestem, const std::list< std::string > &comments=std::list< std::string >()) |
stores the key values paires into the file : filenamestem.cfg including the comments given in the list More... | |
virtual bool | restoreCfg (const char *filenamestem) |
restores the key values paires from the file : filenamestem.cfg More... | |
void | print (FILE *f, const char *prefix, int columns=90, bool traverseChildren=true) const |
prints the keys, values and descriptions to the file. Each line is prefixed More... | |
bool | parse (FILE *f, const char *prefix=0, bool traverseChildren=true) |
parses the configuration from the given file More... | |
virtual void | addConfigurable (Configurable *conf) |
Adds a configurable as a child object. More... | |
virtual void | removeConfigurable (Configurable *conf) |
Removes a configurable as a child object. More... | |
virtual const configurableList & | getConfigurables () const |
Returns the list containing all configurable children. More... | |
virtual void | configurableChanged () |
Indicates that the configurable itself or the configurable children attached to this configurable have changed. More... | |
Public Member Functions inherited from BackCaller | |
BackCaller () | |
virtual | ~BackCaller () |
virtual void | addCallbackable (Callbackable *callbackableInstance, CallbackableType type=BackCaller::DEFAULT_CALLBACKABLE_TYPE) |
Adds a Callbackable instance to this caller instance. More... | |
virtual void | removeCallbackable (Callbackable *callbackableInstance, CallbackableType type=BackCaller::DEFAULT_CALLBACKABLE_TYPE) |
Removes a Callbackable instance from this caller instance. More... | |
virtual void | removeAllCallbackables (CallbackableType type) |
Removes all Callbackable instances from this caller instance. More... | |
virtual void | callBack (CallbackableType type=BackCaller::DEFAULT_CALLBACKABLE_TYPE) |
Calls all registered callbackable classes of the determined type. More... | |
virtual void | callBackQMP (CallbackableType type=BackCaller::DEFAULT_CALLBACKABLE_TYPE) |
Calls all registered callbackable classes of the determined type. More... | |
Public Member Functions inherited from Storeable | |
virtual | ~Storeable () |
bool | storeToFile (const char *filename) const |
Provided for convenience. More... | |
bool | restoreFromFile (const char *filename) |
Provided for convenience. More... | |
Protected Member Functions | |
void | attachSensor (SensorAttachment &sa) |
void | attachMotor (MotorAttachment &ma) |
virtual void | cleanup () |
deletes all objects (primitives) and joints (is called automatically in destructor) More... | |
Protected Member Functions inherited from Configurable | |
void | copyParameters (const Configurable &, bool traverseChildren=true) |
copies the internal params of the given configurable More... | |
void | printdescr (FILE *f, const char *prefix, const paramkey &key, int columns, int indent) const |
Static Protected Member Functions | |
static bool | isGeomInPrimitiveList (Primitive **ps, int len, dGeomID geom) |
static bool | isGeomInPrimitiveList (std::list< Primitive * > ps, dGeomID geom) |
Protected Attributes | |
Primitives | objects |
list of objects (should be populated by subclasses) More... | |
Joints | joints |
list of joints (should be populated by subclasses) More... | |
std::list< SensorAttachment > | sensors |
std::list< MotorAttachment > | motors |
TmpJoint * | fixationTmpJoint |
Pose | initialPose |
Pose | initialRelativePose |
OdeHandle | odeHandle |
OsgHandle | osgHandle |
dSpaceID | parentspace |
bool | initialized |
bool | askedfornumber |
Friends | |
class | OdeAgent |
Additional Inherited Members | |
Public Types inherited from AbstractRobot | |
typedef double | sensor |
typedef double | motor |
Public Types inherited from Configurable | |
typedef std::string | paramkey |
typedef std::string | paramdescr |
typedef double | paramval |
typedef std::list< std::pair < paramkey, paramval > > | paramlist |
typedef std::map< paramkey, paramval * > | parammap |
typedef bool | parambool |
typedef std::list< std::pair < paramkey, parambool > > | paramboollist |
typedef std::map< paramkey, parambool * > | paramboolmap |
typedef int | paramint |
typedef std::list< std::pair < paramkey, paramint > > | paramintlist |
typedef std::map< paramkey, paramint * > | paramintmap |
typedef std::map< paramkey, paramdescr > | paramdescrmap |
typedef std::pair< paramval, paramval > | paramvalBounds |
typedef std::map< paramkey, paramvalBounds > | paramvalBoundsMap |
typedef std::pair< paramint, paramint > | paramintBounds |
typedef std::map< paramkey, paramintBounds > | paramintBoundsMap |
typedef std::pair< paramkey, paramval * > | paramvalpair |
typedef std::pair< paramkey, parambool * > | paramboolpair |
typedef std::pair< paramkey, paramint * > | paramintpair |
typedef std::vector < Configurable * > | configurableList |
Public Types inherited from BackCaller | |
typedef unsigned long | CallbackableType |
Static Public Attributes inherited from Configurable | |
static const CallbackableType | CALLBACK_CONFIGURABLE_CHANGED = 11 |
Static Public Attributes inherited from BackCaller | |
static const CallbackableType | DEFAULT_CALLBACKABLE_TYPE = 0 |
This is the default Callbackable type. More... | |
Abstract class for ODE robots.
OdeRobot | ( | const OdeHandle & | odeHandle, |
const OsgHandle & | osgHandle, | ||
const std::string & | name, | ||
const std::string & | revision | ||
) |
Constructor.
odehandle | structure with all global ODE variables |
|
virtual |
adds a motor to the robot.
Must be called before agents initializes, otherwise unknown effect.
segmentIndex | index of segment of robot to which this motor should be attached |
|
virtual |
adds a sensor to the robot.
Must be called before agents initializes, otherwise unknown effect.
segmentIndex | index of segment of robot to which this sensor should be attached |
|
virtual |
adds a torque sensor to each joint. Call it after placement of robot.
|
protected |
|
protected |
|
protectedvirtual |
deletes all objects (primitives) and joints (is called automatically in destructor)
|
inlinevirtual |
|
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 (done automatically in OdeRobot); If you overload this function, call the OdeRobot::doInternalStuff() function.
globalData | structure that contains global data from the simulation environment |
Reimplemented in AmosII, AmosFour, Ashigaru, Arm, Hexapod, MuscledArm, Nimm2, Discus, VierBeiner, Sphererobot3Masses, SliderWheelie, RobotChain, ForcedSphere, TruckMesh, ReplayRobot, ShortCircuit, and HurlingSnake.
|
virtual |
fixates the given primitive of the robot at its current position to the world for a certain time.
Hint: use moveToPosition() to get the robot relocated
primitiveID | if -1 then the main primitive is used, otherwise the primitive with the given index |
duration | time to fixate in seconds (if ==0 then indefinite) |
|
inlinevirtual |
returns a list of all primitives of the robot (const version) (used to store and restore the robot)
returns a list of all joints of the robot
|
inlinevirtual |
|
inlinevirtual |
returns a list of all primitives of the robot (used to store and restore the robot)
Reimplemented in Schlange, and SliderWheelie.
|
inlinevirtual |
|
virtual |
|
inlinevirtual |
returns all generic motors with their attachment
|
inlinevirtual |
returns all generic sensors with their attachment
|
inlinevirtual |
returns the initial pose of the main primitive (use it e.g. with moveToPose)
|
inlinevirtual |
return the primitive of the robot that is used for tracking and camera following
Reimplemented in AmosII, AmosFour, Skeleton, Nejihebi, Arm, Hexapod, Hand, MuscledArm, Discus, Schlange, VierBeiner, DefaultCaterPillar, Sphererobot, SliderWheelie, Arm2Segm, Uwo, RobotChain, ForcedSphere, HurlingSnake, Formel1, ReplayRobot, and ShortCircuit.
|
overridevirtual |
returns the information for the motors.
The following relation has to hold: getMotorNames().size() == getMotorNumber()
Reimplemented from AbstractRobot.
|
finalvirtual |
returns number of motors
Implements AbstractRobot.
|
inlinevirtual |
overload this function in a subclass to specific the number of custom sensors
Reimplemented in AmosII, AmosFour, Skeleton, Ashigaru, Nejihebi, Arm, Hand, Discus, Sphererobot3Masses, MuscledArm, Schlange, Kuka, Nimm2, VierBeiner, DefaultCaterPillar, SliderWheelie, Sphererobot, Arm2Segm, Uwo, ForcedSphere, RobotChain, TruckMesh, FourWheeled, Nimm4, SchlangeVelocity, SchlangeServo, SchlangeServo2, CaterPillar, HurlingSnake, Formel1, SchlangeForce, and ShortCircuit.
|
virtual |
|
virtual |
|
inlinevirtual |
returns the initial relative pose of the main primitive (use it with moveToPose to further translate or rotate).
If initialized with place(p) then moveToPose(getRelativeInitialPose()*p) whould put the main primitive at the same position and pose.
|
overridevirtual |
returns the information for the sensors.
The following relation has to hold: getSensorNames().size() == getSensorNumber()
Reimplemented from AbstractRobot.
|
finalvirtual |
returns number of sensors
Implements AbstractRobot.
|
inlinevirtual |
overload this function in a subclass to specific the number of custom sensors
Reimplemented in AmosII, AmosFour, Skeleton, Nejihebi, Ashigaru, Arm, Hand, Discus, Sphererobot3Masses, MuscledArm, Schlange, Kuka, Nimm2, VierBeiner, Sphererobot, DefaultCaterPillar, SliderWheelie, ForcedSphere, Uwo, Arm2Segm, RobotChain, TwoWheeled, FourWheeled, TruckMesh, SchlangeVelocity, Nimm4, SchlangeServo, SchlangeServo2, CaterPillar, HurlingSnake, Formel1, SchlangeForce, and ShortCircuit.
|
finalvirtual |
returns actual sensorvalues
sensors | sensors scaled to [-1,1] |
sensornumber | length of the sensor array |
Implements AbstractRobot.
|
inlinevirtual |
overload this function in a subclass to do specific sensor handling, not needed for generic sensors
Reimplemented in AmosII, AmosFour, Nejihebi, Skeleton, Ashigaru, Arm, Discus, Hand, Sphererobot3Masses, MuscledArm, Schlange, DefaultCaterPillar, Nimm2, VierBeiner, SliderWheelie, Sphererobot, Barrel2Masses, ForcedSphere, Kuka, RobotChain, FourWheeled, TwoWheeled, Uwo, Arm2Segm, SchlangeVelocity, TruckMesh, Nimm4, SchlangeServo, SchlangeServo2, CaterPillar, SchlangeForce, HurlingSnake, Formel1, ReplayRobot, and ShortCircuit.
|
virtual |
|
staticprotected |
|
staticprotected |
|
virtual |
relocates robot such its primitive with the given ID is at the new pose (keep relative pose of all primitives).
If primitiveID is -1 then the main primitive is used.
relocates robot such its primitive with the given ID is at the new postion (keep current pose).
If primitiveID is -1 then the main primitive is used. If primitiveID is -2 then the primitive with the lowest center is used (the center of it, so the bounding box is not checked)
|
finalvirtual |
sets the vehicle to position pos
pos | desired position of the robot |
|
finalvirtual |
sets the pose of the vehicle
pose | desired 4x4 pose matrix |
|
pure virtual |
wrapper to for
Implemented in AmosII, AmosFour, Nejihebi, Skeleton, Ashigaru, Hexapod, Arm, Discus, Hand, Sphererobot3Masses, MuscledArm, Nimm2, VierBeiner, Schlange, SliderWheelie, DefaultCaterPillar, Differential, Sphererobot, ForcedSphere, RobotChain, Kuka, Uwo, Arm2Segm, TruckMesh, Nimm4, Formel1, HurlingSnake, ReplayRobot, and ShortCircuit.
|
virtual |
loads the object from the given file stream (ASCII preferred).
Implements Storeable.
|
virtual |
this function is called each controlstep before control.
This is the place the perform active sensing (e.g. Image processing). If you overload this function, call the OdeRobot::sense() function.
globalData | structure that contains global data from the simulation environment |
Reimplemented in AmosII, AmosFour, Ashigaru, Discus, Sphererobot3Masses, Hand, and TwoWheeled.
|
virtual |
|
finalvirtual |
sets actual motorcommands
motors | motors scaled to [-1,1] |
motornumber | length of the motor array |
Implements AbstractRobot.
|
inlinevirtual |
overload this function in a subclass to do specific sensor handling, not needed for generic motors
Reimplemented in AmosII, AmosFour, Nejihebi, Skeleton, Ashigaru, Arm, Hand, Discus, Sphererobot3Masses, MuscledArm, Nimm2, VierBeiner, Schlange, Sphererobot, DefaultCaterPillar, SliderWheelie, ForcedSphere, Kuka, Uwo, RobotChain, Arm2Segm, FourWheeled, TruckMesh, Nimm4, SchlangeVelocity, HurlingSnake, Formel1, SchlangeServo, SchlangeServo2, CaterPillar, ReplayRobot, ShortCircuit, and SchlangeForce.
|
virtual |
returns a list of all joints of the robot (const version)
Implements Storeable.
|
virtual |
release the robot in case it is fixated and return true in this case
|
virtual |
update the OSG notes here, if overwritten, call OdeRobot::update()!
Reimplemented in AmosII, AmosFour, Ashigaru, Arm, Discus, Sphererobot3Masses, Hand, Schlange, SliderWheelie, Nimm2, VierBeiner, DefaultCaterPillar, ForcedSphere, Sphererobot, TwoWheeled, RobotChain, Kuka, Arm2Segm, TruckMesh, Nimm4, and Formel1.
|
friend |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
list of joints (should be populated by subclasses)
|
protected |
|
protected |
list of objects (should be populated by subclasses)
|
protected |
|
protected |
|
protected |
|
protected |