#include <BB2004InvKinWalkingEngine.h>
Inheritance diagram for BBInvKinIndividual:
Public Member Functions | |
BBInvKinIndividual () | |
BBInvKinIndividual (const InvKinWalkingParameters ¶meters) | |
virtual void | init (const BBIndividual &initial) |
virtual void | interpolate (const BBIndividual &other) |
virtual void | extrapolate (const BBIndividual &other) |
virtual void | mutate () |
virtual double | getFitness () const |
double | getSpeed () const |
double | getSmoothness () const |
void | setWalkCharacteristics (double speed, double smoothness) |
void | getParameters (InvKinWalkingParameters ¶meters) const |
void | dump () const |
Private Types | |
numOfGenes = 27 | |
enum | { numOfGenes = 27 } |
Private Attributes | |
double | genes [numOfGenes] |
double | fitness |
double | speed |
double | smoothness |
Static Private Attributes | |
static double | geneScale [numOfGenes] |
Definition at line 22 of file BB2004InvKinWalkingEngine.h.
anonymous enum [private] |
Definition at line 25 of file BB2004InvKinWalkingEngine.h.
BBInvKinIndividual::BBInvKinIndividual | ( | ) | [inline] |
BBInvKinIndividual::BBInvKinIndividual | ( | const InvKinWalkingParameters & | parameters | ) |
Constructor.
parameters | The parameters that copied into the genes. |
Definition at line 84 of file BB2004InvKinWalkingEngine.cpp.
References ASSERT, InvKinWalkingParameters::bodyShiftOffset, InvKinWalkingParameters::bodyShiftX, InvKinWalkingParameters::bodyShiftY, InvKinWalkingParameters::foreCenterX, InvKinWalkingParameters::foreFootLift, InvKinWalkingParameters::foreFootTilt, InvKinWalkingParameters::foreHeight, InvKinWalkingParameters::foreWidth, genes, InvKinWalkingParameters::groundPhase, InvKinWalkingParameters::hindCenterX, InvKinWalkingParameters::hindFootLift, InvKinWalkingParameters::hindFootTilt, InvKinWalkingParameters::hindHeight, InvKinWalkingParameters::hindWidth, InvKinWalkingParameters::legPhase, InvKinWalkingParameters::legSpeedFactorR, InvKinWalkingParameters::legSpeedFactorX, InvKinWalkingParameters::legSpeedFactorY, InvKinWalkingParameters::liftPhase, InvKinWalkingParameters::loweringPhase, InvKinWalkingParameters::maxStepSizeX, InvKinWalkingParameters::maxStepSizeY, numOfGenes, and InvKinWalkingParameters::stepLen.
void BBInvKinIndividual::dump | ( | ) | const |
The function prints the genes.
Definition at line 177 of file BB2004InvKinWalkingEngine.cpp.
References OutMessage::finishMessage(), getDebugOut(), OutMemory::getLength(), getParameters(), idText, and OutMessage::text.
Referenced by BB2004InvKinWalkingEngine::learn().
void BBInvKinIndividual::extrapolate | ( | const BBIndividual & | other | ) | [virtual] |
The function extrapolates between the current individual and another one.
other | The other individual the current one is extrapolated with. |
Implements BBIndividual.
Definition at line 61 of file BB2004InvKinWalkingEngine.cpp.
References fitness, genes, numOfGenes, and random().
virtual double BBInvKinIndividual::getFitness | ( | ) | const [inline, virtual] |
The function returns the fitness of the individual.
Implements BBIndividual.
Definition at line 75 of file BB2004InvKinWalkingEngine.h.
References fitness.
Referenced by BB2004InvKinWalkingEngine::learn().
void BBInvKinIndividual::getParameters | ( | InvKinWalkingParameters & | parameters | ) | const |
The function copies the genes into walking parameters.
parameters | The parameters the genes are copied to. |
Definition at line 127 of file BB2004InvKinWalkingEngine.cpp.
References ASSERT, InvKinWalkingParameters::bodyShiftOffset, InvKinWalkingParameters::bodyShiftX, InvKinWalkingParameters::bodyShiftY, InvKinWalkingParameters::counterRotation, InvKinWalkingParameters::footMode, InvKinWalkingParameters::foreCenterX, InvKinWalkingParameters::foreFootLift, InvKinWalkingParameters::foreFootTilt, InvKinWalkingParameters::foreHeight, InvKinWalkingParameters::foreWidth, genes, InvKinWalkingParameters::groundPhase, InvKinWalkingParameters::halfCircle, InvKinWalkingParameters::hindCenterX, InvKinWalkingParameters::hindFootLift, InvKinWalkingParameters::hindFootTilt, InvKinWalkingParameters::hindHeight, InvKinWalkingParameters::hindWidth, int(), InvKinWalkingParameters::legPhase, InvKinWalkingParameters::legSpeedFactorR, InvKinWalkingParameters::legSpeedFactorX, InvKinWalkingParameters::legSpeedFactorY, InvKinWalkingParameters::liftPhase, InvKinWalkingParameters::loweringPhase, InvKinWalkingParameters::maxStepSizeX, InvKinWalkingParameters::maxStepSizeY, numOfGenes, and InvKinWalkingParameters::stepLen.
Referenced by dump(), and BB2004InvKinWalkingEngine::learn().
double BBInvKinIndividual::getSmoothness | ( | ) | const [inline] |
The function returns the smoothness of the walk of the individual.
Definition at line 87 of file BB2004InvKinWalkingEngine.h.
References smoothness.
Referenced by BB2004InvKinWalkingEngine::learn().
double BBInvKinIndividual::getSpeed | ( | ) | const [inline] |
The function returns the speed of the walk of the individual.
Definition at line 81 of file BB2004InvKinWalkingEngine.h.
References speed.
Referenced by BB2004InvKinWalkingEngine::learn().
void BBInvKinIndividual::init | ( | const BBIndividual & | initial | ) | [virtual] |
The function initializes the current individual with another one.
initial | The other individual the current one is initialized with. |
Implements BBIndividual.
Definition at line 34 of file BB2004InvKinWalkingEngine.cpp.
References ASSERT, fitness, geneScale, mutate(), and numOfGenes.
void BBInvKinIndividual::interpolate | ( | const BBIndividual & | other | ) | [virtual] |
The function interpolates between the current individual and another one. The result is stored in the current individual.
other | The other individual the current one is interpolated with. |
Implements BBIndividual.
Definition at line 42 of file BB2004InvKinWalkingEngine.cpp.
References fitness, genes, numOfGenes, and random().
void BBInvKinIndividual::mutate | ( | ) | [virtual] |
The function mutates the current individual.
Implements BBIndividual.
Definition at line 55 of file BB2004InvKinWalkingEngine.cpp.
References genes, geneScale, numOfGenes, and random().
Referenced by init().
void BBInvKinIndividual::setWalkCharacteristics | ( | double | speed, | |
double | smoothness | |||
) |
The function sets the speed and the smoothness of the walk using the individual.
speed | The speed. | |
smoothness | The smoothness. |
Definition at line 77 of file BB2004InvKinWalkingEngine.cpp.
References fitness.
Referenced by BB2004InvKinWalkingEngine::learn().
double BBInvKinIndividual::fitness [private] |
The fitness of this individual.
Definition at line 31 of file BB2004InvKinWalkingEngine.h.
Referenced by BBInvKinIndividual(), extrapolate(), getFitness(), init(), interpolate(), and setWalkCharacteristics().
double BBInvKinIndividual::genes[numOfGenes] [private] |
The genes.
Definition at line 30 of file BB2004InvKinWalkingEngine.h.
Referenced by BBInvKinIndividual(), extrapolate(), getParameters(), interpolate(), and mutate().
double BBInvKinIndividual::geneScale [static, private] |
Initial value:
{ 200, 200, 200, 200, 200, 200, 50, 50, 1, 1, 1, 1, 1, 50, 50, 100, 1, 1, 1, 1, 1, 1, 0.5, 0.5, 10, 10, 10 }
Definition at line 29 of file BB2004InvKinWalkingEngine.h.
double BBInvKinIndividual::smoothness [private] |
The smooothness of the walk using this individual.
Definition at line 31 of file BB2004InvKinWalkingEngine.h.
Referenced by getSmoothness().
double BBInvKinIndividual::speed [private] |
The speed of the walk using this individual.
Definition at line 31 of file BB2004InvKinWalkingEngine.h.
Referenced by getSpeed().