[Jais-checkins] jaisteam/src/jais/communication Communication.java,1.29,1.30 Event.java,1.5,1.6 Play
Status: Beta
Brought to you by:
maestrodd
|
From: <mae...@us...> - 2002-07-13 16:21:54
|
Update of /cvsroot/jais/jaisteam/src/jais/communication
In directory usw-pr-cvs1:/tmp/cvs-serv32242/communication
Modified Files:
Communication.java Event.java PlayerStuffInterface.java
SenseBodyEvent.java
Log Message:
added muchos vielos tabulatoros... jb 7.0 is really fine ;)
changed the handling of the enemy and own team lists:
the list is fetched at the beginning of the KI cycle and stored in an
internal reference (m_enemyTeam m_ownTeam).
Index: Communication.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/communication/Communication.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** Communication.java 9 Jul 2002 09:32:38 -0000 1.29
--- Communication.java 13 Jul 2002 16:21:51 -0000 1.30
***************
*** 19,687 ****
public class Communication extends Thread implements ConnectionStuffInterface, PlayerStuffInterface
{
! private String m_serverName; // name of robucup server which will be resolved
! private int m_serverPort; // port of the robocup server
! private String m_teamName; // name of the team to connect
! private boolean m_isGoalie; // wether the player to connect is goalie or not
! private InetAddress m_serverAddress; // the resolved server adress
! private DatagramSocket m_socket; // new datagram socket
! private String m_stuffToSendToServer; // catches every message which has to
! // be sent to server
[...1310 lines suppressed...]
! /**
! * This method stops the thread method (receiveDataFromServer) which
! * receives data from the server
! */
! private synchronized void stopThread()
! {
! m_thisThread=null;
! }
!
!
! /**
! * This method frees the binded system resources after terminating
! * the player.
! */
! public void finalize()
! {
! logger.info("Ok, closing my socket!");
! }
! }
\ No newline at end of file
Index: Event.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/communication/Event.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Event.java 9 Jul 2002 01:16:51 -0000 1.5
--- Event.java 13 Jul 2002 16:21:51 -0000 1.6
***************
*** 11,41 ****
public abstract class Event
{
! protected ArrayList m_objects;
! protected String m_message;
! /**
! * In this method the unparsed message is delivered
! * @param f_message contains unparsed string
! * @roseuid 3CEB63BA034E
! */
! public Event(String f_message)
! {
m_message=f_message;
! }
! /**
! * This method delivers the parsed message as objects in form of a arraylist
! * @return java.util.ArrayList
! * @roseuid 3CEA8ADC007E
! */
! public ArrayList getObjects()
! {
! return m_objects;
! }
! /**
! * @param f_message
! * @roseuid 3CEA8B7F0032
! */
! public abstract void parseData();
! }
--- 11,41 ----
public abstract class Event
{
! protected ArrayList m_objects;
! protected String m_message;
! /**
! * In this method the unparsed message is delivered
! * @param f_message contains unparsed string
! * @roseuid 3CEB63BA034E
! */
! public Event(String f_message)
! {
m_message=f_message;
! }
! /**
! * This method delivers the parsed message as objects in form of a arraylist
! * @return java.util.ArrayList
! * @roseuid 3CEA8ADC007E
! */
! public ArrayList getObjects()
! {
! return m_objects;
! }
! /**
! * @param f_message
! * @roseuid 3CEA8B7F0032
! */
! public abstract void parseData();
! }
\ No newline at end of file
Index: PlayerStuffInterface.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/communication/PlayerStuffInterface.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** PlayerStuffInterface.java 17 Jun 2002 20:48:52 -0000 1.4
--- PlayerStuffInterface.java 13 Jul 2002 16:21:51 -0000 1.5
***************
*** 14,108 ****
public interface PlayerStuffInterface
{
! /**
! * This method provides the possibility to send to the server for the goalie
! * the cath command
! *
! * @roseuid 3CEA1B0403E4
! *
! * @param f_direction
! *
! * @throws xCommunication
! */
! public void catchBall(double f_direction) throws xCommunication;
! /**
! * This method provides the possibility to send to the server dash
! * commands.
! *
! * @roseuid 3CEA1AF4021F
! *
! * @param f_dashPower
! *
! * @throws xCommunication
! */
! public void dash(double f_dashPower) throws xCommunication;
! /**
! * This method provides the possibility to send to the server kick command.
! *
! * @roseuid 3CEA1AFB00D4
! *
! * @param f_kickPower
! * @param f_kickAngel
! *
! * @throws xCommunication
! */
! public void kick(double f_kickPower, double f_kickAngel) throws xCommunication;
! /**
! * This method provides the possibility to send to the server turn neck command
! *
! * @roseuid 3CEA1AEB0103
! *
! * @param f_turnNeckAngel
! *
! * @throws xCommunication
! */
! public void turnNeck(double f_turnNeckAngel) throws xCommunication;
! /**
! * This method provides the possibility to send to the server move to (x,y)
! * command for befor kick off playmode.
! *
! * @roseuid 3CEA1ADB013C
! *
! * @param f_moveToXPos
! * @param f_moveToYPos
! *
! * @throws xCommunication
! *
! */
! public void move(double f_moveToXPos, double f_moveToYPos) throws xCommunication;
! /**
! * This method provides the possibility to send to the server trun body command.
! *
! * @roseuid 3CEA1AE702F2
! *
! * @param f_turnAngel
! *
! * @throws xCommunication
! */
! public void turn(double f_turnAngel) throws xCommunication;
! /**
! * This method provides the possibility to send to the server say message.
! *
! * @roseuid 3CEA1B0B0240
! *
! * @param f_sayMessage
! *
! * @throws xCommunication
! */
! public void say(String f_sayMessage) throws xCommunication;
! /**
* This method provides the option to send change view actions to the server
* f_width has to element of: {narrow; normal; wide} and
--- 14,108 ----
public interface PlayerStuffInterface
{
! /**
! * This method provides the possibility to send to the server for the goalie
! * the cath command
! *
! * @roseuid 3CEA1B0403E4
! *
! * @param f_direction
! *
! * @throws xCommunication
! */
! public void catchBall(double f_direction) throws xCommunication;
! /**
! * This method provides the possibility to send to the server dash
! * commands.
! *
! * @roseuid 3CEA1AF4021F
! *
! * @param f_dashPower
! *
! * @throws xCommunication
! */
! public void dash(double f_dashPower) throws xCommunication;
! /**
! * This method provides the possibility to send to the server kick command.
! *
! * @roseuid 3CEA1AFB00D4
! *
! * @param f_kickPower
! * @param f_kickAngel
! *
! * @throws xCommunication
! */
! public void kick(double f_kickPower, double f_kickAngel) throws xCommunication;
! /**
! * This method provides the possibility to send to the server turn neck command
! *
! * @roseuid 3CEA1AEB0103
! *
! * @param f_turnNeckAngel
! *
! * @throws xCommunication
! */
! public void turnNeck(double f_turnNeckAngel) throws xCommunication;
! /**
! * This method provides the possibility to send to the server move to (x,y)
! * command for befor kick off playmode.
! *
! * @roseuid 3CEA1ADB013C
! *
! * @param f_moveToXPos
! * @param f_moveToYPos
! *
! * @throws xCommunication
! *
! */
! public void move(double f_moveToXPos, double f_moveToYPos) throws xCommunication;
! /**
! * This method provides the possibility to send to the server trun body command.
! *
! * @roseuid 3CEA1AE702F2
! *
! * @param f_turnAngel
! *
! * @throws xCommunication
! */
! public void turn(double f_turnAngel) throws xCommunication;
! /**
! * This method provides the possibility to send to the server say message.
! *
! * @roseuid 3CEA1B0B0240
! *
! * @param f_sayMessage
! *
! * @throws xCommunication
! */
! public void say(String f_sayMessage) throws xCommunication;
! /**
* This method provides the option to send change view actions to the server
* f_width has to element of: {narrow; normal; wide} and
***************
*** 114,118 ****
* @throws xCommunication
*/
! public void changeView(String f_width , boolean f_highViewQuality) throws xCommunication;
! }
--- 114,118 ----
* @throws xCommunication
*/
! public void changeView(String f_width , boolean f_highViewQuality) throws xCommunication;
! }
\ No newline at end of file
Index: SenseBodyEvent.java
===================================================================
RCS file: /cvsroot/jais/jaisteam/src/jais/communication/SenseBodyEvent.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** SenseBodyEvent.java 8 Jul 2002 07:17:57 -0000 1.8
--- SenseBodyEvent.java 13 Jul 2002 16:21:51 -0000 1.9
***************
*** 14,41 ****
public class SenseBodyEvent extends Event
{
! private static Logger logger=Logger.getLogger("jais.communication"); //get our logger
! /**
! * @roseuid 3CEB63BD0009
! *
! * this method is called by the Communication class
! * it produces the arraylist and calls the parsing method
! */
! public SenseBodyEvent(String f_message)
! {
super(f_message);
m_objects=new ArrayList(1);
parseData();
! }
! /**
! * @param f_message
! * @roseuid 3CEB63BD000A
! *
! * this method is called by the SenseBodyEvent method. it parses the message
! * and stores the elements in the arrylist
! */
! public void parseData()
! {
SenseBodyInfo l_sense_body_info = new SenseBodyInfo();
StringTokenizer l_tokenizer = new StringTokenizer(m_message,"() ");
--- 14,41 ----
public class SenseBodyEvent extends Event
{
! private static Logger logger=Logger.getLogger("jais.communication"); //get our logger
! /**
! * @roseuid 3CEB63BD0009
! *
! * this method is called by the Communication class
! * it produces the arraylist and calls the parsing method
! */
! public SenseBodyEvent(String f_message)
! {
super(f_message);
m_objects=new ArrayList(1);
parseData();
! }
! /**
! * @param f_message
! * @roseuid 3CEB63BD000A
! *
! * this method is called by the SenseBodyEvent method. it parses the message
! * and stores the elements in the arrylist
! */
! public void parseData()
! {
SenseBodyInfo l_sense_body_info = new SenseBodyInfo();
StringTokenizer l_tokenizer = new StringTokenizer(m_message,"() ");
***************
*** 44,96 ****
try
{
! l_tokenizer.nextToken(); // token 'sense_body'
! l_sense_body_info.m_time = Integer.parseInt(l_tokenizer.nextToken()); // element time
! l_tokenizer.nextToken(); // token 'view_mode'
! l_sense_body_info.m_viewQuality = l_tokenizer.nextToken(); // element view quality
! l_sense_body_info.m_viewMode = l_tokenizer.nextToken(); // element view mode
! l_tokenizer.nextToken(); // token 'stamina'
! l_sense_body_info.m_stamina = Double.parseDouble(l_tokenizer.nextToken()); // element stamina
! l_sense_body_info.m_effort = Double.parseDouble(l_tokenizer.nextToken()); // element effort
! l_tokenizer.nextToken(); // token 'speed'
! l_sense_body_info.m_amountOfSpeed = Double.parseDouble(l_tokenizer.nextToken()); // element amount of speed
! l_sense_body_info.m_directionOfSpeed = Integer.parseInt(l_tokenizer.nextToken()); // element direction of speed
! l_tokenizer.nextToken(); // token 'head_angle'
! l_sense_body_info.m_neckDirection = Integer.parseInt(l_tokenizer.nextToken()); // element head angle
! l_tokenizer.nextToken(); // token 'kick'
! l_sense_body_info.m_kickCount = Integer.parseInt(l_tokenizer.nextToken()); // element kick count
! l_tokenizer.nextToken(); // token 'dash'
! l_sense_body_info.m_dashCount = Integer.parseInt(l_tokenizer.nextToken()); // element dash count
! l_tokenizer.nextToken(); // token 'turn'
! l_sense_body_info.m_turnCount = Integer.parseInt(l_tokenizer.nextToken()); // element turn count
! l_tokenizer.nextToken(); // token 'say'
! l_sense_body_info.m_sayCount = Integer.parseInt(l_tokenizer.nextToken()); // element say count
! l_tokenizer.nextToken(); // token 'turn_neck'
! l_sense_body_info.m_turnNeckCount = Integer.parseInt(l_tokenizer.nextToken()); // element turn neck count
! l_tokenizer.nextToken(); // token 'catch'
! l_sense_body_info.m_catchCount = Integer.parseInt(l_tokenizer.nextToken()); // element catch count
! l_tokenizer.nextToken(); // token 'move'
! l_sense_body_info.m_moveCount = Integer.parseInt(l_tokenizer.nextToken()); // element move count
! l_tokenizer.nextToken(); // token 'change_view'
! l_sense_body_info.m_changeViewCount = Integer.parseInt(l_tokenizer.nextToken()); // element change view count
! m_objects.add(l_sense_body_info); // elements are inserted into the list
}
catch(Exception e)
{
! logger.info("Error parsing see message :"+e.getMessage());
}
! }
! }
--- 44,96 ----
try
{
! l_tokenizer.nextToken(); // token 'sense_body'
! l_sense_body_info.m_time = Integer.parseInt(l_tokenizer.nextToken()); // element time
! l_tokenizer.nextToken(); // token 'view_mode'
! l_sense_body_info.m_viewQuality = l_tokenizer.nextToken(); // element view quality
! l_sense_body_info.m_viewMode = l_tokenizer.nextToken(); // element view mode
! l_tokenizer.nextToken(); // token 'stamina'
! l_sense_body_info.m_stamina = Double.parseDouble(l_tokenizer.nextToken()); // element stamina
! l_sense_body_info.m_effort = Double.parseDouble(l_tokenizer.nextToken()); // element effort
! l_tokenizer.nextToken(); // token 'speed'
! l_sense_body_info.m_amountOfSpeed = Double.parseDouble(l_tokenizer.nextToken()); // element amount of speed
! l_sense_body_info.m_directionOfSpeed = Integer.parseInt(l_tokenizer.nextToken()); // element direction of speed
! l_tokenizer.nextToken(); // token 'head_angle'
! l_sense_body_info.m_neckDirection = Integer.parseInt(l_tokenizer.nextToken()); // element head angle
! l_tokenizer.nextToken(); // token 'kick'
! l_sense_body_info.m_kickCount = Integer.parseInt(l_tokenizer.nextToken()); // element kick count
! l_tokenizer.nextToken(); // token 'dash'
! l_sense_body_info.m_dashCount = Integer.parseInt(l_tokenizer.nextToken()); // element dash count
! l_tokenizer.nextToken(); // token 'turn'
! l_sense_body_info.m_turnCount = Integer.parseInt(l_tokenizer.nextToken()); // element turn count
! l_tokenizer.nextToken(); // token 'say'
! l_sense_body_info.m_sayCount = Integer.parseInt(l_tokenizer.nextToken()); // element say count
! l_tokenizer.nextToken(); // token 'turn_neck'
! l_sense_body_info.m_turnNeckCount = Integer.parseInt(l_tokenizer.nextToken()); // element turn neck count
! l_tokenizer.nextToken(); // token 'catch'
! l_sense_body_info.m_catchCount = Integer.parseInt(l_tokenizer.nextToken()); // element catch count
! l_tokenizer.nextToken(); // token 'move'
! l_sense_body_info.m_moveCount = Integer.parseInt(l_tokenizer.nextToken()); // element move count
! l_tokenizer.nextToken(); // token 'change_view'
! l_sense_body_info.m_changeViewCount = Integer.parseInt(l_tokenizer.nextToken()); // element change view count
! m_objects.add(l_sense_body_info); // elements are inserted into the list
}
catch(Exception e)
{
! logger.info("Error parsing see message :"+e.getMessage());
}
! }
! }
\ No newline at end of file
|