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

# Motionfield Class Reference

A class for computing a motion by using a potential field. More...

`#include <Motionfield.h>`

Inheritance diagram for Motionfield:

[legend]
Collaboration diagram for Motionfield:

[legend]
List of all members.

## Public Member Functions
| Motionfield (const std::string &name)
| Constructor.
virtual | ~Motionfield ()
| Destructor.
void | execute (const PfPose &pose, PotentialfieldResult &result)
| Computes the result of a field.
void | disableDegreesOfFreedom (bool translation, bool rotation)
| Activates or deactivates the degrees of freedom of the field.
void | setAccelerationLimits (double maxAccel, double maxGradientDifference)
| Sets the acceleration limits.
void | addRandomMotionGenerator (RandomMotionGenerator *randomMotionGenerator)
| Adds a random device to this field.
void | addPathPlanner (PfieldAStarSearch *pathPlanner, bool useAlways, PotentialFieldsObject *goal, const PotentialfieldAStarParameterSet &parameterSet, double maxGradientLength)
| Adds a path planner to this a field.
PfVec | getRandomVector ()
| Computes a random vector.
BehaviorFieldType | getBehaviorFieldType () const
| Returns the type of the field.
## Protected Member Functions
PfVec | getFieldVecFromAStarSearch (const PfPose &pose)
| Computes a motion vector using A* search.
bool | reachedLocalMinimum (double currentGradientLength)
| Checks if the field has reached a local minimum.
bool | pathPlanningStillNeeded (const PfPose &pose)
| Checks if the path planner may be turned off.
void | correctMotionVector (PfVec &motionVec) const
| Corrects computed motion vector considering maximum acceleration values.
## Protected Attributes
bool | translationDisabled
| Flag: translation is disabled or not.
bool | rotationDisabled
| Flag: rotation is disabled or not.
double | maxAccel
| Maximum acceleration in vector lengths per square second.
double | maxGradientDifference
| Maximum difference to last gradient in radiant per second.
RandomMotionGenerator * | randomMotionGenerator
| A pointer to a random motion generator.
PfieldAStarSearch * | pathPlanner
| A pointer to an A* path planner.
PotentialfieldAStarParameterSet | aStarParameterSet
| The parameter set for path planning.
bool | alwaysUsePathPlanner
| Flag, true, if the pathPlanner is always used.
bool | pathPlannerActive
| Flag, true if the pathPlanner is currently used.
PotentialFieldsObject * | goal
| The goal for planning.
double | plannedPathLengthToGoal
| The length of the path generated by the planner.
double | maxGradientLengthForLocalMinimum
| The upper limit for the gradient length to detect a local minimum.
PfVec | lastMotionVector
| The last computed motion vector.

## Detailed Description

A class for computing a motion by using a potential field.

Definition at line 28 of file Motionfield.h.

## Constructor & Destructor Documentation

Motionfield::Motionfield | ( | const std::string & | name | ) |

| Constructor. Definition at line 21 of file Motionfield.cpp. References alwaysUsePathPlanner, lastMotionVector, pathPlanner, pathPlannerActive, randomMotionGenerator, rotationDisabled, translationDisabled, PfVec::x, and PfVec::y.

Motionfield::~Motionfield | ( |  | ) | `[virtual]`

| Destructor. Definition at line 35 of file Motionfield.cpp. References aStarParameterSet, pathPlanner, randomMotionGenerator, and PotentialfieldAStarParameterSet::stabilizationObject.

## Member Function Documentation

void Motionfield::execute | ( | const PfPose & | pose,
|  | PotentialfieldResult & | result
| ) | `[virtual]`

  | Computes the result of a field. Parameters:
  pose | The pose on which the field affects
  result | The returned result
Implements Potentialfield. Definition at line 52 of file Motionfield.cpp. References PotentialfieldResult::actionPossible, alwaysUsePathPlanner, correctMotionVector(), CRITERION_CONST, CRITERION_GRADIENT, Potentialfield::getFieldVecAt(), getFieldVecFromAStarSearch(), lastMotionVector, PfVec::length(), PotentialfieldResult::motion, PfVec::normalize(), pathPlanner, pathPlannerActive, pathPlanningStillNeeded(), PfPose::pos, reachedLocalMinimum(), PfVec::rotate(), PfPose::rotation, rotationDisabled, PfPose::speed, PotentialfieldResult::subAction, translationDisabled, PotentialfieldResult::value, PfVec::x, and PfVec::y.

Here is the call graph for this function:

void Motionfield::disableDegreesOfFreedom | ( | bool | translation,
|  | bool | rotation
| ) | `[inline]`

  | Activates or deactivates the degrees of freedom of the field. Parameters:
  translation | Deactivates translation if true
  rotation | Deactivates rotation if true
Definition at line 47 of file Motionfield.h. References rotationDisabled, and translationDisabled. Referenced by Parser::parseMotionfield().

void Motionfield::setAccelerationLimits | ( | double | maxAccel,
|  | double | maxGradientDifference
| ) | `[inline]`

  | Sets the acceleration limits. Parameters:
  maxAccel | The maximum acceleration per second
  maxGradientDifference | Maximum difference to last gradient in radiant per second
Definition at line 54 of file Motionfield.h. Referenced by Parser::parseMotionfield().

void Motionfield::addRandomMotionGenerator | ( | RandomMotionGenerator * | randomMotionGenerator | ) | `[inline]`

  | Adds a random device to this field. Parameters:
  randomMotionGenerator | A random motion generator
Definition at line 60 of file Motionfield.h. Referenced by Parser::parseMotionfield().

void Motionfield::addPathPlanner | ( | PfieldAStarSearch * | pathPlanner,
|  | bool | useAlways,
|  | PotentialFieldsObject * | goal,
|  | const PotentialfieldAStarParameterSet & | parameterSet,
|  | double | maxGradientLength
| ) | `[inline]`

  | Adds a path planner to this a field. Parameters:
  pathPlanner | The path planner
  useAlways | Flag: use always the path planner, if true
  goal | The object to plan a path to
  parameterSet | The parameter set for path planning
  maxGradientLength | The maximum allowed gradient length for not using path planning
Definition at line 70 of file Motionfield.h. References alwaysUsePathPlanner, aStarParameterSet, PotentialfieldAStarParameterSet::field, and maxGradientLengthForLocalMinimum. Referenced by Parser::parseMotionfield().

PfVec Motionfield::getRandomVector | ( |  | ) | `[inline]`

| Computes a random vector. Returns: A random vector Definition at line 85 of file Motionfield.h. References RandomMotionGenerator::getMotionVector(), and randomMotionGenerator.

Here is the call graph for this function:

BehaviorFieldType Motionfield::getBehaviorFieldType | ( |  | ) | const`[inline, virtual]`

| Returns the type of the field. Returns: The type Implements Potentialfield. Definition at line 96 of file Motionfield.h. References BehaviorFieldType, and MOTION_FIELD.

PfVec Motionfield::getFieldVecFromAStarSearch | ( | const PfPose & | pose | ) | `[protected]`

  | Computes a motion vector using A* search. Parameters:
  pose | The beginning of the path
Returns: A vector Definition at line 112 of file Motionfield.cpp. References aStarParameterSet, PotentialfieldAStarNode::getPose(), goal, PfPose::hasProbabilityDistribution, lastMotionVector, PfVec::normalize(), PotentialfieldAStarParameterSet::numberOfCalls, pathPlanner, plannedPathLengthToGoal, PfPose::pos, PfPose::probabilityDistribution, PfPose::rotation, AStarSearch< N, P, U >::search(), PotentialfieldAStarNode::setFunctionValues(), PotentialFieldsObject::setPose(), PotentialfieldAStarNode::setPose(), PotentialfieldAStarNode::setValueAtPos(), PotentialfieldAStarParameterSet::stabilizationDistance, PotentialfieldAStarParameterSet::stabilizationObject, PotentialfieldAStarParameterSet::standardGradientLength, PotentialfieldAStarParameterSet::startPosition, PotentialfieldAStarParameterSet::useStabilization, PfVec::x, and PfVec::y. Referenced by execute().

Here is the call graph for this function:

bool Motionfield::reachedLocalMinimum | ( | double | currentGradientLength | ) | `[protected]`

  | Checks if the field has reached a local minimum. Parameters:
  currentGradientLength | The length of the current gradient vector
Returns: true, if a local minimum has been reached Definition at line 146 of file Motionfield.cpp. References maxGradientLengthForLocalMinimum. Referenced by execute().

bool Motionfield::pathPlanningStillNeeded | ( | const PfPose & | pose | ) | `[protected]`

  | Checks if the path planner may be turned off. Parameters:
  pose | The beginning of the path
Returns: false, if the path planner may be turned off Definition at line 152 of file Motionfield.cpp. References PfPose::addAbsVector(), aStarParameterSet, DEBUG_DRAWING_FINISHED, PotentialfieldAStarParameterSet::distanceToGoal, Potentialfield::getFieldVecAt(), PotentialfieldAStarParameterSet::minExpansionRadius, PfVec::normalize(), PotentialfieldAStarParameterSet::numberOfCalls, plannedPathLengthToGoal, and PfPose::pos. Referenced by execute().

Here is the call graph for this function:

void Motionfield::correctMotionVector | ( | PfVec & | motionVec | ) | const`[protected]`

  | Corrects computed motion vector considering maximum acceleration values. Parameters:
  motionVec | The vector to be corrected
Definition at line 180 of file Motionfield.cpp. References getSystemTime(), lastMotionVector, PfVec::length(), maxAccel, PfVec::normalize(), and PotentialfieldResult::timeStamp. Referenced by execute().

Here is the call graph for this function:

## Member Data Documentation

bool Motionfield::translationDisabled`[protected]`

| Flag: translation is disabled or not. Definition at line 101 of file Motionfield.h. Referenced by disableDegreesOfFreedom(), execute(), and Motionfield().

bool Motionfield::rotationDisabled`[protected]`

| Flag: rotation is disabled or not. Definition at line 103 of file Motionfield.h. Referenced by disableDegreesOfFreedom(), execute(), and Motionfield().

double Motionfield::maxAccel`[protected]`

| Maximum acceleration in vector lengths per square second. Definition at line 105 of file Motionfield.h. Referenced by correctMotionVector().

double Motionfield::maxGradientDifference`[protected]`

| Maximum difference to last gradient in radiant per second. Definition at line 107 of file Motionfield.h.

RandomMotionGenerator* Motionfield::randomMotionGenerator`[protected]`

| A pointer to a random motion generator. Definition at line 109 of file Motionfield.h. Referenced by getRandomVector(), Motionfield(), and ~Motionfield().

PfieldAStarSearch* Motionfield::pathPlanner`[protected]`

| A pointer to an A* path planner. Definition at line 111 of file Motionfield.h. Referenced by execute(), getFieldVecFromAStarSearch(), Motionfield(), and ~Motionfield().

PotentialfieldAStarParameterSet Motionfield::aStarParameterSet`[protected]`

| The parameter set for path planning. Definition at line 113 of file Motionfield.h. Referenced by addPathPlanner(), getFieldVecFromAStarSearch(), pathPlanningStillNeeded(), and ~Motionfield().

bool Motionfield::alwaysUsePathPlanner`[protected]`

| Flag, true, if the pathPlanner is always used. Definition at line 115 of file Motionfield.h. Referenced by addPathPlanner(), execute(), and Motionfield().

bool Motionfield::pathPlannerActive`[protected]`

| Flag, true if the pathPlanner is currently used. Definition at line 117 of file Motionfield.h. Referenced by execute(), and Motionfield().

PotentialFieldsObject* Motionfield::goal`[protected]`

| The goal for planning. Definition at line 119 of file Motionfield.h. Referenced by getFieldVecFromAStarSearch().

double Motionfield::plannedPathLengthToGoal`[protected]`

| The length of the path generated by the planner. Definition at line 121 of file Motionfield.h. Referenced by getFieldVecFromAStarSearch(), and pathPlanningStillNeeded().

double Motionfield::maxGradientLengthForLocalMinimum`[protected]`

| The upper limit for the gradient length to detect a local minimum. Definition at line 123 of file Motionfield.h. Referenced by addPathPlanner(), and reachedLocalMinimum().

PfVec Motionfield::lastMotionVector`[protected]`

| The last computed motion vector. Definition at line 125 of file Motionfield.h. Referenced by correctMotionVector(), execute(), getFieldVecFromAStarSearch(), and Motionfield().

The documentation for this class was generated from the following files:

- Tools/PotentialFields/Motionfield.h
- Tools/PotentialFields/Motionfield.cpp