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

# BestFitFormation Class Reference

A class representing a formation selection the "best fitting" formation out of a set of SingleFormations. More...

`#include <FormationObject.h>`

Inheritance diagram for BestFitFormation:

[legend]
Collaboration diagram for BestFitFormation:

[legend]
List of all members.

## Public Member Functions
| BestFitFormation ()
| Constructor.
| ~BestFitFormation ()
| Destructor.
bool | isActive () const
| Checks if the formation is active.
bool | isStatic () const
| Checks if the formation has a static position.
virtual PfVec | getPosition (const PfPose &robotPose)
| Returns the position of the formation in reference to the robot pose (used for A*-search to a formation).
PfVec | getVec (const PfPose &otherPose)
| Returns the field vector to/from a formation to/from a given pose.
double | getCharge (const PfPose &otherPose)
| Returns the field charge of the formation at a given pose.
void | addFormation (SingleFormation *formation)
| Adds a single formation to the set of formations.
void | setBestFitSelection (BestFitSelection bestFitSelection)
| Sets the criterion for choosing the best fitting formation.
SingleFormation * | copy () const
| Creates a copy of the formation object.
## Protected Member Functions
virtual void | updateGeometry ()
| Updates the positions of the formation.
int | findBestFormation (const PfPose &otherPose)
| Determines the best formation.
## Protected Attributes
std::vector< SingleFormation * > | formations
| The set of formations.
std::vector< PfVec > | resultVecs
| A list of vectors corresponding to the formations.
std::vector< double > | resultDistances
| A list of distances corresponding to the formations.
BestFitSelection | bestFitSelection
| The selection criterion.

## Detailed Description

A class representing a formation selection the "best fitting" formation out of a set of SingleFormations.

Definition at line 235 of file FormationObject.h.

## Constructor & Destructor Documentation

BestFitFormation::BestFitFormation | ( |  | ) |

| Constructor. Definition at line 234 of file FormationObject.cpp. Referenced by copy().

BestFitFormation::~BestFitFormation | ( |  | ) |

| Destructor. Definition at line 239 of file FormationObject.cpp. References formations.

## Member Function Documentation

bool BestFitFormation::isActive | ( |  | ) | const`[virtual]`

| Checks if the formation is active. Returns: true, if the formation is active Reimplemented from SingleFormation. Definition at line 307 of file FormationObject.cpp. References formations.

bool BestFitFormation::isStatic | ( |  | ) | const`[virtual]`

| Checks if the formation has a static position. Returns: true, if the formation has a static position Reimplemented from SingleFormation. Definition at line 250 of file FormationObject.cpp. References formations.

PfVec BestFitFormation::getPosition | ( | const PfPose & | robotPose | ) | `[virtual]`

  | Returns the position of the formation in reference to the robot pose (used for A*-search to a formation). Parameters:
  robotPose | The robot pose
Returns: The position of the formation Reimplemented from SingleFormation. Definition at line 265 of file FormationObject.cpp. References findBestFormation(), and formations.

Here is the call graph for this function:

PfVec BestFitFormation::getVec | ( | const PfPose & | otherPose | ) | `[virtual]`

  | Returns the field vector to/from a formation to/from a given pose. Parameters:
  otherPose | The pose on which the formation affects
Returns: The vector Reimplemented from SingleFormation. Definition at line 279 of file FormationObject.cpp. References findBestFormation(), and formations.

Here is the call graph for this function:

double BestFitFormation::getCharge | ( | const PfPose & | otherPose | ) | `[virtual]`

  | Returns the field charge of the formation at a given pose. Parameters:
  otherPose | The pose
Returns: The charge of the formation Reimplemented from SingleFormation. Definition at line 293 of file FormationObject.cpp. References findBestFormation(), and formations.

Here is the call graph for this function:

void BestFitFormation::addFormation | ( | SingleFormation * | formation | ) | `[inline]`

  | Adds a single formation to the set of formations. Parameters:
  formation | The formation
Definition at line 276 of file FormationObject.h. References formations, resultDistances, and resultVecs. Referenced by copy(), and Parser::parseFormationObject().

void BestFitFormation::setBestFitSelection | ( | BestFitSelection | bestFitSelection | ) | `[inline]`

  | Sets the criterion for choosing the best fitting formation. Parameters:
  bestFitSelection | The selection criterion
Definition at line 286 of file FormationObject.h. Referenced by Parser::parseFormationObject().

SingleFormation * BestFitFormation::copy | ( |  | ) | const`[virtual]`

| Creates a copy of the formation object. Returns: A pointer to a copy Reimplemented from SingleFormation. Definition at line 397 of file FormationObject.cpp. References addFormation(), BestFitFormation(), bestFitSelection, formations, resultDistances, and resultVecs.

Here is the call graph for this function:

virtual void BestFitFormation::updateGeometry | ( |  | ) | `[inline, protected, virtual]`

| Updates the positions of the formation. Reimplemented from SingleFormation. Definition at line 305 of file FormationObject.h.

int BestFitFormation::findBestFormation | ( | const PfPose & | otherPose | ) | `[protected]`

  | Determines the best formation. Parameters:
  otherPose | The pose to find the bestFormationFor
Returns: The index of the best formation, -1 if none exists Definition at line 322 of file FormationObject.cpp. References bestFitSelection, formations, SELECT_MAX_GRADIENT, SELECT_MAX_PRIORITY, SELECT_MIN_DISTANCE, and SELECT_MIN_GRADIENT. Referenced by getCharge(), getPosition(), and getVec().

## Member Data Documentation

std::vector<SingleFormation*> BestFitFormation::formations`[protected]`

| The set of formations. Definition at line 296 of file FormationObject.h. Referenced by addFormation(), copy(), findBestFormation(), getCharge(), getPosition(), getVec(), isActive(), isStatic(), and ~BestFitFormation().

std::vector<PfVec> BestFitFormation::resultVecs`[protected]`

| A list of vectors corresponding to the formations. Definition at line 298 of file FormationObject.h. Referenced by addFormation(), and copy().

std::vector<double> BestFitFormation::resultDistances`[protected]`

| A list of distances corresponding to the formations. Definition at line 300 of file FormationObject.h. Referenced by addFormation(), and copy().

BestFitSelection BestFitFormation::bestFitSelection`[protected]`

| The selection criterion. Definition at line 302 of file FormationObject.h. Referenced by copy(), and findBestFormation().

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

- Tools/PotentialFields/FormationObject.h
- Tools/PotentialFields/FormationObject.cpp