Schlange Class Reference

This is a class, which models a snake like robot. More...

#include <schlange.h>

Inherits lpzrobots::OdeRobot.

Inherited by SchlangeForce, SchlangeServo, SchlangeServo2, and SchlangeVelocity.

Collaboration diagram for Schlange:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Schlange (const OdeHandle &odeHandle, const OsgHandle &osgHandle, const SchlangeConf &conf, const std::string &name, const std::string &revision)
virtual ~Schlange ()
virtual void place (const osg::Matrix &pose)
 sets the pose of the vehicle
virtual void update ()
 update all primitives and joints
virtual void doInternalStuff (GlobalData &global)
 this function is called in each simulation timestep (always after control).
virtual void setMotors (const motor *motors, int motornumber)=0
 Reads the actual motor commands from an array, an sets all motors of the snake to this values.
virtual int getSensors (sensor *sensors, int sensornumber)=0
 Writes the sensor values to an array in the memory.
virtual int getSensorNumber ()=0
 returns number of sensors
virtual int getMotorNumber ()=0
 returns number of motors
virtual int getSegmentsPosition (std::vector< Position > &poslist)
 returns a vector with the positions of all segments of the robot
virtual void notifyOnChange (const paramkey &key)
 Is called when a parameter was changes via setParam().
virtual PrimitivegetMainPrimitive () const
 the main object of the robot, which is used for position and speed tracking
virtual std::vector< Primitive * > getAllPrimitives () const
 returns a list of all primitives of the robot (used to store and restore the robot)
virtual void setTexture (const std::string &filename)
 sets a texture to the body of the snake note: the head texture of the snake is set by this method too!
virtual void setHeadTexture (const std::string &filename)
 sets a texture to the head of the snake
virtual void setHeadColor (const Color &color)
 sets the color of the head element

Static Public Member Functions

static SchlangeConf getDefaultConf ()

Protected Member Functions

virtual void create (const osg::Matrix &pose)
 creates vehicle at desired pose
virtual PrimitivecreateSegment (int index, const OdeHandle &odeHandle)
 creates and initialised the segment with the given index
virtual void destroy ()
 destroys vehicle and space

Protected Attributes

bool created
std::vector< AngularMotor * > frictionmotors
SchlangeConf conf
std::vector< OdeHandlespaces

Detailed Description

This is a class, which models a snake like robot.

It consists of a number of equal elements, each linked by a joint


Constructor & Destructor Documentation

Schlange ( const OdeHandle odeHandle,
const OsgHandle osgHandle,
const SchlangeConf conf,
const std::string &  name,
const std::string &  revision 
)
~Schlange (  )  [virtual]

Member Function Documentation

void create ( const osg::Matrix pose  )  [protected, virtual]

creates vehicle at desired pose

creates vehicle at desired position

Parameters:
pose 4x4 pose matrix
Primitive * createSegment ( int  index,
const OdeHandle odeHandle 
) [protected, virtual]

creates and initialised the segment with the given index

void destroy (  )  [protected, virtual]

destroys vehicle and space

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 (  )  const [inline, virtual]

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

Reimplemented from OdeRobot.

static SchlangeConf getDefaultConf (  )  [inline, static]

Reimplemented in SchlangeVelocity.

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

the main object of the robot, which is used for position and speed tracking

Reimplemented from OdeRobot.

virtual int getMotorNumber (  )  [pure virtual]

returns number of motors

Implements AbstractRobot.

Implemented in SchlangeForce, SchlangeServo, SchlangeServo2, and SchlangeVelocity.

int getSegmentsPosition ( std::vector< Position > &  poslist  )  [virtual]

returns a vector with the positions of all segments of the robot

Parameters:
poslist vector of positions (of all robot segments)
Returns:
length of the list
virtual int getSensorNumber (  )  [pure virtual]

returns number of sensors

Implements AbstractRobot.

Implemented in SchlangeForce, SchlangeServo, SchlangeServo2, and SchlangeVelocity.

virtual int getSensors ( sensor sensors,
int  sensornumber 
) [pure virtual]

Writes the sensor values to an array in the memory.

Parameters:
sensors pointer to the array
sensornumber length of the sensor array
Returns:
number of actually written sensors

Implements AbstractRobot.

Implemented in SchlangeForce, SchlangeServo, SchlangeServo2, and SchlangeVelocity.

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.

Reimplemented in SchlangeServo, and SchlangeServo2.

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

sets the pose of the vehicle

Parameters:
pose desired 4x4 pose matrix

Implements OdeRobot.

void setHeadColor ( const Color color  )  [virtual]

sets the color of the head element

void setHeadTexture ( const std::string &  filename  )  [virtual]

sets a texture to the head of the snake

virtual void setMotors ( const motor motors,
int  motornumber 
) [pure virtual]

Reads the actual motor commands from an array, an sets all motors of the snake to this values.

It is an linear allocation.

Parameters:
motors pointer to the array, motor values are scaled to [-1,1]
motornumber length of the motor array

Implements AbstractRobot.

Implemented in SchlangeForce, SchlangeServo, SchlangeServo2, and SchlangeVelocity.

void setTexture ( const std::string &  filename  )  [virtual]

sets a texture to the body of the snake note: the head texture of the snake is set by this method too!

void update (  )  [virtual]

update all primitives and joints

Implements OdeRobot.


Member Data Documentation

SchlangeConf conf [protected]
bool created [protected]
std::vector<AngularMotor*> frictionmotors [protected]
std::vector<OdeHandle> spaces [protected]

The documentation for this class was generated from the following files:
Generated on Thu Jun 28 14:48:58 2012 for Robot Simulator of the Robotics Group for Self-Organization of Control by  doxygen 1.6.3