|
||||||||
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 | |
private CommunicationChannel |
communicationChannel
reference to the communicationChannel |
Constructor Summary | |
Actor(CommunicationChannel communicationChannel)
Creates a new Actor instance. |
Method Summary | |
void |
dash(double power)
Gives a running impulse |
Event |
event()
Receives incoming messages from the server. |
void |
init(java.lang.String teamName)
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 |
turn(double moment)
Turns the body of the client on the field. |
Methods inherited from class java.lang.Object |
|
Field Detail |
private CommunicationChannel communicationChannel
Constructor Detail |
public Actor(CommunicationChannel communicationChannel)
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)
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()
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
impulsepublic 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 usage
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |