#include <Actionfield.h>
Inheritance diagram for Actionfield:
Public Member Functions | |
Actionfield (const std::string &name) | |
virtual | ~Actionfield () |
virtual void | init () |
void | execute (const PfPose &pose, PotentialfieldResult &result) |
virtual void | addObject (Object *object) |
void | addAction (const Action &action) |
void | setActionfieldType (ActionfieldType actionfieldType, bool decreasingValuesOnly=false, unsigned int searchDepth=0) |
void | setConsiderTime (bool considerTime) |
PfVec | getFutureFieldVecAt (const PfPose &pose, const std::vector< Object * > &dynamicObjects, int excludedDynamicObject=-1) |
BehaviorFieldType | getBehaviorFieldType () const |
Protected Member Functions | |
double | computeValueAtPose (const PfPose &pose, const std::vector< Object * > &dynamicObjects, int excludedDynamicObject=-1) |
double | computeActionValue (const Action &action, double time, const PfPose &ownPoseBefore, const PfPose &ownPoseAfter, const std::vector< Object * > &objectsBefore, const std::vector< Object * > &objectsAfter, bool &passedPruningCheck) |
void | addManipulatedObject (Action &action) |
void | findBestSequence (unsigned int depth, const PfPose &robotPose, std::vector< unsigned int > &actionSequenceList, double time, double previousValue, PotentialfieldResult &result) |
Protected Attributes | |
std::vector< Object * > | staticObjects |
std::vector< Object * > | dynamicObjects |
std::vector< std::vector< Object * > > | futureWorldStates |
std::vector< PfPose > | futureRobotPoses |
std::vector< Action > | actions |
FutureWorldModelGenerator * | futureWorldModelGenerator |
ActionfieldType | actionfieldType |
unsigned int | worldStateDepth |
bool | decreasingValuesOnly |
double | maxTolerance |
bool | considerTime |
Definition at line 96 of file Actionfield.h.
Actionfield::Actionfield | ( | const std::string & | name | ) |
Constructor
Definition at line 140 of file Actionfield.cpp.
References futureWorldModelGenerator, and FutureWorldModelGenerator::getFutureWorldModelGenerator().
Actionfield::~Actionfield | ( | ) | [virtual] |
Destructor
Definition at line 147 of file Actionfield.cpp.
References actions, dynamicObjects, futureWorldStates, and worldStateDepth.
void Actionfield::addAction | ( | const Action & | action | ) |
Adds an action to the field
action | The action |
Definition at line 230 of file Actionfield.cpp.
References actions.
Referenced by Parser::parseActionfield().
void Actionfield::addManipulatedObject | ( | Action & | action | ) | [protected] |
Adds a manipulated object to the object lists (if it has not been added before) and sets the objectIdx member of the action
action | The action manipulating the object |
Definition at line 214 of file Actionfield.cpp.
References dynamicObjects, Action::manipulatedObject, Action::objectIdx, and Potentialfield::objects.
Referenced by init().
void Actionfield::addObject | ( | Object * | object | ) | [virtual] |
Adds an object to the field
object | The object |
Reimplemented from Potentialfield.
Definition at line 200 of file Actionfield.cpp.
References Potentialfield::addObject(), dynamicObjects, object, and staticObjects.
double Actionfield::computeActionValue | ( | const Action & | action, | |
double | time, | |||
const PfPose & | ownPoseBefore, | |||
const PfPose & | ownPoseAfter, | |||
const std::vector< Object * > & | objectsBefore, | |||
const std::vector< Object * > & | objectsAfter, | |||
bool & | passedPruningCheck | |||
) | [protected] |
Computes the value of an action considering the criterion
action | The action | |
time | The execution of the action / action sequence | |
ownPoseBefore | The robot pose before the action | |
ownPoseAfter | The robot pose after the action | |
objectsBefore | The state of the objects before the action | |
objectsAfter | The state of the objects after the action | |
passedPruningCheck | Flag: true, if the action has not to be pruned |
Definition at line 433 of file Actionfield.cpp.
References Action::actionType, computeValueAtPose(), considerTime, Potentialfield::criterion, CRITERION_ABSOLUTE, CRITERION_GAIN, decreasingValuesOnly, dist(), EPSILON, MEASURE_OBJECT, MEASURE_SELF, MOVE_OBJECT, MOVE_SELF, and Action::objectIdx.
Referenced by execute(), and findBestSequence().
double Actionfield::computeValueAtPose | ( | const PfPose & | pose, | |
const std::vector< Object * > & | dynamicObjects, | |||
int | excludedDynamicObject = -1 | |||
) | [protected] |
Computes the value at a spezific pose in a field consisting of all static objects and all the other, possibly transformed, objects.
pose | The pose to compute the value at | |
dynamicObjects | A set of objects | |
excludedDynamicObject | An object not to use for value computation |
Definition at line 373 of file Actionfield.cpp.
References object, and staticObjects.
Referenced by computeActionValue().
void Actionfield::execute | ( | const PfPose & | pose, | |
PotentialfieldResult & | result | |||
) | [virtual] |
Computes the result of a field
pose | The pose of the robot on which the field affects | |
result | The returned result |
Implements Potentialfield.
Definition at line 236 of file Actionfield.cpp.
References actionfieldType, PotentialfieldResult::actionPossible, actions, computeActionValue(), Potentialfield::criterion, CRITERION_CONST, Potentialfield::criterionParameter, dynamicObjects, findBestSequence(), FIXED_SEQUENCE_FIELD, futureRobotPoses, futureWorldModelGenerator, futureWorldStates, PotentialfieldResult::motion, SINGLE_ACTION_FIELD, PfPose::speed, staticObjects, PotentialfieldResult::subAction, FutureWorldModelGenerator::transformWorldState(), PotentialfieldResult::value, and worldStateDepth.
void Actionfield::findBestSequence | ( | unsigned int | depth, | |
const PfPose & | robotPose, | |||
std::vector< unsigned int > & | actionSequenceList, | |||
double | time, | |||
double | previousValue, | |||
PotentialfieldResult & | result | |||
) | [protected] |
Searches recursively for the best possible action sequence and sets the result
depth | The current depth | |
robotPose | The pose of the robot before any actions | |
actionSequenceList | A list with the sequence of actions | |
time | The time of the previous sequence | |
previousValue | The previous value of the sequence | |
result | The currently best result of the search |
Definition at line 331 of file Actionfield.cpp.
References actions, computeActionValue(), dynamicObjects, futureRobotPoses, futureWorldModelGenerator, futureWorldStates, PotentialfieldResult::motion, staticObjects, PotentialfieldResult::subAction, FutureWorldModelGenerator::transformWorldState(), PotentialfieldResult::value, and worldStateDepth.
Referenced by execute().
BehaviorFieldType Actionfield::getBehaviorFieldType | ( | ) | const [inline, virtual] |
Returns the type of the field
Implements Potentialfield.
Definition at line 157 of file Actionfield.h.
References ACTION_FIELD.
PfVec Actionfield::getFutureFieldVecAt | ( | const PfPose & | pose, | |
const std::vector< Object * > & | dynamicObjects, | |||
int | excludedDynamicObject = -1 | |||
) |
Computes the gradient at a spezific pose in a field consisting of all static objects and all the other, possibly transformed, objects.
pose | The pose to compute the gradient at | |
dynamicObjects | A set of objects | |
excludedDynamicObject | An object not to use for gradient computation |
Definition at line 403 of file Actionfield.cpp.
References object, and staticObjects.
Referenced by FutureWorldModelGenerator::executeSingleTransformation().
void Actionfield::init | ( | ) | [virtual] |
Initializes values and / or allocates additional memory for subsequent computations. This function should be called after all values are set and all objects and actions have been assigned
Reimplemented from Potentialfield.
Definition at line 162 of file Actionfield.cpp.
References actionfieldType, actions, addManipulatedObject(), dynamicObjects, FIXED_SEQUENCE_FIELD, futureRobotPoses, futureWorldStates, MEASURE_OBJECT, MOVE_OBJECT, SINGLE_ACTION_FIELD, and worldStateDepth.
void Actionfield::setActionfieldType | ( | ActionfieldType | actionfieldType, | |
bool | decreasingValuesOnly = false , |
|||
unsigned int | searchDepth = 0 | |||
) | [inline] |
Sets the type of the action field
actionfieldType | The type | |
decreasingValuesOnly | Pruning option, used for sequences | |
searchDepth | The searchDepth used if (actionfieldType==FIND_BEST_SEQUENCE) |
Definition at line 131 of file Actionfield.h.
References decreasingValuesOnly, and worldStateDepth.
Referenced by Parser::parseActionfield().
void Actionfield::setConsiderTime | ( | bool | considerTime | ) | [inline] |
Sets the value of considerTime
considerTime | The new value for considerTime |
Definition at line 141 of file Actionfield.h.
Referenced by Parser::parseActionfield().
ActionfieldType Actionfield::actionfieldType [protected] |
The type of this action field
Definition at line 174 of file Actionfield.h.
std::vector<Action> Actionfield::actions [protected] |
The actions to be applied
Definition at line 170 of file Actionfield.h.
Referenced by addAction(), execute(), findBestSequence(), init(), and ~Actionfield().
bool Actionfield::considerTime [protected] |
Flag: true, if the time of an action when computing its value is to be considered
Definition at line 182 of file Actionfield.h.
Referenced by computeActionValue().
bool Actionfield::decreasingValuesOnly [protected] |
Pruning option, accept only sequences with decreasing values
Definition at line 178 of file Actionfield.h.
Referenced by computeActionValue(), and setActionfieldType().
std::vector<Object*> Actionfield::dynamicObjects [protected] |
Container for dynamic objects
Definition at line 164 of file Actionfield.h.
Referenced by addManipulatedObject(), addObject(), execute(), findBestSequence(), init(), and ~Actionfield().
std::vector< PfPose > Actionfield::futureRobotPoses [protected] |
The future poses of the robot
Definition at line 168 of file Actionfield.h.
Referenced by execute(), findBestSequence(), and init().
A pointer to the FutureWorldModelGenerator
Definition at line 172 of file Actionfield.h.
Referenced by Actionfield(), execute(), and findBestSequence().
std::vector< std::vector<Object*> > Actionfield::futureWorldStates [protected] |
The future world states
Definition at line 166 of file Actionfield.h.
Referenced by execute(), findBestSequence(), init(), and ~Actionfield().
double Actionfield::maxTolerance [protected] |
Pruning option, maximum deviation between two action values
Definition at line 180 of file Actionfield.h.
std::vector<Object*> Actionfield::staticObjects [protected] |
Container for static objects
Definition at line 162 of file Actionfield.h.
Referenced by addObject(), computeValueAtPose(), execute(), findBestSequence(), and getFutureFieldVecAt().
unsigned int Actionfield::worldStateDepth [protected] |
The depth of future world states
Definition at line 176 of file Actionfield.h.
Referenced by execute(), findBestSequence(), init(), setActionfieldType(), and ~Actionfield().