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

# OdeRobot Class Reference

Abstract class for ODE robots. More...

`#include <oderobot.h>`

Inherits AbstractRobot, and Storeable.

Inherited by AddSensors2RobotAdapter, AmosII, Arm, Arm2Segm, DefaultCaterPillar, Discus, ForcedSphere, Formel1, Hand, Hexapod, HurlingSnake, MuscledArm, Nimm2, Nimm4, ReplayRobot, RobotChain, Schlange, ShortCircuit, Skeleton, SliderWheelie, Sphererobot, Sphererobot3Masses, TruckMesh, Uwo, and VierBeiner.

Collaboration diagram for OdeRobot:
[legend]

List of all members.

## Public Member Functions
| OdeRobot (const OdeHandle &odeHandle, const OsgHandle &osgHandle, const std::string &name, const std::string &revision)
| Constructor.
virtual | ~OdeRobot ()
| calls cleanup()
virtual void | update ()=0
| update the OSG notes here
virtual void | place (const Pos &pos)
| sets the vehicle to position pos
virtual void | place (const osg::Matrix &pose)=0
| sets the pose of the vehicle
virtual bool | collisionCallback (void *data, dGeomID o1, dGeomID o2)
virtual void | sense (GlobalData &globalData)
| this function is called each controlstep before control.
virtual void | doInternalStuff (GlobalData &globalData)
| this function is called in each simulation timestep (always after control).
virtual void | setColor (const Color &col)
| sets color of the robot
virtual Position | getPosition () const
| returns position of the object
virtual Position | getSpeed () const
| returns linear speed vector of the object
virtual Position | getAngularSpeed () const
| returns angular velocity vector of the object
virtual matrix::Matrix | getOrientation () const
| returns the orientation of the object
virtual Primitive * | getMainPrimitive () const
| return the primitive of the robot that is used for tracking and camera following
virtual Primitives | getAllPrimitives () const
| returns a list of all primitives of the robot (used to store and restore the robot)
virtual Primitives & | getAllPrimitives ()
virtual bool | store (FILE *f) const
| returns a list of all primitives of the robot (const version) (used to store and restore the robot)
virtual bool | restore (FILE *f)
| loads the object from the given file stream (binary).
virtual void | moveToPosition (Pos pos=Pos(0, 0, 0.5))
| relocates robot to new postion (keep current pose) such that lowest body part is at the given position (the center of it, so the bounding box is not checked)
## Protected Member Functions
virtual void | cleanup ()
| deletes all objects (primitives) and joints (is called automatically in destructor)
## 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)
std::vector< Joint * > | joints
| list of joints (should be populated by subclasses)
OdeHandle | odeHandle
OsgHandle | osgHandle
dSpaceID | parentspace
## Friends
class | OdeAgent

## Detailed Description

Abstract class for ODE robots.

Examples:

  template_sphererobot/main.cpp.

## Constructor & Destructor Documentation

OdeRobot | ( | const OdeHandle & | odeHandle,
|  | const OsgHandle & | osgHandle,
|  | const std::string & | name,
|  | const std::string & | revision |
| ) |  |  |

Constructor.

Parameters:

  | odehandle | structure with all global ODE variables

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

calls cleanup()

## Member Function Documentation

void cleanup | ( |  | ) | `[protected, virtual]`

deletes all objects (primitives) and joints (is called automatically in destructor)

Examples:
  nimm4.cpp.

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 in AddSensors2RobotAdapter, and Hexapod.

virtual void doInternalStuff | ( | GlobalData & | globalData | ) | `[inline, 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 in AddSensors2RobotAdapter, AmosII, Arm, Arm2Segm, Discus, ForcedSphere, Formel1, FourWheeled, Hand, Hexapod, HurlingSnake, MuscledArm, Nimm2, Nimm4, ReplayRobot, RobotChain, Schlange, ShortCircuit, Skeleton, SliderWheelie, Sphererobot, Sphererobot3Masses, TruckMesh, Uwo, and VierBeiner.

virtual Primitives& getAllPrimitives | ( |  | ) | `[inline, virtual]`

Reimplemented in AddSensors2RobotAdapter.

virtual Primitives getAllPrimitives | ( |  | ) | const`[inline, virtual]`

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

Reimplemented in AddSensors2RobotAdapter, Schlange, and SliderWheelie.

Position getAngularSpeed | ( |  | ) | const`[virtual]`

returns angular velocity vector of the object

Returns:
  vector (wx,wy,wz)

Implements Trackable.

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

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

Reimplemented in AddSensors2RobotAdapter, AmosII, Arm, Arm2Segm, DefaultCaterPillar, Discus, ForcedSphere, Formel1, Hand, Hexapod, HurlingSnake, MuscledArm, ReplayRobot, RobotChain, Schlange, ShortCircuit, Skeleton, SliderWheelie, Sphererobot, Uwo, and VierBeiner.

Examples:
  sphererobot3masses.cpp, and template_sphererobot/main.cpp.

matrix::Matrix getOrientation | ( |  | ) | const`[virtual]`

returns the orientation of the object

Returns:
  3x3 rotation matrix

Implements Trackable.

Position getPosition | ( |  | ) | const`[virtual]`

returns position of the object

Returns:
  vector of position (x,y,z)

Implements Trackable.

Position getSpeed | ( |  | ) | const`[virtual]`

returns linear speed vector of the object

Returns:
  vector (vx,vy,vz)

Implements Trackable.

bool isGeomInPrimitiveList | ( | std::list< Primitive * > | ps,
|  | dGeomID | geom |
| ) |  |  | `[static, protected]`

bool isGeomInPrimitiveList | ( | Primitive ** | ps,
|  | int | len,
|  | dGeomID | geom |
| ) |  |  | `[static, protected]`

void moveToPosition | ( | Pos | pos = `Pos(0,0,0.5)` | ) | `[virtual]`

relocates robot to new postion (keep current pose) such that lowest body part is at the given position (the center of it, so the bounding box is not checked)

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

sets the pose of the vehicle

Parameters:

  | pose | desired 4x4 pose matrix

Implemented in AddSensors2RobotAdapter, AmosII, Arm, Arm2Segm, DefaultCaterPillar, Discus, ForcedSphere, Formel1, Hand, Hexapod, HurlingSnake, MuscledArm, Nimm2, Nimm4, ReplayRobot, RobotChain, Schlange, ShortCircuit, Skeleton, SliderWheelie, Sphererobot, Sphererobot3Masses, TruckMesh, Uwo, and VierBeiner.

void place | ( | const Pos & | pos | ) | `[virtual]`

sets the vehicle to position pos

Parameters:

  | pos | desired position of the robot

bool restore | ( | FILE * | f | ) | `[virtual]`

loads the object from the given file stream (binary).

Implements Storeable.

virtual void sense | ( | GlobalData & | globalData | ) | `[inline, 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 in AddSensors2RobotAdapter, and TwoWheeled.

void setColor | ( | const Color & | col | ) | `[virtual]`

sets color of the robot

Parameters:

  | col | Color struct with desired Color

Reimplemented in AddSensors2RobotAdapter.

bool store | ( | FILE * | f | ) | const`[virtual]`

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

Implements Storeable.

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

update the OSG notes here

Implemented in AddSensors2RobotAdapter, AmosII, Arm, Arm2Segm, DefaultCaterPillar, Discus, ForcedSphere, Formel1, FourWheeled, Hand, Hexapod, HurlingSnake, MuscledArm, Nimm2, Nimm4, ReplayRobot, RobotChain, Schlange, ShortCircuit, Skeleton, SliderWheelie, Sphererobot, Sphererobot3Masses, TruckMesh, TwoWheeled, Uwo, and VierBeiner.

## Friends And Related Function Documentation

friend class OdeAgent`[friend]`

## Member Data Documentation

std::vector<Joint*> joints`[protected]`

list of joints (should be populated by subclasses)

Examples:
  nimm4.cpp, and sphererobot3masses.cpp.

Primitives objects`[protected]`

list of objects (should be populated by subclasses)

Reimplemented in Discus, and Sphererobot.

Examples:
  nimm4.cpp, and sphererobot3masses.cpp.

OdeHandle odeHandle`[protected]`

OsgHandle osgHandle`[protected]`

dSpaceID parentspace`[protected]`

Reimplemented in Arm, Arm2Segm, and MuscledArm.

Examples:
  nimm4.cpp, and sphererobot3masses.cpp.

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

- oderobot.h
- oderobot.cpp