#include <BB2004InvKinWalkingEngine.h>
Inheritance diagram for BB2004InvKinWalkingEngine:
Definition at line 115 of file BB2004InvKinWalkingEngine.h.
anonymous enum [private] |
Definition at line 154 of file BB2004InvKinWalkingEngine.h.
BB2004InvKinWalkingEngine::BB2004InvKinWalkingEngine | ( | InvKinWalkingEngine * | pEngine | ) |
Constructor.
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] |
bool BB2004InvKinWalkingEngine::executeParameterized | ( | JointData & | jointData, | |
const WalkRequest & | walkRequest, | |||
double | positionInWalkingCycle | |||
) | [virtual] |
The function executes the walking engine.
jointData | The joints already set by other modules. | |
walkRequest | The motion request to execute. | |
positionInWalkingCycle | The position in walking cycle requested |
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.
message | The message sent. |
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
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 | 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.
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.
s | The sensor. |
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().
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().
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().
Parameters for fast forward walking.
Definition at line 136 of file BB2004InvKinWalkingEngine.h.
Referenced by BB2004InvKinWalkingEngine(), and executeParameterized().
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().
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().
Two parameter sets that are interchangingly used.
Definition at line 136 of file BB2004InvKinWalkingEngine.h.
Referenced by BB2004InvKinWalkingEngine(), loadParameters(), and setParameters().
The address of the actual walking engine.
Definition at line 135 of file BB2004InvKinWalkingEngine.h.
Referenced by executeParameterized(), handleMessage(), setParameters(), and updateOdometry().
The population of individuals.
Definition at line 164 of file BB2004InvKinWalkingEngine.h.
Referenced by BB2004InvKinWalkingEngine(), learn(), and ~BB2004InvKinWalkingEngine().
The previous positions of the feet.
Definition at line 153 of file BB2004InvKinWalkingEngine.h.
Referenced by updateOdometry().
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().