Orxonox: orxonox::PongAI Class Reference

# orxonox::PongAI Class Reference

`#include <src/orxonox/objects/controllers/PongAI.h>`

Inheritance diagram for orxonox::PongAI:

List of all members.

## Public Member Functions

| PongAI (BaseObject *creator)
void | setConfigValues ()
| Function to collect the SetConfigValue-macro calls.
void | setPongBall (PongBall *ball)
virtual void | tick (float dt)
| Gets called every frame.
virtual | ~PongAI ()

## Protected Member Functions

void | calculateBallEndPosition ()
void | calculateRandomOffset ()
void | delayedMove ()
void | move (char direction, bool bUseDelay)

## Protected Attributes

PongBall * | ball_
Vector2 | ballDirection_
float | ballEndPosition_
bool | bOscillationAvoidanceActive_
char | movement_
char | oldMove_
float | randomOffset_
std::list< std::pair< Timer < PongAI > *, char > > | reactionTimers_
float | relHysteresisOffset_
float | strength_

## Constructor & Destructor Documentation

orxonox::PongAI::PongAI | ( | BaseObject * | creator | ) |

References ball_, ballDirection_, ballEndPosition_, bOscillationAvoidanceActive_, movement_, oldMove_, randomOffset_, RegisterObject, relHysteresisOffset_, setConfigValues(), and strength_.

orxonox::PongAI::~PongAI | ( |  | ) | `[virtual]`

References reactionTimers_.

## Member Function Documentation

void orxonox::PongAI::calculateBallEndPosition | ( |  | ) | `[protected]`

References ball_, ballEndPosition_, orxonox::PongBall::getFieldDimension(), orxonox::WorldEntity::getPosition(), orxonox::MobileEntity::getVelocity(), orxonox::PongBall::MAX_REL_Z_VELOCITY, orxonox::rnd(), orxonox::sgn(), strength_, orxonox::MT_Type::Vector2, and orxonox::MT_Type::Vector3.

Referenced by tick().

void orxonox::PongAI::calculateRandomOffset | ( |  | ) | `[protected]`

References ball_, orxonox::PongBall::getBatLength(), orxonox::PongBall::getFieldDimension(), randomOffset_, orxonox::rnd(), orxonox::rndsgn(), and strength_.

Referenced by tick().

void orxonox::PongAI::delayedMove | ( |  | ) | `[protected]`

References movement_, and reactionTimers_.

Referenced by move().

void orxonox::PongAI::move | ( | char | direction,
|  | bool | bUseDelay |
| ) |  |  | `[protected]`

References orxonox::createExecutor(), orxonox::delay(), delayedMove(), orxonox::MAX_REACTION_TIME, movement_, reactionTimers_, and strength_.

Referenced by tick().

void orxonox::PongAI::setConfigValues | ( |  | ) |

Function to collect the SetConfigValue-macro calls.

Reimplemented from orxonox::OrxonoxClass.

References SetConfigValue, and strength_.

Referenced by PongAI().

void orxonox::PongAI::setPongBall | ( | PongBall * | ball | ) | `[inline]`

Referenced by orxonox::Pong::spawnPlayer().

void orxonox::PongAI::tick | ( | float | dt | ) | `[virtual]`

Gets called every frame.

Parameters:

  | dt | The time since the last frame in seconds

Implements orxonox::Tickable.

References ball_, ballDirection_, ballEndPosition_, bOscillationAvoidanceActive_, calculateBallEndPosition(), calculateRandomOffset(), orxonox::delay(), orxonox::Controller::getControllableEntity(), orxonox::PongBall::getFieldDimension(), orxonox::WorldEntity::getPosition(), orxonox::MobileEntity::getVelocity(), move(), orxonox::ControllableEntity::moveFrontBack(), movement_, oldMove_, randomOffset_, relHysteresisOffset_, orxonox::sgn(), and orxonox::MT_Type::Vector3.

## Member Data Documentation

PongBall* orxonox::PongAI::ball_`[protected]`

Referenced by calculateBallEndPosition(), calculateRandomOffset(), PongAI(), and tick().

Vector2 orxonox::PongAI::ballDirection_`[protected]`

Referenced by PongAI(), and tick().

float orxonox::PongAI::ballEndPosition_`[protected]`

Referenced by calculateBallEndPosition(), PongAI(), and tick().

bool orxonox::PongAI::bOscillationAvoidanceActive_`[protected]`

Referenced by PongAI(), and tick().

char orxonox::PongAI::movement_`[protected]`

Referenced by delayedMove(), move(), PongAI(), and tick().

char orxonox::PongAI::oldMove_`[protected]`

Referenced by PongAI(), and tick().

float orxonox::PongAI::randomOffset_`[protected]`

Referenced by calculateRandomOffset(), PongAI(), and tick().

std::list<std::pair<Timer<PongAI>*, char> > orxonox::PongAI::reactionTimers_`[protected]`

Referenced by delayedMove(), move(), and ~PongAI().

float orxonox::PongAI::relHysteresisOffset_`[protected]`

Referenced by PongAI(), and tick().

float orxonox::PongAI::strength_`[protected]`

Referenced by calculateBallEndPosition(), calculateRandomOffset(), move(), PongAI(), and setConfigValues().

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

- src/orxonox/objects/controllers/PongAI.h
- src/orxonox/objects/controllers/PongAI.cc