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

RS::PlayerView Class Reference

This view is used to keep track of the players, their position, speed and other properties. More...

Inheritance diagram for RS::PlayerView:

Inheritance graph
[legend]
Collaboration diagram for RS::PlayerView:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 PlayerView (const ViewId id)
 Create a player view with ViewId id.

 ~PlayerView ()
 Destroys the player view.

PlayerObject getPlayerClosestToAgent (const Int hist=NOW)
 Returns the player which is closest to the agent.

PlayerObject getOpponentClosestToAgent (const Int hist=NOW)
 Returns the opponent which is closest to the agent.

PlayerObject getOpponentClosestToBall (const Int hist=NOW)
 Returns the opponent which is closest to the ball.

PlayerObject getTeammateClosestToAgent (const Int hist=NOW)
 Returns the teammate which is closest to the agent.

PlayerObject getTeammateClosestToBall (const Int hist=NOW)
 Returns the observed teammate which is closest to the ball.

PlayerObject getTeammateIncludingAgentClosestToBall (const Int hist=NOW)
 Returns the teammate, including the agent, which is closest to the ball.

PlayerObject getPlayerClosestToBall (const Int hist=NOW)
 Returns the player, including the agent, which is closest to the ball.

const std::vector< PlayerObject > & getOpponents (const Int hist=NOW) const
 Get a vector with the opponents.

const std::vector< PlayerObject > & getTeammates (const Int hist=NOW) const
 Get a vector with the teammates.

const std::vector< PlayerObject > & getUnknownPlayers (const Int hist=NOW) const
 Get a vector with the unknown players.


Protected Member Functions

Update functions.
virtual void myUpdateAfterSee ()
 Called after an visual (see) message has been received.

virtual void myNewCycle ()
 Called when the sensor interface detects a new cycle.

virtual void myUpdateAfterCoachMessage ()
 Called after a new message from the coach has been recieved.

virtual void myUpdateAfterInit ()
 Called after an init message has been received.

virtual void myUpdateAfterHear ()
 Called after an aural (hear) message has been received.

virtual void myUpdateAfterSense ()
 Called after a sense body message has been received.

virtual void myUpdateAfterCommand ()
 Called after a command has been executed.


Detailed Description

This view is used to keep track of the players, their position, speed and other properties.

Todo:
Speed up getClosest* by buffering the result in the view

More information in the view.

Unit:
Framework/view
Revision
1.8
Author
frehe
Date
2007/09/26 13:10:15

Definition at line 98 of file PlayerView.h.


Member Function Documentation

PlayerObject RS::PlayerView::getPlayerClosestToAgent const Int    hist = NOW
 

Returns the player which is closest to the agent.

If the agent doesn't know anything about any players then a PlayerObject with all values unknown will be returned.

Definition at line 80 of file PlayerView.cc.

References RS::WorldModel::getAgent(), getOpponentClosestToAgent(), RS::MobileObject::getPosition(), getTeammateClosestToAgent(), RS::WorldModelInterface::getWorld(), and RS::View::worldModelInterface.

PlayerObject RS::PlayerView::getOpponentClosestToAgent const Int    hist = NOW [inline]
 

Returns the opponent which is closest to the agent.

If the agent doesn't know anything about any opponents then a PlayerObject with all values unknown will be returned.

Definition at line 86 of file PlayerView.icc.

References RS::WorldModel::getOpponentClosestToAgent(), RS::WorldModelInterface::getWorld(), and RS::View::worldModelInterface.

Referenced by RS::PassKick::evaluate(), and getPlayerClosestToAgent().

PlayerObject RS::PlayerView::getOpponentClosestToBall const Int    hist = NOW [inline]
 

Returns the opponent which is closest to the ball.

If the agent doesn't know anything about any opponents then a PlayerObject with all values unknown will be returned.

Definition at line 90 of file PlayerView.icc.

References RS::WorldModel::getOpponentClosestToBall(), RS::WorldModelInterface::getWorld(), and RS::View::worldModelInterface.

Referenced by RS::AmIClosestToBall::evaluate(), getPlayerClosestToBall(), and RS::OffsideTrapView::opponentHasBall().

PlayerObject RS::PlayerView::getTeammateClosestToAgent const Int    hist = NOW [inline]
 

Returns the teammate which is closest to the agent.

If the agent doesn't know anything about any teammates then a PlayerObject with all values unknown will be returned.

Definition at line 94 of file PlayerView.icc.

References RS::WorldModel::getTeammateClosestToAgent(), RS::WorldModelInterface::getWorld(), and RS::View::worldModelInterface.

Referenced by getPlayerClosestToAgent().

PlayerObject RS::PlayerView::getTeammateClosestToBall const Int    hist = NOW [inline]
 

Returns the observed teammate which is closest to the ball.

The agent itself is not included. If no teammate is seen then a PlayerObject with all values unknown will be returned.

Definition at line 98 of file PlayerView.icc.

References RS::WorldModel::getTeammateClosestToBall(), RS::WorldModelInterface::getWorld(), and RS::View::worldModelInterface.

Referenced by RS::AmIClosestToBall::evaluate(), getPlayerClosestToBall(), RS::OffsideTrapView::getPlayersToSetPress(), and RS::OffsideTrapView::opponentHasBall().

PlayerObject RS::PlayerView::getTeammateIncludingAgentClosestToBall const Int    hist = NOW [inline]
 

Returns the teammate, including the agent, which is closest to the ball.

If no teammates are seen then the closest teammate will be the agent itself.

Definition at line 102 of file PlayerView.icc.

References RS::WorldModel::getTeammateIncludingAgentClosestToBall(), RS::WorldModelInterface::getWorld(), and RS::View::worldModelInterface.

PlayerObject RS::PlayerView::getPlayerClosestToBall const Int    hist = NOW
 

Returns the player, including the agent, which is closest to the ball.

If no players are seen then the closest player will be the agent itself.

Definition at line 94 of file PlayerView.cc.

References RS::WorldModel::getBall(), getOpponentClosestToBall(), RS::MobileObject::getPosition(), getTeammateClosestToBall(), RS::WorldModelInterface::getWorld(), and RS::View::worldModelInterface.

void RS::PlayerView::myNewCycle   [inline, protected, virtual]
 

Called when the sensor interface detects a new cycle.

It is called *before* the values in SensorInterface are erased, so this is the last chance to use them.

Implements RS::View.

Definition at line 118 of file PlayerView.icc.


The documentation for this class was generated from the following files:
Generated on Mon Aug 29 08:26:21 2011 for RoboSoc by doxygen1.3-rc3