BB2004InvKinWalkingEngine Class Reference

#include <BB2004InvKinWalkingEngine.h>

Inheritance diagram for BB2004InvKinWalkingEngine:

WalkingEngine Module WalkingEngineInterfaces RobotDimensions MessageHandler List of all members.

Public Member Functions

 BB2004InvKinWalkingEngine (InvKinWalkingEngine *pEngine)
 ~BB2004InvKinWalkingEngine ()
virtual bool executeParameterized (JointData &jointData, const WalkRequest &walkRequest, double positionInWalkingCycle)
bool handleMessage (InMessage &message)

Private Types

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

Private Member Functions

void learn (const WalkRequest &walkRequest)
void setParameters (const BBIndividual &p)
void loadParameters (InvKinWalkingParameters &parameters, const char *name)
double stdV (SensorData::sensors s) const
void updateOdometry ()

Private Attributes

InvKinWalkingEnginepEngine
ERS7EvolveWalkingParameters parameters [2]
ERS7EvolveWalkingParameters bestParameters
ERS7EvolveWalkingParameters forward
ERS7EvolveWalkingParameters fastForward
ERS7EvolveWalkingParameters backward
ERS7EvolveWalkingParameters stand
int currentParameters
int currentIndividual
int currentFrame
int evolutions
double bestFitness
Pose2D odometrySpeed
double odometryScaleX
double odometryScaleY
double odometryScaleRotation
double odometryCounterRotation
RingBuffer< Vector2< double >, 100 > odometrySums [2]
FootPositions prevPositions
RingBuffer< SensorData, numOfFramesPerIndividual > buffer
Pose2D measured
Pose2D target
BBPopulation< BBInvKinIndividual > * population

Classes

class  FootPositions

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]

Enumerator:
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, buffer, RobotDesign::ERS210, fastForward, forward, getRobotConfiguration(), RingBuffer< V, n >::init(), loadParameters(), numOfIndividuals, odometryCounterRotation, odometryScaleRotation, odometryScaleX, odometryScaleY, parameters, population, and stand.

BB2004InvKinWalkingEngine::~BB2004InvKinWalkingEngine (  )  [inline]

Destructor.

Definition at line 212 of file BB2004InvKinWalkingEngine.h.

References population.


Member Function Documentation

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, evolutions, InvKinWalkingEngine::executeParameterized(), fastForward, getDebugKeyTable(), learn(), DebugKeyTable::learnWalking, WalkingEngineInterfaces::odometryData, pEngine, Pose2D::rotation, InvKinWalkingEngine::setParameters(), stand, Pose2D::translation, updateOdometry(), WalkRequest::walkParams, Vector2< V >::x, and Vector2< V >::y.

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, d, InMessage::getMessageID(), InvKinWalkingEngine::handleMessage(), idOdometryScale, odometryCounterRotation, odometryScaleRotation, odometryScaleX, odometryScaleY, and pEngine.

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< V >::abs(), SensorData::accelerationX, SensorData::accelerationY, SensorData::accelerationZ, RingBuffer< V, n >::add(), Statistics::analyze(), SensorData::back, bestFitness, bestParameters, buffer, currentFrame, currentIndividual, SensorData::data, BBInvKinIndividual::dump(), evolutions, OutMessage::finishMessage(), SensorDataBuffer::frame, SensorData::frameNumber, getDebugOut(), BBInvKinIndividual::getFitness(), BBInvKinIndividual::getParameters(), BBInvKinIndividual::getSmoothness(), BBInvKinIndividual::getSpeed(), idText, ignoreFrames, SensorDataBuffer::lastFrame(), measured, RobotDimensions::motionCycleTime, SensorDataBuffer::numOfFrames, numOfFramesPerIndividual, numOfIndividuals, OUTPUT, population, Pose2D::rotation, WalkingEngineInterfaces::sensorDataBuffer, setParameters(), BBInvKinIndividual::setWalkCharacteristics(), stdV(), target, OutMessage::text, text, Pose2D::translation, WalkRequest::walkParams, Vector2< V >::x, and Vector2< V >::y.

Referenced by executeParameterized().

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 InvKinWalkingParameters::CorrectionValues::backward, InvKinWalkingParameters::correctionValues, RobotDesign::ERS210, InFile::exists(), InvKinWalkingParameters::CorrectionValues::forward, getRobotConfiguration(), InvKinWalkingParameters::init(), InvKinWalkingParameters::leaveAnytime, InvKinWalkingParameters::maxStepSizeR, InvKinWalkingParameters::maxStepSizeX, InvKinWalkingParameters::maxStepSizeY, parameters, InvKinWalkingParameters::CorrectionValues::rotationCenter, InvKinWalkingParameters::CorrectionValues::sideward, and InvKinWalkingParameters::CorrectionValues::turning.

Referenced by BB2004InvKinWalkingEngine().

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_ROT_SPEED, MAX_SPEED, InvKinWalkingParameters::maxStepSizeR, InvKinWalkingParameters::maxStepSizeX, InvKinWalkingParameters::maxStepSizeY, parameters, pEngine, InvKinWalkingEngine::setParameters(), InvKinWalkingParameters::CorrectionValues::sideward, and InvKinWalkingParameters::CorrectionValues::turning.

Referenced by learn().

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 average(), buffer, data, 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< V, n >::add(), Kinematics::calcNeckAndLegPositions(), SensorDataBuffer::frame, InvKinWalkingEngine::getParameters(), InvKinWalkingParameters::hindWidth, SensorDataBuffer::numOfFrames, odometryCounterRotation, odometryScaleRotation, odometryScaleX, odometryScaleY, odometrySpeed, odometrySums, BB2004InvKinWalkingEngine::FootPositions::onGround, SensorData::pawHL, SensorData::pawHR, pEngine, BB2004InvKinWalkingEngine::FootPositions::positions, prevPositions, WalkingEngineInterfaces::receivedNewSensorData, Pose2D::rotation, WalkingEngineInterfaces::sensorDataBuffer, InvKinWalkingParameters::stepLen, Pose2D::translation, Vector2< V >::x, Vector3< V >::x, Vector2< V >::y, and Vector3< V >::y.

Referenced by executeParameterized().


Member Data Documentation

ERS7EvolveWalkingParameters BB2004InvKinWalkingEngine::backward [private]

Parameters for backward walking.

Definition at line 136 of file BB2004InvKinWalkingEngine.h.

Referenced by BB2004InvKinWalkingEngine(), and executeParameterized().

double BB2004InvKinWalkingEngine::bestFitness [private]

The best overall fitness found so far.

Definition at line 146 of file BB2004InvKinWalkingEngine.h.

Referenced by learn().

ERS7EvolveWalkingParameters BB2004InvKinWalkingEngine::bestParameters [private]

The best parameters found so far.

Definition at line 136 of file BB2004InvKinWalkingEngine.h.

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

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

A buffer for previous sensor readings.

Definition at line 161 of file BB2004InvKinWalkingEngine.h.

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

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.

Referenced by learn().

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::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::evolutions [private]

The number of evolutions done so far.

Definition at line 145 of file BB2004InvKinWalkingEngine.h.

Referenced by executeParameterized(), and learn().

ERS7EvolveWalkingParameters BB2004InvKinWalkingEngine::fastForward [private]

Parameters for fast forward walking.

Definition at line 136 of file BB2004InvKinWalkingEngine.h.

Referenced by BB2004InvKinWalkingEngine(), and executeParameterized().

ERS7EvolveWalkingParameters BB2004InvKinWalkingEngine::forward [private]

Parameters for forward walking.

Definition at line 136 of file BB2004InvKinWalkingEngine.h.

Referenced by BB2004InvKinWalkingEngine().

Pose2D BB2004InvKinWalkingEngine::measured [private]

Accumulated odometry for current individual.

Definition at line 162 of file BB2004InvKinWalkingEngine.h.

Referenced by learn().

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().

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::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().

Pose2D BB2004InvKinWalkingEngine::odometrySpeed [private]

The current speed of the robot.

Definition at line 147 of file BB2004InvKinWalkingEngine.h.

Referenced by 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().

ERS7EvolveWalkingParameters BB2004InvKinWalkingEngine::parameters[2] [private]

Two parameter sets that are interchangingly used.

Definition at line 136 of file BB2004InvKinWalkingEngine.h.

Referenced by BB2004InvKinWalkingEngine(), loadParameters(), and setParameters().

InvKinWalkingEngine* BB2004InvKinWalkingEngine::pEngine [private]

The address of the actual walking engine.

Definition at line 135 of file BB2004InvKinWalkingEngine.h.

Referenced by executeParameterized(), handleMessage(), setParameters(), and updateOdometry().

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

The population of individuals.

Definition at line 164 of file BB2004InvKinWalkingEngine.h.

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

FootPositions BB2004InvKinWalkingEngine::prevPositions [private]

The previous positions of the feet.

Definition at line 153 of file BB2004InvKinWalkingEngine.h.

Referenced by updateOdometry().

ERS7EvolveWalkingParameters BB2004InvKinWalkingEngine::stand [private]

Parameters for standing.

Definition at line 136 of file BB2004InvKinWalkingEngine.h.

Referenced by BB2004InvKinWalkingEngine(), and executeParameterized().

Pose2D BB2004InvKinWalkingEngine::target [private]

Accumulated request motion for current individual.

Definition at line 162 of file BB2004InvKinWalkingEngine.h.

Referenced by learn().


The documentation for this class was generated from the following files:
Generated on Thu Dec 7 01:19:10 2006 for DT2005.panorama by  doxygen 1.4.7