Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

BB2004InvKinWalkingEngine Class Reference

This class implements a walking engine that optimizes its parameters using evolutionary algorithms. More...

#include <BB2004InvKinWalkingEngine.h>

Inheritance diagram for BB2004InvKinWalkingEngine:

Inheritance graph
[legend]
Collaboration diagram for BB2004InvKinWalkingEngine:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 BB2004InvKinWalkingEngine (InvKinWalkingEngine *pEngine)
 Constructor.

 ~BB2004InvKinWalkingEngine ()
 Destructor.

virtual bool executeParameterized (JointData &jointData, const WalkRequest &walkRequest, double positionInWalkingCycle)
 The function executes the walking engine.

bool handleMessage (InMessage &message)
 The function handles a message sent by the PC.


Private Types

enum  {
  numOfIndividuals = 15, numOfFramesPerIndividual = 625, ignoreFrames = 250,
  useFrames = numOfFramesPerIndividual - ignoreFrames
}

Private Member Functions

void learn (const WalkRequest &walkRequest)
 The function optimizes the gait for the current motion request.

void setParameters (const BBIndividual &p)
 The function sets a new parameter set using the individual specified.

void loadParameters (InvKinWalkingParameters &parameters, const char *name)
 The function loads a set of walking parameters.

double stdV (SensorData::sensors s) const
 The function calculates the standard deviation of the last "useFrames" measurements of a certain sensor.

void updateOdometry ()
 The function updates the odometry.


Private Attributes

InvKinWalkingEnginepEngine
 The address of the actual walking engine.

ERS7EvolveWalkingParameters parameters [2]
 Two parameter sets that are interchangingly used.

ERS7EvolveWalkingParameters bestParameters
 The best parameters found so far.

ERS7EvolveWalkingParameters forward
 Parameters for forward walking.

ERS7EvolveWalkingParameters fastForward
 Parameters for fast forward walking.

ERS7EvolveWalkingParameters backward
 Parameters for backward walking.

ERS7EvolveWalkingParameters stand
 Parameters for standing.

int currentParameters
 The index that defines which of the two "parameters" are currently used.

int currentIndividual
 The index of the current individual in the population.

int currentFrame
 The index of the current frame that measures the performance of the current individual.

int evolutions
 The number of evolutions done so far.

double bestFitness
 The best overall fitness found so far.

Pose2D odometrySpeed
 The current speed of the robot.

double odometryScaleX
 The scale factor for odometry in x direction.

double odometryScaleY
 The scale factor for odometry in y direction.

double odometryScaleRotation
 The scale factor for odometry rotation.

double odometryCounterRotation
 A factor that compensates rotation resulting from sideward motion.

RingBuffer< Vector2< double >, 100 > odometrySums [2]
 The current state of the odometers.

FootPositions prevPositions
 The previous positions of the feet.

RingBuffer< SensorData, numOfFramesPerIndividual > buffer
 A buffer for previous sensor readings.

Pose2D measured
 Accumulated odometry for current individual.

Pose2D target
 Accumulated request motion for current individual.

BBPopulation< BBInvKinIndividual > * population
 The population of individuals.


Detailed Description

This class implements a walking engine that optimizes its parameters using evolutionary algorithms.

Definition at line 115 of file BB2004InvKinWalkingEngine.h.


Member Enumeration Documentation

anonymous enum [private]
 

Enumeration values:
numOfIndividuals  The number of individuals in the population.
numOfFramesPerIndividual  The number of frames tested per individual.
ignoreFrames  The number of frames to ignore at the beginning of an individual.
useFrames  The number of frames that are assessed per individual.

Definition at line 154 of file BB2004InvKinWalkingEngine.h.


Constructor & Destructor Documentation

BB2004InvKinWalkingEngine::BB2004InvKinWalkingEngine InvKinWalkingEngine pEngine  ) 
 

Constructor.

Parameters:
pEngine The actual walking engine used.

Definition at line 189 of file BB2004InvKinWalkingEngine.cpp.

References backward, bestParameters, InFile::exists(), fastForward, forward, getRobotConfiguration(), RingBuffer< SensorData, numOfFramesPerIndividual >::init(), loadParameters(), odometryCounterRotation, odometryScaleRotation, odometryScaleX, and odometryScaleY.

Here is the call graph for this function:

BB2004InvKinWalkingEngine::~BB2004InvKinWalkingEngine  )  [inline]
 

Destructor.

Definition at line 212 of file BB2004InvKinWalkingEngine.h.


Member Function Documentation

void BB2004InvKinWalkingEngine::learn const WalkRequest walkRequest  )  [private]
 

The function optimizes the gait for the current motion request.

<<<<<<< BB2004InvKinWalkingEngine.h

Parameters:
walkRequest The current walk request. =======
walkRequest The current motion request. >>>>>>> 1.7

Definition at line 279 of file BB2004InvKinWalkingEngine.cpp.

References Vector2< double >::abs(), RingBuffer< SensorData, numOfFramesPerIndividual >::add(), Statistics::analyze(), bestFitness, bestParameters, currentIndividual, SensorData::data, BBInvKinIndividual::dump(), BBPopulation< BBInvKinIndividual >::extrapolate(), OutMessage::finishMessage(), SensorDataBuffer::frame, SensorData::frameNumber, getDebugOut(), BBInvKinIndividual::getFitness(), BBPopulation< BBInvKinIndividual >::getFittest(), BBInvKinIndividual::getParameters(), BBInvKinIndividual::getSmoothness(), BBInvKinIndividual::getSpeed(), BBPopulation< BBInvKinIndividual >::getStatistics(), idText, ignoreFrames, BBPopulation< BBInvKinIndividual >::interpolate(), SensorDataBuffer::lastFrame(), measured, SensorDataBuffer::numOfFrames, numOfFramesPerIndividual, OUTPUT, Pose2D::rotation, setParameters(), BBInvKinIndividual::setWalkCharacteristics(), stdV(), target, OutMessage::text, Pose2D::translation, WalkRequest::walkParams, Vector2< double >::x, and Vector2< double >::y.

Referenced by executeParameterized().

Here is the call graph for this function:

void BB2004InvKinWalkingEngine::setParameters const BBIndividual p  )  [private]
 

The function sets a new parameter set using the individual specified.

Parameters:
p The individual that is used to set the walking parameters.

Definition at line 214 of file BB2004InvKinWalkingEngine.cpp.

References InvKinWalkingParameters::CorrectionValues::backward, InvKinWalkingParameters::correctionValues, currentParameters, InvKinWalkingParameters::CorrectionValues::forward, InvKinWalkingParameters::init(), InvKinWalkingParameters::leaveAnytime, MAX_SPEED, InvKinWalkingParameters::maxStepSizeR, InvKinWalkingParameters::maxStepSizeX, InvKinWalkingParameters::maxStepSizeY, InvKinWalkingEngine::setParameters(), InvKinWalkingParameters::CorrectionValues::sideward, and InvKinWalkingParameters::CorrectionValues::turning.

Referenced by learn().

Here is the call graph for this function:

void BB2004InvKinWalkingEngine::loadParameters InvKinWalkingParameters parameters,
const char *  name
[private]
 

The function loads a set of walking parameters.

Parameters:
parameters The variable that receives the loaded parameters.
name The name of the parameters. It will automatically be preceeded by the current robot design.

Definition at line 228 of file BB2004InvKinWalkingEngine.cpp.

References InFile::exists(), getRobotConfiguration(), and InvKinWalkingParameters::init().

Referenced by BB2004InvKinWalkingEngine().

Here is the call graph for this function:

double BB2004InvKinWalkingEngine::stdV SensorData::sensors  s  )  const [private]
 

The function calculates the standard deviation of the last "useFrames" measurements of a certain sensor.

Parameters:
s The sensor.
Returns:
The standard deviation of the measurements of s.

Definition at line 367 of file BB2004InvKinWalkingEngine.cpp.

References numOfFramesPerIndividual, and useFrames.

Referenced by learn().

void BB2004InvKinWalkingEngine::updateOdometry  )  [private]
 

The function updates the odometry.

Definition at line 380 of file BB2004InvKinWalkingEngine.cpp.

References RingBuffer< Vector2< double >, 100 >::add(), Kinematics::calcNeckAndLegPositions(), SensorData::data, RobotVertices::footPosition, SensorDataBuffer::frame, getDebugKeyTable(), InvKinWalkingEngine::getParameters(), InvKinWalkingParameters::hindWidth, DebugKeyTable::isActive(), measured, SensorDataBuffer::numOfFrames, odometryCounterRotation, odometryScaleRotation, odometryScaleX, odometryScaleY, odometrySpeed, odometrySums, BB2004InvKinWalkingEngine::FootPositions::onGround, BB2004InvKinWalkingEngine::FootPositions::positions, prevPositions, Pose2D::rotation, InvKinWalkingParameters::stepLen, Pose2D::translation, Vector2< V >::x, Vector2< double >::x, Vector3< V >::x, Vector2< V >::y, Vector2< double >::y, and Vector3< V >::y.

Referenced by executeParameterized().

Here is the call graph for this function:

bool BB2004InvKinWalkingEngine::executeParameterized JointData jointData,
const WalkRequest walkRequest,
double  positionInWalkingCycle
[virtual]
 

The function executes the walking engine.

Parameters:
jointData The joints already set by other modules.
walkRequest The motion request to execute.
positionInWalkingCycle The position in walking cycle requested
Returns:
Is it forbidden to change to another kind of motion (e.g. special action)?

Implements WalkingEngine.

Definition at line 252 of file BB2004InvKinWalkingEngine.cpp.

References backward, bestParameters, currentIndividual, InvKinWalkingEngine::executeParameterized(), fastForward, getDebugKeyTable(), DebugKeyTable::isActive(), learn(), Pose2D::rotation, InvKinWalkingEngine::setParameters(), Pose2D::translation, updateOdometry(), WalkRequest::walkParams, Vector2< double >::x, and Vector2< double >::y.

Here is the call graph for this function:

bool BB2004InvKinWalkingEngine::handleMessage InMessage message  )  [virtual]
 

The function handles a message sent by the PC.

Parameters:
message The message sent.
Returns:
Was the message handled by this function?

Reimplemented from Module.

Definition at line 437 of file BB2004InvKinWalkingEngine.cpp.

References InMessage::bin, GenericDebugData::data, InMessage::getMessageID(), InvKinWalkingEngine::handleMessage(), idOdometryScale, odometryCounterRotation, odometryScaleRotation, odometryScaleX, and odometryScaleY.

Here is the call graph for this function:


Member Data Documentation

InvKinWalkingEngine* BB2004InvKinWalkingEngine::pEngine [private]
 

The address of the actual walking engine.

Definition at line 135 of file BB2004InvKinWalkingEngine.h.

ERS7EvolveWalkingParameters BB2004InvKinWalkingEngine::parameters[2] [private]
 

Two parameter sets that are interchangingly used.

Definition at line 136 of file BB2004InvKinWalkingEngine.h.

ERS7EvolveWalkingParameters BB2004InvKinWalkingEngine::bestParameters [private]
 

The best parameters found so far.

Definition at line 136 of file BB2004InvKinWalkingEngine.h.

Referenced by BB2004InvKinWalkingEngine(), executeParameterized(), and learn().

ERS7EvolveWalkingParameters BB2004InvKinWalkingEngine::forward [private]
 

Parameters for forward walking.

Definition at line 136 of file BB2004InvKinWalkingEngine.h.

Referenced by BB2004InvKinWalkingEngine().

ERS7EvolveWalkingParameters BB2004InvKinWalkingEngine::fastForward [private]
 

Parameters for fast forward walking.

Definition at line 136 of file BB2004InvKinWalkingEngine.h.

Referenced by BB2004InvKinWalkingEngine(), and executeParameterized().

ERS7EvolveWalkingParameters BB2004InvKinWalkingEngine::backward [private]
 

Parameters for backward walking.

Definition at line 136 of file BB2004InvKinWalkingEngine.h.

Referenced by BB2004InvKinWalkingEngine(), and executeParameterized().

ERS7EvolveWalkingParameters BB2004InvKinWalkingEngine::stand [private]
 

Parameters for standing.

Definition at line 136 of file BB2004InvKinWalkingEngine.h.

int BB2004InvKinWalkingEngine::currentParameters [private]
 

The index that defines which of the two "parameters" are currently used.

Definition at line 142 of file BB2004InvKinWalkingEngine.h.

Referenced by setParameters().

int BB2004InvKinWalkingEngine::currentIndividual [private]
 

The index of the current individual in the population.

Definition at line 143 of file BB2004InvKinWalkingEngine.h.

Referenced by executeParameterized(), and learn().

int BB2004InvKinWalkingEngine::currentFrame [private]
 

The index of the current frame that measures the performance of the current individual.

Definition at line 144 of file BB2004InvKinWalkingEngine.h.

int BB2004InvKinWalkingEngine::evolutions [private]
 

The number of evolutions done so far.

Definition at line 145 of file BB2004InvKinWalkingEngine.h.

double BB2004InvKinWalkingEngine::bestFitness [private]
 

The best overall fitness found so far.

Definition at line 146 of file BB2004InvKinWalkingEngine.h.

Referenced by learn().

Pose2D BB2004InvKinWalkingEngine::odometrySpeed [private]
 

The current speed of the robot.

Definition at line 147 of file BB2004InvKinWalkingEngine.h.

Referenced by updateOdometry().

double BB2004InvKinWalkingEngine::odometryScaleX [private]
 

The scale factor for odometry in x direction.

Definition at line 148 of file BB2004InvKinWalkingEngine.h.

Referenced by BB2004InvKinWalkingEngine(), handleMessage(), and updateOdometry().

double BB2004InvKinWalkingEngine::odometryScaleY [private]
 

The scale factor for odometry in y direction.

Definition at line 148 of file BB2004InvKinWalkingEngine.h.

Referenced by BB2004InvKinWalkingEngine(), handleMessage(), and updateOdometry().

double BB2004InvKinWalkingEngine::odometryScaleRotation [private]
 

The scale factor for odometry rotation.

Definition at line 148 of file BB2004InvKinWalkingEngine.h.

Referenced by BB2004InvKinWalkingEngine(), handleMessage(), and updateOdometry().

double BB2004InvKinWalkingEngine::odometryCounterRotation [private]
 

A factor that compensates rotation resulting from sideward motion.

Definition at line 148 of file BB2004InvKinWalkingEngine.h.

Referenced by BB2004InvKinWalkingEngine(), handleMessage(), and updateOdometry().

RingBuffer<Vector2<double>, 100> BB2004InvKinWalkingEngine::odometrySums[2] [private]
 

The current state of the odometers.

Definition at line 152 of file BB2004InvKinWalkingEngine.h.

Referenced by updateOdometry().

FootPositions BB2004InvKinWalkingEngine::prevPositions [private]
 

The previous positions of the feet.

Definition at line 153 of file BB2004InvKinWalkingEngine.h.

Referenced by updateOdometry().

RingBuffer<SensorData, numOfFramesPerIndividual> BB2004InvKinWalkingEngine::buffer [private]
 

A buffer for previous sensor readings.

Definition at line 161 of file BB2004InvKinWalkingEngine.h.

Pose2D BB2004InvKinWalkingEngine::measured [private]
 

Accumulated odometry for current individual.

Definition at line 162 of file BB2004InvKinWalkingEngine.h.

Referenced by learn(), and updateOdometry().

Pose2D BB2004InvKinWalkingEngine::target [private]
 

Accumulated request motion for current individual.

Definition at line 162 of file BB2004InvKinWalkingEngine.h.

Referenced by learn().

BBPopulation<BBInvKinIndividual>* BB2004InvKinWalkingEngine::population [private]
 

The population of individuals.

Definition at line 164 of file BB2004InvKinWalkingEngine.h.


The documentation for this class was generated from the following files:
Generated on Thu Sep 23 20:04:34 2004 for GT2004 by doxygen 1.3.6