public interface TeamController
Interface TeamController
must be implemented by every
team controller.
Method Summary | |
---|---|
double |
getControl(int p,
int i)
Method getControl() is called by the GUI to extract
the current values of the control for player p. |
java.lang.String |
getName()
Return your team name. |
void |
grabSuccessful(int p)
Method grabSuccessful() is called by the GUI to let
you know that the grab you sought was successful. |
void |
init(int playerNum,
double initX,
double initY,
double initTheta)
This init() method is called by the GUI once for each player. |
void |
init(SensorPack sensor,
int numPlayers,
int myteam,
boolean onLeft)
This init() method is called by the GUI once for each team. |
void |
kickSuccessful(int p)
Method kickSuccessful() is called by the GUI to let
you know that the kick was successful. |
void |
move()
Method move() is called by the GUI at each step so
that you can plan your next move for each player. |
void |
startDebug()
Method startDebug() is called by the GUI when
the debug button is clicked. |
boolean |
triesGrab(int p)
Method triesGrab() is called by the GUI to ask
you if you want to hold (grab) the ball right now, since
the GUI has determined that it's close enough for a grab. |
boolean |
triesKick(int p)
Method triesKick() is called by the GUI to ask
you if you want to try and kick the ball right now, provided
player p is in possession of the ball. |
Method Detail |
---|
java.lang.String getName()
void init(SensorPack sensor, int numPlayers, int myteam, boolean onLeft)
init()
method is called by the GUI once for each team.
This is how you know your team number (0 or 1), whether you are on
the left side, and how many players you have. You are also passed
a sensor pack, which will be useful in learning about the current
state of the field.
void init(int playerNum, double initX, double initY, double initTheta)
init()
method is called by the GUI once for each player.
This is how you know each player is placed on the field. No, you don't get
to decide where your players are placed.
void move()
move()
is called by the GUI at each step so
that you can plan your next move for each player. Essentially,
all the "intelligence" should be here. You implement code to
adjust the controls. Note that the controls themselves are
not returned by this method. Instead, the GUI gets them by
calling getControl() once for each control.
double getControl(int p, int i)
getControl()
is called by the GUI to extract
the current values of the control for player p. There are only two now
and so i=1 or 2 the only values of i
.
boolean triesGrab(int p)
triesGrab()
is called by the GUI to ask
you if you want to hold (grab) the ball right now, since
the GUI has determined that it's close enough for a grab.
Return true
if you decide you want to grab the ball.
Note: if a player holds the ball too long, it will be forced
out the player.
void grabSuccessful(int p)
grabSuccessful()
is called by the GUI to let
you know that the grab you sought was successful. This allows you to update
your knowledge of the "state" of the system.
boolean triesKick(int p)
triesKick()
is called by the GUI to ask
you if you want to try and kick the ball right now, provided
player p is in possession of the ball. Return true
if you decide you want to kick the ball. Note: if a player holds the
ball too long, it will be forced out the player.
void kickSuccessful(int p)
kickSuccessful()
is called by the GUI to let
you know that the kick was successful. This allows you to update
your knowledge of the "state" of the system.
void startDebug()
startDebug()
is called by the GUI when
the debug button is clicked. Then it's up to you to decide
what you want to do. You can write your debug to the file
debug.data
by calling Debug.println()
from your code. It is useful to be able to delay writing
to this file because otherwise, it would be filled with useless
write's. When you see something going wrong on the screen,
click debug, and let that start the debugging log.