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

# SingleFormation Class Reference

An abstract class representing a simple formation. More...

`#include <FormationObject.h>`

Inheritance diagram for SingleFormation:

[legend]
Collaboration diagram for SingleFormation:

[legend]
List of all members.

## Public Member Functions
| SingleFormation ()
| Constructor.
virtual | ~SingleFormation ()
| Destructor.
virtual bool | isActive () const
| Checks if the formation is active.
virtual 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).
virtual PfVec | getVec (const PfPose &otherPose)
| Returns the field vector to/from a formation to/from a given pose.
virtual double | getCharge (const PfPose &otherPose)
| Returns the field charge of the formation at a given pose.
double | getDistanceToFormation (const PfPose &otherPose) const
| Returns the distance between a pose and the formation area.
void | addObject (PotentialFieldsObject *object)
| Adds an object to the formation.
void | setFunction (PotentialfieldFunction *function)
| Sets the function of the field of the formation.
void | setPriority (double priority)
| Sets the priority of the formation.
double | getPriority () const
| Returns the priority of the formation.
void | init ()
| Initializes the formation.
virtual bool | positionInsideFormation (const PfVec &p) const
| Checks if a position is inside the formation area.
virtual SingleFormation * | copy () const
| Creates a copy of the formation object.
## Protected Member Functions
virtual void | updateGeometry ()
| Updates the positions of the formation.
## Protected Attributes
std::vector< PotentialFieldsObject * > | objects
| The objects the formation is spanning.
PotentialFieldsObject | geometricFormationObject
| An object representing the shape of the formation.
PfVec | robotPosition
| The position of the robot (kept for internal purposes).
double | priority
| The priority of the formation (may be used for selection).

## Detailed Description

An abstract class representing a simple formation.

Definition at line 35 of file FormationObject.h.

## Constructor & Destructor Documentation

SingleFormation::SingleFormation | ( |  | ) |

| Constructor. Definition at line 17 of file FormationObject.cpp. References geometricFormationObject, PotentialFieldsObject::setField(), and SHAPE_FIELD. Referenced by copy().

Here is the call graph for this function:

virtual SingleFormation::~SingleFormation | ( |  | ) | `[inline, virtual]`

| Destructor. Definition at line 42 of file FormationObject.h.

## Member Function Documentation

virtual bool SingleFormation::isActive | ( |  | ) | const`[inline, virtual]`

| Checks if the formation is active. Returns: true, if the formation is active Reimplemented in BetweenFormation, AmongFormation, RelativeFormation, and BestFitFormation. Definition at line 47 of file FormationObject.h.

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

| Checks if the formation has a static position. Returns: true, if the formation has a static position Reimplemented in BestFitFormation. Definition at line 23 of file FormationObject.cpp. References objects.

PfVec SingleFormation::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 in BestFitFormation. Definition at line 37 of file FormationObject.cpp. References Polygon::distanceTo(), geometricFormationObject, PotentialFieldsObject::getGeometry(), PfPose::pos, robotPosition, and updateGeometry().

Here is the call graph for this function:

PfVec SingleFormation::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 in BestFitFormation. Definition at line 55 of file FormationObject.cpp. References PotentialFieldsObject::computeAbsFieldVecAt(), geometricFormationObject, PfPose::pos, positionInsideFormation(), robotPosition, and updateGeometry().

Here is the call graph for this function:

double SingleFormation::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 in BestFitFormation. Definition at line 70 of file FormationObject.cpp. References PotentialFieldsObject::computeChargeAt(), geometricFormationObject, PfPose::pos, robotPosition, and updateGeometry().

Here is the call graph for this function:

double SingleFormation::getDistanceToFormation | ( | const PfPose & | otherPose | ) | const

  | Returns the distance between a pose and the formation area. Parameters:
  otherPose | The pose
Returns: The distance Definition at line 84 of file FormationObject.cpp. References PfieldGeometricObject::distanceTo(), geometricFormationObject, PotentialFieldsObject::getGeometry(), and PfPose::pos.

Here is the call graph for this function:

void SingleFormation::addObject | ( | PotentialFieldsObject * | object | ) |

  | Adds an object to the formation. Parameters:
  object | The object
Definition at line 78 of file FormationObject.cpp. References objects. Referenced by Parser::parseSingleFormation().

void SingleFormation::setFunction | ( | PotentialfieldFunction * | function | ) | `[inline]`

  | Sets the function of the field of the formation. Parameters:
  function | The function
Definition at line 88 of file FormationObject.h. References geometricFormationObject, and PotentialFieldsObject::setFunction(). Referenced by Parser::parseSingleFormation().

Here is the call graph for this function:

void SingleFormation::setPriority | ( | double | priority | ) | `[inline]`

  | Sets the priority of the formation. Parameters:
  priority |
Definition at line 94 of file FormationObject.h. Referenced by Parser::parseSingleFormation().

double SingleFormation::getPriority | ( |  | ) | const`[inline]`

| Returns the priority of the formation. Returns: The priority Definition at line 100 of file FormationObject.h. References priority.

void SingleFormation::init | ( |  | ) | `[inline]`

| Initializes the formation. Definition at line 104 of file FormationObject.h. References updateGeometry(). Referenced by Parser::parseSingleFormation().

Here is the call graph for this function:

virtual bool SingleFormation::positionInsideFormation | ( | const PfVec & | p | ) | const`[inline, virtual]`

  | Checks if a position is inside the formation area. Parameters:
  p | The position
Returns: true, if the position is inside Reimplemented in BetweenFormation, and AmongFormation. Definition at line 111 of file FormationObject.h. Referenced by getVec().

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

| Creates a copy of the formation object. Returns: A pointer to a copy Reimplemented in RelativeFormation, and BestFitFormation. Definition at line 92 of file FormationObject.cpp. References geometricFormationObject, objects, priority, robotPosition, and SingleFormation().

Here is the call graph for this function:

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

| Updates the positions of the formation. Reimplemented in BetweenFormation, AmongFormation, RelativeFormation, and BestFitFormation. Definition at line 129 of file FormationObject.h. Referenced by getCharge(), getPosition(), getVec(), and init().

## Member Data Documentation

std::vector<PotentialFieldsObject*> SingleFormation::objects`[protected]`

| The objects the formation is spanning. Definition at line 121 of file FormationObject.h. Referenced by addObject(), RelativeFormation::copy(), copy(), and isStatic().

PotentialFieldsObject SingleFormation::geometricFormationObject`[protected]`

| An object representing the shape of the formation. Definition at line 123 of file FormationObject.h. Referenced by RelativeFormation::copy(), copy(), getCharge(), getDistanceToFormation(), getPosition(), getVec(), setFunction(), and SingleFormation().

PfVec SingleFormation::robotPosition`[protected]`

| The position of the robot (kept for internal purposes). Definition at line 125 of file FormationObject.h. Referenced by RelativeFormation::copy(), copy(), getCharge(), getPosition(), and getVec().

double SingleFormation::priority`[protected]`

| The priority of the formation (may be used for selection). Definition at line 127 of file FormationObject.h. Referenced by copy(), and getPriority().

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

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