|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Actor
The Actor
class is used to get an abstraction of the
plain text commands so that the can be used via methods. The methods
compose the commands and send them via the communicationChannel link.
Field Summary | |
CommunicationChannel |
communicationChannel
reference to the communicationChannel |
private Player |
player
reference to the Player |
Constructor Summary | |
Actor(CommunicationChannel communicationChannel,
Player player)
Creates a new Actor instance. |
Method Summary | |
void |
bye()
removes the player from the field |
void |
catchBall(double direction)
catches the ball in the specified direction |
void |
changeView(double width,
double quality)
Method changeView. changes view Quality width: 2 = narrow 1 = normal 0.5 = wide quality: 1 = high 0.5 = low |
void |
dash(double power)
Gives a running impulse |
Event |
event(AgentInfo agentInfo)
Receives incoming messages from the server. |
void |
init(java.lang.String teamName,
AgentInfo agentInfo,
boolean isGoalie)
Registers itself to to the server specifying protocol version 7.0. NOTE: If you don't use version 7.0, it may occur that you will not receive a sense_body event and that the names of the objects will be written in a different way like "flag" instead of "f". |
void |
kick(double power,
double direction)
Kicks into a given direction with given power |
void |
move(double x,
double y)
Places the player to a given position on the field. |
void |
say(java.lang.String message)
Says the overgiven message |
void |
turn(double moment)
Turns the body of the client on the field. |
void |
turnNeck(double moment)
Turns the head of the client on the field. |
Methods inherited from class java.lang.Object |
|
Field Detail |
public CommunicationChannel communicationChannel
private Player player
Constructor Detail |
public Actor(CommunicationChannel communicationChannel, Player player)
Actor
instance.communicationChannel
- a CommunicationChannel
value defining the
communicationChannel link to the server via which the commands can be
sentCommunicationChannel
Method Detail |
public void init(java.lang.String teamName, AgentInfo agentInfo, boolean isGoalie)
teamName
- The name of the team
the player should join or create if it does not already exist and there
less than two teams already present on the fieldpublic Event event(AgentInfo agentInfo)
receive()
method is blocking because is uses the blocking
receive()
method of the CommunicationChannel
class. Therefor
the thread will be interrupted until a new message arrives.Event
object containing the parsed information
of the read messageCommunicationChannel
public void dash(double power)
power
- a double
value containing the power of the
impulse
21.06. added recovery decreasing, sbpublic void changeView(double width, double quality)
width
- quality
- public void kick(double power, double direction)
power
- a double
value specifying the power of the kickdirection
- a double
value giving the direction of the kickpublic void move(double x, double y)
x
- gives the position in x direction.
The position can vary from -52.5 to 52.5. The unit is meter.
Negative values stand for the own half of the field, positive values stand for
the opponent's half. The value itself gives the distance from the mid-line.y
- gives the position in y direction.
The position can vary from -34.0 to 34.0. The unit is meter.
Negative values stand for the left side of the field when looked in direction of
the opponent's goal.Positive value stand for the right side.
The value itself gives the distance from the line going through the center of both
goal and the middle point of the field.public void turn(double moment)
moment
- is the angle in degree you want to turn.
The orientation is clockwise so that positive angles mean right turns. The absolute
value of the angle must be smaller than 180 degrees. Otherwise the the server will
take the turn as a 180 degree turn. So it should be assured that the angle are
normalized before usagepublic void turnNeck(double moment)
moment
- is the angle in degree you want to turn.
The orientation is clockwise so that positive angles mean right turns. The absolute
value of the angle must be smaller than 180 degrees. Otherwise the the server will
take the turn as a 180 degree turn. So it should be assured that the angle are
normalized before usagepublic void say(java.lang.String message)
public void bye()
public void catchBall(double direction)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |