robocup.lab.intelligent
Class IntelligentController

java.lang.Object
  extended by robocup.lab.intelligent.IntelligentController
All Implemented Interfaces:
atan.model.ControllerPlayer

public class IntelligentController
extends java.lang.Object
implements atan.model.ControllerPlayer

The Class IntelligentController.


Field Summary
private static Brain brain
          The controller brain.
private static int count
          The count.
private  java.util.Set<Literal> cycleSensors
          The cycle sensors.
private  double directionBall
          The direction ball.
private  double directionOtherFlagPenalty
          The direction other flag penalty.
private  double directionOtherGoal
          The direction other goal.
private  double directionOtherPlayer
          The direction other player.
private  double directionOwnGoal
          The direction own goal.
private  double distanceBall
          The distance ball.
private  double distanceOtherFlagPenalty
          The distance other flag penalty.
private  double distanceOtherGoal
          The distance other goal.
private  double distanceOtherPlayer
          The distance other player.
private  double distanceOwnGoal
          The distance own goal.
private  java.lang.String lastAction
          The last action.
private  boolean lock
          The lock.
private static org.apache.log4j.Logger log
          The log.
private  atan.model.ActionsPlayer player
          The player.
private  java.util.Random random
          The random.
private  boolean seeBall
          The see ball.
private  boolean seeOtherFlagPenalty
          The see other flag penalty.
private  boolean seeOtherGoal
          The see other goal.
private  boolean seeOtherPlayer
          The see other player.
private  boolean seeOwnGoal
          The see own goal.
 
Constructor Summary
IntelligentController()
          Instantiates a new intelligent controller.
 
Method Summary
 atan.model.ActionsPlayer getPlayer()
          Returns the current instance of the ActionsPlayer.
 java.lang.String getType()
          Get the players type, if set.
 void infoHearError(atan.model.enums.Errors error)
          The player is informed when it hears an error message.
 void infoHearOk(atan.model.enums.Ok ok)
          The player is informed when it hears an ok message.
 void infoHearPlayer(double direction, java.lang.String message)
          The controller is informed when it hears a message from another player.
 void infoHearPlayMode(atan.model.enums.PlayMode playMode)
          The controller is informed when a play mode message is broadcast.
 void infoHearReferee(atan.model.enums.RefereeMessage refereeMessage)
          The controller is informed when a referee message is broadcast.
 void infoHearWarning(atan.model.enums.Warning warning)
          The player is informed when it hears a warning.
 void infoSeeBall(double distance, double direction, double distChange, double dirChange, double bodyFacingDirection, double headFacingDirection)
          The controller is informed that the Ball is in sight.
 void infoSeeFlagCenter(atan.model.enums.Flag flag, double distance, double direction, double distChange, double dirChange, double bodyFacingDirection, double headFacingDirection)
          The controller is informed when one of the flags on the center line are in sight.
 void infoSeeFlagCornerOther(atan.model.enums.Flag flag, double distance, double direction, double distChange, double dirChange, double bodyFacingDirection, double headFacingDirection)
          The controller is informed that one of the other teams corner flags is in sight.
 void infoSeeFlagCornerOwn(atan.model.enums.Flag flag, double distance, double direction, double distChange, double dirChange, double bodyFacingDirection, double headFacingDirection)
          The controller is informed that one of our teams corner flags is in sight.
 void infoSeeFlagGoalOther(atan.model.enums.Flag flag, double distance, double direction, double distChange, double dirChange, double bodyFacingDirection, double headFacingDirection)
          The controller is informed that one of the other teams goal flags is in sight.
 void infoSeeFlagGoalOwn(atan.model.enums.Flag flag, double distance, double direction, double distChange, double dirChange, double bodyFacingDirection, double headFacingDirection)
          The controller is informed that one of our teams goal flags is in sight.
 void infoSeeFlagLeft(atan.model.enums.Flag flag, double distance, double direction, double distChange, double dirChange, double bodyFacingDirection, double headFacingDirection)
          The controller is informed when one of the flags along the left touchline is in sight.
 void infoSeeFlagOther(atan.model.enums.Flag flag, double distance, double direction, double distChange, double dirChange, double bodyFacingDirection, double headFacingDirection)
          The controller is informed when one of the flags behind the other teams goal is in sight.
 void infoSeeFlagOwn(atan.model.enums.Flag flag, double distance, double direction, double distChange, double dirChange, double bodyFacingDirection, double headFacingDirection)
          The controller is informed when one of the flags behind our teams goal is in sight.
 void infoSeeFlagPenaltyOther(atan.model.enums.Flag flag, double distance, double direction, double distChange, double dirChange, double bodyFacingDirection, double headFacingDirection)
          The controller is informed that one of the other teams penalty box flags is in sight.
 void infoSeeFlagPenaltyOwn(atan.model.enums.Flag flag, double distance, double direction, double distChange, double dirChange, double bodyFacingDirection, double headFacingDirection)
          The controller is informed that one of our teams penalty box flags is in sight.
 void infoSeeFlagRight(atan.model.enums.Flag flag, double distance, double direction, double distChange, double dirChange, double bodyFacingDirection, double headFacingDirection)
          The controller is informed when one of the flags along the right touchline is in sight.
 void infoSeeLine(atan.model.enums.Line line, double distance, double direction, double distChange, double dirChange, double bodyFacingDirection, double headFacingDirection)
          The controller is informed that one of the pitch lines are in sight.
 void infoSeePlayerOther(int number, boolean goalie, double distance, double direction, double distChange, double dirChange, double bodyFacingDirection, double headFacingDirection)
          The controller is informed that one of the other teams players is in sight.
 void infoSeePlayerOwn(int number, boolean goalie, double distance, double direction, double distChange, double dirChange, double bodyFacingDirection, double headFacingDirection)
          The controller is informed that one of it's own team is in sight.
 void infoSenseBody(atan.model.enums.ViewQuality viewQuality, atan.model.enums.ViewAngle viewAngle, double stamina, double unknown, double effort, double speedAmount, double speedDirection, double headAngle, int kickCount, int dashCount, int turnCount, int sayCount, int turnNeckCount, int catchCount, int moveCount, int changeViewCount)
           
private  void initState()
          Inits the player sensing state.
private  void pause(int ms)
          Pause.
 void postInfo()
          This is the method called one all the visual information has been processed.
 void preInfo()
          This is the method called before the controller receives all the new visual information.
private  int randomDashValueFast()
          Random dash value fast.
private  int randomDashValueSlow()
          Random dash value slow.
private  int randomDirection(int direction)
          Random direction.
private  int randomKickDirectionValue()
          Random kick direction value.
private  double randomTurnValue()
          Random turn value.
private  int randomXPosition()
          Random x position.
private  int randomYPosition()
          Random y position.
 void setPlayer(atan.model.ActionsPlayer p)
          Sets the player that the controller is controlling.
 void setType(java.lang.String newType)
          Set the players type.
private  void turnTowardBall()
          Turn toward ball.
private  void turnTowardOtherGoal()
          Turn toward other goal.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static org.apache.log4j.Logger log
The log.


brain

private static Brain brain
The controller brain.


cycleSensors

private java.util.Set<Literal> cycleSensors
The cycle sensors.


lock

private boolean lock
The lock. Used to avoid sensing before the kick-off playmode.


random

private java.util.Random random
The random.


count

private static int count
The count.


player

private atan.model.ActionsPlayer player
The player.


seeBall

private boolean seeBall
The see ball.


seeOwnGoal

private boolean seeOwnGoal
The see own goal.


seeOtherGoal

private boolean seeOtherGoal
The see other goal.


seeOtherPlayer

private boolean seeOtherPlayer
The see other player.


seeOtherFlagPenalty

private boolean seeOtherFlagPenalty
The see other flag penalty.


distanceBall

private double distanceBall
The distance ball.


directionBall

private double directionBall
The direction ball.


directionOwnGoal

private double directionOwnGoal
The direction own goal.


distanceOwnGoal

private double distanceOwnGoal
The distance own goal.


directionOtherGoal

private double directionOtherGoal
The direction other goal.


distanceOtherGoal

private double distanceOtherGoal
The distance other goal.


distanceOtherPlayer

private double distanceOtherPlayer
The distance other player.


directionOtherPlayer

private double directionOtherPlayer
The direction other player.


distanceOtherFlagPenalty

private double distanceOtherFlagPenalty
The distance other flag penalty.


directionOtherFlagPenalty

private double directionOtherFlagPenalty
The direction other flag penalty.


lastAction

private java.lang.String lastAction
The last action.

Constructor Detail

IntelligentController

public IntelligentController()
Instantiates a new intelligent controller.

Method Detail

initState

private void initState()
Inits the player sensing state.


getPlayer

public atan.model.ActionsPlayer getPlayer()
Description copied from interface: atan.model.ControllerPlayer
Returns the current instance of the ActionsPlayer.

Specified by:
getPlayer in interface atan.model.ControllerPlayer
Returns:
ActionsPlayer.

getType

public java.lang.String getType()
Description copied from interface: atan.model.ControllerPlayer
Get the players type, if set.

Specified by:
getType in interface atan.model.ControllerPlayer
Returns:
The players type (any string).

infoHearError

public void infoHearError(atan.model.enums.Errors error)
Description copied from interface: atan.model.ControllerPlayer
The player is informed when it hears an error message.

Specified by:
infoHearError in interface atan.model.ControllerPlayer
Parameters:
error - The error to handle

infoHearOk

public void infoHearOk(atan.model.enums.Ok ok)
Description copied from interface: atan.model.ControllerPlayer
The player is informed when it hears an ok message.

Specified by:
infoHearOk in interface atan.model.ControllerPlayer
Parameters:
ok - The message to handle.

infoHearPlayMode

public void infoHearPlayMode(atan.model.enums.PlayMode playMode)
Description copied from interface: atan.model.ControllerPlayer
The controller is informed when a play mode message is broadcast.

Specified by:
infoHearPlayMode in interface atan.model.ControllerPlayer
Parameters:
playMode - possible values: BEFORE_KICK_OFF, TIME_OVER, PLAY_ON, KICK_OFF_OWN, KICK_OFF_OTHER, FREE_KICK_OWN, FREE_KICK_OTHER, GOAL_KICK_OWN, CORNER_KICK_OTHER, GOAL_KICK_OWN, GOAL_KICK_OTHER, GOAL_OWN, GOAL_OTHER

infoHearPlayer

public void infoHearPlayer(double direction,
                           java.lang.String message)
Description copied from interface: atan.model.ControllerPlayer
The controller is informed when it hears a message from another player.

Specified by:
infoHearPlayer in interface atan.model.ControllerPlayer
Parameters:
direction - The direction from which the message originated.
message - The actual message said.

infoHearReferee

public void infoHearReferee(atan.model.enums.RefereeMessage refereeMessage)
Description copied from interface: atan.model.ControllerPlayer
The controller is informed when a referee message is broadcast.

Specified by:
infoHearReferee in interface atan.model.ControllerPlayer
Parameters:
refereeMessage - possible values: FOUL_OWN, FOUL_OTHER, HALF_TIME, TIME_UP, TIME_UP_WITHOUT_A_TEAM, TIME_EXTENDED, DROP_BALL, OFFSIDE_OWN, OFFSIDE_OTHER

infoHearWarning

public void infoHearWarning(atan.model.enums.Warning warning)
Description copied from interface: atan.model.ControllerPlayer
The player is informed when it hears a warning.

Specified by:
infoHearWarning in interface atan.model.ControllerPlayer
Parameters:
warning - The warning to handle.

infoSeeBall

public void infoSeeBall(double distance,
                        double direction,
                        double distChange,
                        double dirChange,
                        double bodyFacingDirection,
                        double headFacingDirection)
Description copied from interface: atan.model.ControllerPlayer
The controller is informed that the Ball is in sight.

Specified by:
infoSeeBall in interface atan.model.ControllerPlayer
Parameters:
distance - The distance to the ball.
direction - The direction of the ball.

infoSeeFlagCenter

public void infoSeeFlagCenter(atan.model.enums.Flag flag,
                              double distance,
                              double direction,
                              double distChange,
                              double dirChange,
                              double bodyFacingDirection,
                              double headFacingDirection)
Description copied from interface: atan.model.ControllerPlayer
The controller is informed when one of the flags on the center line are in sight.

Specified by:
infoSeeFlagCenter in interface atan.model.ControllerPlayer
Parameters:
flag - possible values: LEFT, CENTER, RIGHT
distance - The distance to the flag.
direction - The direction of the flag.

infoSeeFlagCornerOther

public void infoSeeFlagCornerOther(atan.model.enums.Flag flag,
                                   double distance,
                                   double direction,
                                   double distChange,
                                   double dirChange,
                                   double bodyFacingDirection,
                                   double headFacingDirection)
Description copied from interface: atan.model.ControllerPlayer
The controller is informed that one of the other teams corner flags is in sight.

Specified by:
infoSeeFlagCornerOther in interface atan.model.ControllerPlayer
Parameters:
flag - possible values: LEFT, RIGHT
distance - The distance to the flag.
direction - The direction of the flag.

infoSeeFlagCornerOwn

public void infoSeeFlagCornerOwn(atan.model.enums.Flag flag,
                                 double distance,
                                 double direction,
                                 double distChange,
                                 double dirChange,
                                 double bodyFacingDirection,
                                 double headFacingDirection)
Description copied from interface: atan.model.ControllerPlayer
The controller is informed that one of our teams corner flags is in sight.

Specified by:
infoSeeFlagCornerOwn in interface atan.model.ControllerPlayer
Parameters:
flag - possible values: LEFT, RIGHT
distance - The distance to the flag.
direction - The direction of the flag.

infoSeeFlagGoalOther

public void infoSeeFlagGoalOther(atan.model.enums.Flag flag,
                                 double distance,
                                 double direction,
                                 double distChange,
                                 double dirChange,
                                 double bodyFacingDirection,
                                 double headFacingDirection)
Description copied from interface: atan.model.ControllerPlayer
The controller is informed that one of the other teams goal flags is in sight. The flags map the posts of the goal and the center of the goal.

Specified by:
infoSeeFlagGoalOther in interface atan.model.ControllerPlayer
Parameters:
flag - possible values: LEFT, CENTER, RIGHT
distance - The distance to this flag.
direction - The direction of the flag.

infoSeeFlagGoalOwn

public void infoSeeFlagGoalOwn(atan.model.enums.Flag flag,
                               double distance,
                               double direction,
                               double distChange,
                               double dirChange,
                               double bodyFacingDirection,
                               double headFacingDirection)
Description copied from interface: atan.model.ControllerPlayer
The controller is informed that one of our teams goal flags is in sight. The flags map the posts of the goal and the center of the goal.

Specified by:
infoSeeFlagGoalOwn in interface atan.model.ControllerPlayer
Parameters:
flag - possible values: LEFT, CENTER, RIGHT
distance - The distance to this flag.
direction - The direction of the flag.

infoSeeFlagLeft

public void infoSeeFlagLeft(atan.model.enums.Flag flag,
                            double distance,
                            double direction,
                            double distChange,
                            double dirChange,
                            double bodyFacingDirection,
                            double headFacingDirection)
Description copied from interface: atan.model.ControllerPlayer
The controller is informed when one of the flags along the left touchline is in sight. The flags are positioned 5m behind the touchline.

Specified by:
infoSeeFlagLeft in interface atan.model.ControllerPlayer
Parameters:
flag - possible values: OWN_50, OWN_40, OWN_30, OWN_20, OWN_10, MID OTHER_10, OTHER_20, OTHER_30, OTHER_40, OTHER_50
distance - The distance to the flag.
direction - The direction of the flag.

infoSeeFlagOther

public void infoSeeFlagOther(atan.model.enums.Flag flag,
                             double distance,
                             double direction,
                             double distChange,
                             double dirChange,
                             double bodyFacingDirection,
                             double headFacingDirection)
Description copied from interface: atan.model.ControllerPlayer
The controller is informed when one of the flags behind the other teams goal is in sight. These flags are positioned 5m behind the goal line.

Specified by:
infoSeeFlagOther in interface atan.model.ControllerPlayer
Parameters:
flag - possible values: LEFT_10, LEFT_20, LEFT_30, MID, RIGHT_10, RIGHT_20, RIGHT_30
distance - The distance to the flag.
direction - The direction of the flag.

infoSeeFlagOwn

public void infoSeeFlagOwn(atan.model.enums.Flag flag,
                           double distance,
                           double direction,
                           double distChange,
                           double dirChange,
                           double bodyFacingDirection,
                           double headFacingDirection)
Description copied from interface: atan.model.ControllerPlayer
The controller is informed when one of the flags behind our teams goal is in sight. These flags are positioned 5m behind the goal line.

Specified by:
infoSeeFlagOwn in interface atan.model.ControllerPlayer
Parameters:
flag - possible values: LEFT_10, LEFT_20, LEFT_30, MID, RIGHT_10, RIGHT_20, RIGHT_30
distance - The distance to the flag.
direction - The direction of the flag.

infoSeeFlagPenaltyOther

public void infoSeeFlagPenaltyOther(atan.model.enums.Flag flag,
                                    double distance,
                                    double direction,
                                    double distChange,
                                    double dirChange,
                                    double bodyFacingDirection,
                                    double headFacingDirection)
Description copied from interface: atan.model.ControllerPlayer
The controller is informed that one of the other teams penalty box flags is in sight. The flags map the outer most corners of the penalty box and the centre point between these corners.

Specified by:
infoSeeFlagPenaltyOther in interface atan.model.ControllerPlayer
Parameters:
flag - possible values: LEFT, CENTER, RIGHT
distance - The distance to this flag.
direction - The direction of this flag.

infoSeeFlagPenaltyOwn

public void infoSeeFlagPenaltyOwn(atan.model.enums.Flag flag,
                                  double distance,
                                  double direction,
                                  double distChange,
                                  double dirChange,
                                  double bodyFacingDirection,
                                  double headFacingDirection)
Description copied from interface: atan.model.ControllerPlayer
The controller is informed that one of our teams penalty box flags is in sight. The flags map the outer most corners of the penalty box and the centre point between these corners.

Specified by:
infoSeeFlagPenaltyOwn in interface atan.model.ControllerPlayer
Parameters:
flag - possible values: LEFT, CENTER, RIGHT
distance - The distance to this flag.
direction - The direction of this flag.

infoSeeFlagRight

public void infoSeeFlagRight(atan.model.enums.Flag flag,
                             double distance,
                             double direction,
                             double distChange,
                             double dirChange,
                             double bodyFacingDirection,
                             double headFacingDirection)
Description copied from interface: atan.model.ControllerPlayer
The controller is informed when one of the flags along the right touchline is in sight. The flags are positioned 5m behind the touchline.

Specified by:
infoSeeFlagRight in interface atan.model.ControllerPlayer
Parameters:
flag - possible values: OWN_50, OWN_40, OWN_30, OWN_20, OWN_10, MID, OTHER_10, OTHER_20, OTHER_30, OTHER_40, OTHER_50
distance - The distance to the flag.
direction - The direction of the flag.

infoSeeLine

public void infoSeeLine(atan.model.enums.Line line,
                        double distance,
                        double direction,
                        double distChange,
                        double dirChange,
                        double bodyFacingDirection,
                        double headFacingDirection)
Description copied from interface: atan.model.ControllerPlayer
The controller is informed that one of the pitch lines are in sight.

Specified by:
infoSeeLine in interface atan.model.ControllerPlayer
distance - The distance to the line.
direction - The direction of the line.

infoSeePlayerOther

public void infoSeePlayerOther(int number,
                               boolean goalie,
                               double distance,
                               double direction,
                               double distChange,
                               double dirChange,
                               double bodyFacingDirection,
                               double headFacingDirection)
Description copied from interface: atan.model.ControllerPlayer
The controller is informed that one of the other teams players is in sight.

Specified by:
infoSeePlayerOther in interface atan.model.ControllerPlayer
Parameters:
number - The ID of the player (from 1 to 11)
goalie - If the seen player is a goalie. False if unknown.
distance - The distance to the player.
direction - The direction of the player.

infoSeePlayerOwn

public void infoSeePlayerOwn(int number,
                             boolean goalie,
                             double distance,
                             double direction,
                             double distChange,
                             double dirChange,
                             double bodyFacingDirection,
                             double headFacingDirection)
Description copied from interface: atan.model.ControllerPlayer
The controller is informed that one of it's own team is in sight.

Specified by:
infoSeePlayerOwn in interface atan.model.ControllerPlayer
Parameters:
number - The ID of the player (from 1 to 11)
goalie - If the seen player is a goalie. False if unknown.
distance - The distance to the player.
direction - The direction of the player.

infoSenseBody

public void infoSenseBody(atan.model.enums.ViewQuality viewQuality,
                          atan.model.enums.ViewAngle viewAngle,
                          double stamina,
                          double unknown,
                          double effort,
                          double speedAmount,
                          double speedDirection,
                          double headAngle,
                          int kickCount,
                          int dashCount,
                          int turnCount,
                          int sayCount,
                          int turnNeckCount,
                          int catchCount,
                          int moveCount,
                          int changeViewCount)
Specified by:
infoSenseBody in interface atan.model.ControllerPlayer
Parameters:
viewQuality - possible values: HIGH, LOW
viewAngle - possible values: NARROW, NORMAL, WIDE

postInfo

public void postInfo()
Description copied from interface: atan.model.ControllerPlayer
This is the method called one all the visual information has been processed.

Specified by:
postInfo in interface atan.model.ControllerPlayer

preInfo

public void preInfo()
Description copied from interface: atan.model.ControllerPlayer
This is the method called before the controller receives all the new visual information.

Specified by:
preInfo in interface atan.model.ControllerPlayer

setPlayer

public void setPlayer(atan.model.ActionsPlayer p)
Description copied from interface: atan.model.ControllerPlayer
Sets the player that the controller is controlling.

Specified by:
setPlayer in interface atan.model.ControllerPlayer
Parameters:
p - ActionsPlayer.

setType

public void setType(java.lang.String newType)
Description copied from interface: atan.model.ControllerPlayer
Set the players type.

Specified by:
setType in interface atan.model.ControllerPlayer
Parameters:
newType - what the type will now be

randomDashValueSlow

private int randomDashValueSlow()
Random dash value slow.

Returns:
the int

randomTurnValue

private double randomTurnValue()
Random turn value.

Returns:
the double

randomDashValueFast

private int randomDashValueFast()
Random dash value fast.

Returns:
the int

randomKickDirectionValue

private int randomKickDirectionValue()
Random kick direction value.

Returns:
the int

randomXPosition

private int randomXPosition()
Random x position.

Returns:
the int

randomYPosition

private int randomYPosition()
Random y position.

Returns:
the int

randomDirection

private int randomDirection(int direction)
Random direction.

Parameters:
direction - the direction
Returns:
the int

turnTowardBall

private void turnTowardBall()
Turn toward ball.


turnTowardOtherGoal

private void turnTowardOtherGoal()
Turn toward other goal.


pause

private void pause(int ms)
Pause.

Parameters:
ms - the ms