Class Worldmodel

java.lang.Object
  |
  +--Worldmodel

public class Worldmodel
extends java.lang.Object

The Worldmodel class is used to calculate absolute positions of seen objects with their given relative data. Most important is the calculation of the own position. For that a field line, which normaly can be seen, and the nearest seen flag are used; Further body- and hearevents recieved from Parser class are delivered to Brain class.

Author:
Ramin Radpour, Anita Reifsteck, Wini Appl, Patrick Ficher, Alexander Lillich, Thorsten Fiekert

Field Summary
private  int actualTime
           
private  double[] bodyDoubleArray
          bodyDoubleArray = array with length 16 and: [0]: time [1]: view_mode(1){ 0="high" | 1="low" } [2]: view_mode(2){ 0="narrow" | 1="normal" | 2="wide" } [3]: stamina(1) ( Stammina ) [4]: stamina(2) ( Effort ) [5]: speed(1) ( AmountOfSpeed ) [6]: speed(2) ( DirectionOfSpeed )[-180 ~ 180 degrees] [7]: head-angle ( HeadAngle ) [-180 ~ 180 degrees] [8]: kick ( KickCount ) [positive integer] [9]: dash ( DashCount ) [positive integer] [10]: turn ( TurnCount ) [positive integer] [11]: say ( SayCount ) [positive integer] [12]: turn_neck ( TurnNeckCount ) [positive integer] [13]: catch ( CatchCount ) [positive integer] [14]: move ( MoveCount ) [positive integer] [15]: change_view ( ChangeViewCount )[positive integer] Author: Ramin Radpour
private  Communication communication
          The Communication object
private  int[] event
          event = array with following content: [0]: time [1]: { 0=hear | 1=visual | 2=body }
private  java.lang.String[] hearStringArray
          hearStringArray = String array with following content: [0]: time [1]: sender { "referee" | "self" | direction | "online_coach_left" | "online_coach_right"} [2]: message time can be converted to int direction can be converted to double Author: Ramin Radpour
private  boolean initialized
           
private  int myNr
           
private  int[] parsedID
           
private  Parser parser
          The Parser object
private  boolean playDirectionRight
           
private  boolean playerChanged
           
private  double[][] positions
          positions = array[][] with double[] of length 7 with following content: first positions [x][]: [0] : ball [1] - [11] : player of own team related to player-number [12]- [22] : player of the other team related to player-number + 11 second positions [][x]: [0] : x-position [1] : y-position [2] : by rccs-server given distance [3] : by rccs-server given angle (no absolute angle) [4] : by rccs-server given distanceChange - not used [5] : timecyclus [6] : absolute angle (in case of ownNumber) and distance to ball (in case of other player) initialazion value is 1000.0 Author: Ramin Radpour
private  java.lang.String refereeMsg
           
private  java.lang.String teamName
           
private  java.util.Vector vector
          The Vector object
 
Constructor Summary
Worldmodel(Communication communication)
          Creates a new Worldmodel instance.
 
Method Summary
 int actualTime()
           
 double[] bodyDoubleArray()
           
private  void calcOwnPos()
          The calcOwnPos method calculates ownPosition and uses getNextFlag and getLineAngle fills positions[myNr][0,1,5,6] Author: Ramin Radpour
private  void calcPositions()
          The calcPositions method calculates absolute positions of seen objects. uses methods calcOwnPos() and rel2abs() Author: Ramin Radpour
 void disconnect()
           
 int[] event()
           
private  double[] flagPosition(VisualObject flagName)
          The flagPosition method gives absolute flagposition back
private  double[] getLineAngle()
          The getLineAngle method gives seen line with see-angle back
private  double[] getNextFlag()
          The getNextFlag method takes the nearest flag of all seen ones
 double[][] giveData()
           
 java.lang.String[] hearStringArray()
           
 void init()
          The init method initializates players and gets information from server about playdirection, own Number and playmode Author: Patrick Ficher
 boolean initialized()
           
 boolean playDirectionRight()
          Should be called from the GUI
 int playerNr()
           
 java.lang.String playmode()
           
private  void refereeMsg()
          The refereeMsg method receive and set referee messages Author: Thorsten Fiekert
private  double[] rel2abs(double distance, double angle)
          The rel2abs method calculates absolute values with by server passed information.
 void run()
          The run method differes between hear, see and body events Author: Ramin Radpour Author: Patrick Ficher
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

communication

private Communication communication
The Communication object

parser

private Parser parser
The Parser object

vector

private java.util.Vector vector
The Vector object

positions

private double[][] positions
positions = array[][] with double[] of length 7 with following content: initialazion value is 1000.0

Author: Ramin Radpour


playerChanged

private boolean playerChanged

playDirectionRight

private boolean playDirectionRight

myNr

private int myNr

teamName

private java.lang.String teamName

hearStringArray

private java.lang.String[] hearStringArray
hearStringArray = String array with following content: time can be converted to int direction can be converted to double

Author: Ramin Radpour


refereeMsg

private java.lang.String refereeMsg

bodyDoubleArray

private double[] bodyDoubleArray
bodyDoubleArray = array with length 16 and:

Author: Ramin Radpour


initialized

private boolean initialized

actualTime

private int actualTime

event

private int[] event
event = array with following content:

parsedID

private int[] parsedID
Constructor Detail

Worldmodel

public Worldmodel(Communication communication)
Creates a new Worldmodel instance.
Parameters:
communication - a Communication value defining the communication link to the server via which the commands can be sent.
See Also:
Communication
Method Detail

playmode

public java.lang.String playmode()
Returns:
the String referee message

hearStringArray

public java.lang.String[] hearStringArray()
Returns:
the String[] hear array

actualTime

public int actualTime()
Returns:
the integer actual Time

initialized

public boolean initialized()
Returns:
the boolean attribute initialized

playerNr

public int playerNr()
Returns:
the integer Player number

giveData

public double[][] giveData()
Returns:
the double[][] positions array

event

public int[] event()
Returns:
the int[] event array

bodyDoubleArray

public double[] bodyDoubleArray()
Returns:
the double[] body arrray

playDirectionRight

public boolean playDirectionRight()
Should be called from the GUI
Returns:
the boolean playdirection

refereeMsg

private void refereeMsg()
The refereeMsg method receive and set referee messages

Author: Thorsten Fiekert


init

public void init()
The init method initializates players and gets information from server about playdirection, own Number and playmode

Author: Patrick Ficher


disconnect

public void disconnect()

flagPosition

private double[] flagPosition(VisualObject flagName)
The flagPosition method gives absolute flagposition back
Parameters:
flagName - a VisualObject objectName
Returns:
the double[] absolute flagposition array

Author: Ramin Radpour

Author: Alexander Lillich

Author: Anita Reifsteck


getNextFlag

private double[] getNextFlag()
The getNextFlag method takes the nearest flag of all seen ones
Returns:
a double array with following content:
  • [0] : absolute X-position of the flag
  • [1] : absolute Y-position of the flags
  • [2] : distance to the flag (passed by server)
  • [3] : angle to the flag (passed by server)

Author: Ramin Radpour

Author: Patrick Ficher


getLineAngle

private double[] getLineAngle()
The getLineAngle method gives seen line with see-angle back
Returns:
a double array with following content:
  • [0] : { 0.0=top, 1.0=right, 2.0=bottom, 3.0=left }
  • [1] : angle

Author: Ramin Radpour

Author: Alexander Lillich

Author: Anita Reifsteck


rel2abs

private double[] rel2abs(double distance,
                         double angle)
The rel2abs method calculates absolute values with by server passed information.
Parameters:
distance - a double
angle - a double
Returns:
a double array with following content:
  • [0] : x-value
  • [1] : y-value

Author: Ramin Radpour


calcOwnPos

private void calcOwnPos()
The calcOwnPos method calculates ownPosition and uses getNextFlag and getLineAngle fills positions[myNr][0,1,5,6]

Author: Ramin Radpour


calcPositions

private void calcPositions()
The calcPositions method calculates absolute positions of seen objects. uses methods calcOwnPos() and rel2abs()

Author: Ramin Radpour


run

public void run()
The run method differes between hear, see and body events

Author: Ramin Radpour

Author: Patrick Ficher