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

RS::OffsideTrapView Class Reference

This view is intended be used to spot situations where an offside trap is suitable. More...

Inheritance diagram for RS::OffsideTrapView:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

 OffsideTrapView (const ViewId id, Float maxTrapDist=25.0)
 Construct a view with the ViewId id.

 ~OffsideTrapView ()
 Destroys the view.

bool canPressureOpponent ()
 Checks whether there are any defenders that can put pressure on the ball keeper.

void getPlayersToSetPress (std::vector< PlayerObject > &pressurePlayers)
 Get the players that can put pressure on the ball keeper.

bool opponentHasBall ()
 Checks if opponent is ball keeper.

FloatUE getOpponentPosClosestToGoal ()
 Get the position of the opponent closest to our goal.

FloatUE getTeammatePosNextClosestToGoal ()
 Get the second last defender (including the goalie).

bool suitable ()
 Checks whether it is suitbale to start an offside trap.

bool unsuitable (int xcoord)
 Checks wheter it is unsuitable to continue with the trap.


Protected Member Functions

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 myUpdateAfterSee ()
 Called after an visual (see) 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.


Protected Attributes

const WorldFactsfacts
PlayerViewplayerView
 The agents view of other players.

BallViewballView
 The agents view of the ball.

AgentViewagentView
 The agents view of itself.


Detailed Description

This view is intended be used to spot situations where an offside trap is suitable.

It can be used by all players. It is used by the skills InitiateOffsideTrap and ExecuteOffsideTrap.

Todo:

Unit:
Framework/view
Revision
1.8
Author
aip4
Date
2003/10/12 21:53:38

Definition at line 106 of file OffsideTrapView.h.


Constructor & Destructor Documentation

RS::OffsideTrapView::OffsideTrapView const ViewId    id,
Float    maxTrapDist = 25.0
 

Construct a view with the ViewId id.

Parameters:
id The view id.
maxTrapDist This is the maximum distance a defender should run to make an offside trap. The default value is 25 meters.

Definition at line 83 of file OffsideTrapView.cc.

References RS::getView().


Member Function Documentation

bool RS::OffsideTrapView::canPressureOpponent  
 

Checks whether there are any defenders that can put pressure on the ball keeper.

Returns:
True if there are defenders that can pressure the ball keeper.

Definition at line 95 of file OffsideTrapView.cc.

void RS::OffsideTrapView::getPlayersToSetPress std::vector< PlayerObject > &    pressurePlayers
 

Get the players that can put pressure on the ball keeper.

Parameters:
pressurePlayers A vector that will be filled with up to two PlayerObjects. Both players will have a x-coordinate with is smaller than that of the ball. The first player will have a y-coordinate which is larger than that of the ball and the second will have a y-coordinate which is smaller than that of the ball.

Definition at line 105 of file OffsideTrapView.cc.

References agentView, ballView, RS::AgentView::getAgentObject(), RS::BallView::getPosition(), RS::PlayerView::getTeammateClosestToBall(), RS::PlayerView::getTeammates(), and playerView.

bool RS::OffsideTrapView::opponentHasBall  
 

Checks if opponent is ball keeper.

Returns:
True if the opponent has got the ball.

Definition at line 150 of file OffsideTrapView.cc.

References ballView, RS::PlayerView::getOpponentClosestToBall(), RS::BallView::getPosition(), RS::MobileObject::getPosition(), RS::BallView::getRelativeDistance(), RS::PlayerView::getTeammateClosestToBall(), and playerView.

Referenced by suitable().

FloatUE RS::OffsideTrapView::getOpponentPosClosestToGoal  
 

Get the position of the opponent closest to our goal.

Returns:
The x-coordinate of the opponent closest to our goal.

Definition at line 174 of file OffsideTrapView.cc.

References RS::PlayerView::getOpponents(), and playerView.

Referenced by suitable().

FloatUE RS::OffsideTrapView::getTeammatePosNextClosestToGoal  
 

Get the second last defender (including the goalie).

Returns:
The x-coordinate of the teammate next closest to our goal (including the goalie).

Definition at line 191 of file OffsideTrapView.cc.

References agentView, RS::AgentView::getAgentObject(), RS::PlayerView::getTeammates(), and playerView.

Referenced by suitable(), and unsuitable().

bool RS::OffsideTrapView::suitable  
 

Checks whether it is suitbale to start an offside trap.

This is considered suitable if these conditions are met:

  • There is an opponent on our half of the field
  • The ball is behind the opponent which is closest to our goal
  • The ball is controlled by an opponent
  • Our second last defender is close enough to the x-coordinate to pass
  • The opponent is not already offside

Returns:
True if it is suitable to start an offside trap.

Definition at line 218 of file OffsideTrapView.cc.

References ballView, getOpponentPosClosestToGoal(), RS::BallView::getPosition(), getTeammatePosNextClosestToGoal(), and opponentHasBall().

bool RS::OffsideTrapView::unsuitable int    xcoord
 

Checks wheter it is unsuitable to continue with the trap.

It is considered unsuitable if one of these conditions are met:

  • The ball has pass the given x-coordinate
  • One defender has more than #maxTrapDistance to run.

Parameters:
xcoord X-coordinate which ball must not have passed.
Returns:
True if it is unsuitable to continue with the trap.

Definition at line 238 of file OffsideTrapView.cc.

References ballView, RS::BallView::getPosition(), and getTeammatePosNextClosestToGoal().

void RS::OffsideTrapView::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 262 of file OffsideTrapView.cc.


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