roboplayer.core
Class RoboCore

java.lang.Object
  |
  +--roboplayer.core.RoboCore

public class RoboCore
extends java.lang.Object

In the next version all of the helper function will be moved to separated class.

Version:
1.0
Author:
Krzysztof Langner

Field Summary
static int DASH_FAST
           
static int DASH_NORMAL
           
static int DASH_SLOW
           
 
Constructor Summary
RoboCore(java.net.InetAddress host, int port)
          Standard constructor
 
Method Summary
 void dashTo(Polar pos, int mode)
          Dash to given position Helper function
 void dashTo(Vector2d pos, int mode)
          Dash to given position Helper function
 void dashToBackward(Polar object)
          This function sends dash message Helper function
 void dashToBackward(Vector2d pos)
          This function sends dash message Helper function
 void debug(java.lang.String msg)
          Print debug message
 Body getBody()
          Get robot body
 Memory getMemory()
          Get robot memory
 Params getParams()
          Get robot parameters
 int getStepCount(double distance)
          Calculate how many steps are needed to pass this distance.
 boolean init(java.lang.String teamName, boolean goalie)
          Connect to server
 boolean isReady()
          Check if robot is ready to play.
 void kickAt(double power, double dir)
          This function kicks ball at specified direction.
 void run()
          Run robot
 void setDebugMode(boolean mode)
          Set debug mode
 void setHeadAngle(double angle)
          Set head angle.
 void stop()
          Stop robot
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DASH_SLOW

public static final int DASH_SLOW
See Also:
Constant Field Values

DASH_NORMAL

public static final int DASH_NORMAL
See Also:
Constant Field Values

DASH_FAST

public static final int DASH_FAST
See Also:
Constant Field Values
Constructor Detail

RoboCore

public RoboCore(java.net.InetAddress host,
                int port)
         throws java.net.SocketException
Standard constructor

Parameters:
host - Server host
port - server port
Throws:
java.net.SocketException - when we can't connect to the server
Method Detail

init

public boolean init(java.lang.String teamName,
                    boolean goalie)
Connect to server

Parameters:
teamName - name of the team
goalie - true if goalkeeper
Returns:
true we received init message

getBody

public Body getBody()
Get robot body


getMemory

public Memory getMemory()
Get robot memory


getParams

public Params getParams()
Get robot parameters


run

public void run()
Run robot


stop

public void stop()
Stop robot


isReady

public boolean isReady()
Check if robot is ready to play. This helper function check if we know where is ball. If not it turns to look for it.


dashTo

public void dashTo(Vector2d pos,
                   int mode)
Dash to given position Helper function


dashTo

public void dashTo(Polar pos,
                   int mode)
Dash to given position Helper function


getStepCount

public int getStepCount(double distance)
Calculate how many steps are needed to pass this distance. We assume that we can go at full speed. For goalkeeper it should be always true. Helper function

Parameters:
distance - distance to pass
Returns:
number of steps

kickAt

public void kickAt(double power,
                   double dir)
This function kicks ball at specified direction. Before kicking this function checks if there are any opponent players at this direction, and if nessesery changes direction. Helper function


setHeadAngle

public void setHeadAngle(double angle)
Set head angle. Helper function

Parameters:
angle - angle to set

dashToBackward

public void dashToBackward(Polar object)
This function sends dash message Helper function


dashToBackward

public void dashToBackward(Vector2d pos)
This function sends dash message Helper function


setDebugMode

public void setDebugMode(boolean mode)
Set debug mode

Parameters:
mode - true to enable debuging

debug

public void debug(java.lang.String msg)
Print debug message

Parameters:
msg - message