Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

SoccerCommand Class Reference

#include <SoccerTypes.h>

Collaboration diagram for SoccerCommand:

Collaboration graph
[legend]
List of all members.

Public Methods

 SoccerCommand (CommandT com=CMD_ILLEGAL, double d1=UnknownDoubleValue, double d2=UnknownDoubleValue, double d3=UnknownDoubleValue)
 SoccerCommand (CommandT com, char *msg)
void makeCommand (CommandT com, double d1=UnknownDoubleValue, double d2=UnknownDoubleValue, double d3=UnknownDoubleValue)
void makeCommand (CommandT com, ViewAngleT v, ViewQualityT q)
void makeCommand (CommandT com, char *msg)
bool isIllegal ()
void show (ostream &os)
char * getCommandString (char *str, ServerSettings *ss)

Public Attributes

Time time
CommandT commandType
double dAngle
double dPower
ViewQualityT vq
ViewAngleT va
double dX
double dY
char str [MAX_SAY_MSG]
int iTimes

Private Methods

bool makeCatchCommand (char *str)
bool makeChangeViewCommand (char *str)
bool makeDashCommand (char *str)
bool makeKickCommand (char *str)
bool makeMoveCommand (char *str)
bool makeSayCommand (char *str)
bool makeSenseBodyCommand (char *str)
bool makeTurnCommand (char *str)
bool makeTurnNeckCommand (char *str)
bool makeChangePlayerCommand (char *str)

Private Attributes

ServerSettingsSS

Detailed Description

This class resembles a SoccerCommand that contains all the information about a command that can be sent to the server, but the format is independent from the server implementation. A SoccerCommand can be created and before it is sent to the server, be converted to the actual string representation understood by the server.

Definition at line 467 of file SoccerTypes.h.


Constructor & Destructor Documentation

SoccerCommand::SoccerCommand CommandT    com = CMD_ILLEGAL,
double    d1 = UnknownDoubleValue,
double    d2 = UnknownDoubleValue,
double    d3 = UnknownDoubleValue
 

This is a constructor for the SoccerCommand class. It creates a command using the passed arguments (with all default illegal values). Depending on the specified CommandT the parameters are used in different ways. See the method makeCommand for an explanation of these values.

Parameters:
com  commandType for this SoccerCommand
d1  1st argument, meaning depends on com (default UnknownDoubleValue)
d2  2nd argument, meaning depends on com (default UnknownDoubleValue)
d3  3rd argument, meaning depends on com (default UnknownDoubleValue)
Returns:
SoccerCommand with the specified parameters.

Definition at line 442 of file SoccerTypes.C.

References CMD_CHANGEVIEW, CMD_SAY, CommandT, commandType, dAngle, dPower, iTimes, makeCommand(), str, UnknownDoubleValue, va, VA_ILLEGAL, ViewAngleT, ViewQualityT, vq, and VQ_ILLEGAL.

SoccerCommand::SoccerCommand CommandT    com,
char *    msg
 

This is a constructor for the SoccerCommand when the commandType is a say message.

Parameters:
com  commandType for this SoccerCommand (must be CMD_SAY).
msg  message for this SoccerCommand

Definition at line 462 of file SoccerTypes.C.

References CommandT, and makeCommand().


Member Function Documentation

char * SoccerCommand::getCommandString char *    str,
ServerSettings   ss
 

This method returns a command string that is understood by the server from a SoccerCommand. The resulting string is put in the second argument and returned by the method. A reference to ServerSettings is passed as the second argument to check whether the values in the SoccerCommand are legal.

Parameters:
str  resulting string (enough space for MAX_MSG should be allocated)
ss  reference to serversettings class.
Returns:
resulting string

Definition at line 604 of file SoccerTypes.C.

References CMD_CATCH, CMD_CHANGEPLAYER, CMD_CHANGEVIEW, CMD_DASH, CMD_ILLEGAL, CMD_KICK, CMD_MOVE, CMD_SAY, CMD_SENSEBODY, CMD_TURN, CMD_TURNNECK, commandType, makeCatchCommand(), makeChangePlayerCommand(), makeChangeViewCommand(), makeDashCommand(), makeKickCommand(), makeMoveCommand(), makeSayCommand(), makeSenseBodyCommand(), makeTurnCommand(), makeTurnNeckCommand(), SS, and str.

Referenced by ActHandler::sendCommand(), ActHandler::sendCommandDirect(), and ActHandler::sendCommands().

bool SoccerCommand::isIllegal  
 

This method returns whether this SoccerCommand is illegal, that is the SoccerCommand hasn't been filled yet.This means that no command is performed when this command is sent to the server.

Returns:
bool indicating whether the current Command is illegal

Definition at line 592 of file SoccerTypes.C.

References CMD_ILLEGAL, and commandType.

bool SoccerCommand::makeCatchCommand char *    str [private]
 

This method makes a catch command from a SoccerCommand and puts the result in str. Resulting string looks like: (catch dAngle). Enough space should be allocated for str.

Parameters:
command  SoccerCommand that is a catch command
str  string that will be filled with the corresponding SoccerCommand
Returns:
bool indicating whether string is filled or not

Definition at line 639 of file SoccerTypes.C.

References dAngle, ServerSettings::getMaxMoment(), ServerSettings::getMinMoment(), SS, and str.

Referenced by getCommandString().

bool SoccerCommand::makeChangePlayerCommand char *    str [private]
 

This method makes a change_player_type command from a SoccerCommand and puts the result in str. Resulting string looks like: (change_player_type dX dY). Where dX stands for the teammate that should be changed and dY for the heterogenous player that it should become. Enough space should be allocated for str.

Parameters:
command  SoccerCommand that is a turn_neck command
str  string that will be filled with the corresponding SoccerCommand
Returns:
bool indicating whether string is filled or not

Definition at line 816 of file SoccerTypes.C.

References dX, dY, MAX_HETERO_PLAYERS, MAX_TEAMMATES, and str.

Referenced by getCommandString().

bool SoccerCommand::makeChangeViewCommand char *    str [private]
 

This method makes a change view command from a SoccerCommand and puts the result in str. Resulting string looks like: (change_view va vq). Enough space should be allocated for str.

Parameters:
command  SoccerCommand that is a change view command
str  string that will be filled with the corresponding SoccerCommand
Returns:
bool indicating whether string is filled or not

Definition at line 657 of file SoccerTypes.C.

References SoccerTypes::getViewAngleStr(), SoccerTypes::getViewQualityStr(), str, va, VA_ILLEGAL, vq, and VQ_ILLEGAL.

Referenced by getCommandString().

void SoccerCommand::makeCommand CommandT    com,
char *    msg
 

This method creates a command for the command type CMD_SAY that accepts a string as parameter.

Parameters:
com  command type specifying the kind of command.
msg  string message that is added to the say message.

Definition at line 532 of file SoccerTypes.C.

References CMD_SAY, CommandT, commandType, and str.

void SoccerCommand::makeCommand CommandT    com,
ViewAngleT    v,
ViewQualityT    q
 

This method creates a SoccerCommand for the command type CMD_CHANGEVIEW.

Parameters:
com  command type specifying the kind of command
v  view angle for the change view command
q  view quality for the change view command

Definition at line 518 of file SoccerTypes.C.

References CMD_CHANGEVIEW, CommandT, commandType, va, ViewAngleT, ViewQualityT, and vq.

void SoccerCommand::makeCommand CommandT    com,
double    d1 = UnknownDoubleValue,
double    d2 = UnknownDoubleValue,
double    d3 = UnknownDoubleValue
 

This method create a SoccerCommand from the specified command type and the parameters. The parameters have a different meaning depending on the given command type. Not all command types are listed, since the other command types need different parameters. So see the other overloaded methods for that.

  • CMD_DASH: d1 = power for dashing
  • CMD_TURN: d1 = angle body is turned
  • CMD_TURNNECK d1 = angle neck is turned
  • CMD_KICK d1 = power for kick command, d2 = angle for kick
  • CMD_MOVE d1 = x position, d2 = y position, d3 = body_angle
  • CMD_CATCH d1 = catch angle
  • CMD_CHANGEPLAYER d1 = player number, d2 = nr of new player type
Parameters:
com  command type specifying the kind of command
d1  meaning depends on the specified command type (see above)
d2  meaning depends on the specified command type (see above)
d3  meaning depends on the specified command type (see above)

Definition at line 483 of file SoccerTypes.C.

References CMD_CATCH, CMD_CHANGEPLAYER, CMD_DASH, CMD_KICK, CMD_MOVE, CMD_TURN, CMD_TURNNECK, CommandT, commandType, dAngle, dPower, dX, dY, and UnknownDoubleValue.

Referenced by Player::deMeer5_goalie(), Player::executeStringCommand(), and SoccerCommand().

bool SoccerCommand::makeDashCommand char *    str [private]
 

This method makes a dash command from a SoccerCommand and puts the result in str. Resulting string looks like: (dash dPower). Enough space should be allocated for str.

Parameters:
command  SoccerCommand that is a dash command
str  string that will be filled with the corresponding SoccerCommand
Returns:
bool indicating whether string is filled or not

Definition at line 678 of file SoccerTypes.C.

References dPower, ServerSettings::getMaxPower(), ServerSettings::getMinPower(), SS, and str.

Referenced by getCommandString().

bool SoccerCommand::makeKickCommand char *    str [private]
 

This method makes a kick command from a SoccerCommand and puts the result in str. Resulting string looks like: (kick dPower dAngle). Enough space should be allocated for str.

Parameters:
command  SoccerCommand that is a kick command
str  string that will be filled with the corresponding SoccerCommand
Returns:
bool indicating whether string is filled or not

Definition at line 699 of file SoccerTypes.C.

References dAngle, dPower, ServerSettings::getMaxMoment(), ServerSettings::getMaxPower(), ServerSettings::getMinMoment(), ServerSettings::getMinPower(), SS, and str.

Referenced by getCommandString().

bool SoccerCommand::makeMoveCommand char *    str [private]
 

This method makes a move command from a SoccerCommand and puts the result in str. Resulting string looks like: (move dX dY). Enough space should be allocated for str.

Parameters:
command  SoccerCommand that is a move command
str  string that will be filled with the corresponding SoccerCommand
Returns:
bool indicating whether string is filled or not

Definition at line 719 of file SoccerTypes.C.

References dX, dY, PITCH_LENGTH, PITCH_MARGIN, PITCH_WIDTH, and str.

Referenced by getCommandString().

bool SoccerCommand::makeSayCommand char *    str_com [private]
 

This method makes a say command from a SoccerCommand and puts the result in str. Resulting string looks like: (say str). Enough space should be allocated for str.

Parameters:
command  SoccerCommand that is a say command
str_com  string that will be filled with corresponding SoccerCommand
Returns:
bool indicating whether string is filled or not

Definition at line 741 of file SoccerTypes.C.

References str.

Referenced by getCommandString().

bool SoccerCommand::makeSenseBodyCommand char *    str [private]
 

This method makes a sense_body command from a SoccerCommand and puts the result in str. Resulting string looks like: (sense_body). Enough space should be allocated for str.

Parameters:
str  string that will be filled with the corresponding SoccerCommand
Returns:
bool indicating whether string is filled or not

Definition at line 758 of file SoccerTypes.C.

References str.

Referenced by getCommandString().

bool SoccerCommand::makeTurnCommand char *    str [private]
 

This method makes a turn command from a SoccerCommand and puts the result in str. Resulting string looks like: (turn dAngle). Enough space should be allocated for str.

Parameters:
command  SoccerCommand that is a turn command
str  string that will be filled with the corresponding SoccerCommand
Returns:
bool indicating whether string is filled or not

Definition at line 770 of file SoccerTypes.C.

References dAngle, ServerSettings::getMaxMoment(), ServerSettings::getMinMoment(), SS, and str.

Referenced by getCommandString().

bool SoccerCommand::makeTurnNeckCommand char *    str [private]
 

This method makes a turn_neck command from a SoccerCommand and puts the result in str. Resulting string looks like: (turn_neck dAngle). Enough space should be allocated for str.

Parameters:
command  SoccerCommand that is a turn_neck command
str  string that will be filled with the corresponding SoccerCommand
Returns:
bool indicating whether string is filled or not

Definition at line 791 of file SoccerTypes.C.

References dAngle, ServerSettings::getMaxNeckMoment(), ServerSettings::getMinNeckMoment(), SS, and str.

Referenced by getCommandString().

void SoccerCommand::show ostream &    os
 

This method prints the current command to the specified output stream.

Parameters:
os  output stream to which information is printed.

Definition at line 541 of file SoccerTypes.C.

References CMD_CATCH, CMD_CHANGEPLAYER, CMD_CHANGEVIEW, CMD_DASH, CMD_ILLEGAL, CMD_KICK, CMD_MOVE, CMD_SAY, CMD_SENSEBODY, CMD_TURN, CMD_TURNNECK, commandType, dAngle, dPower, dX, dY, SoccerTypes::getViewAngleStr(), SoccerTypes::getViewQualityStr(), iTimes, str, time, va, and vq.

Referenced by WorldModel::showQueuedCommands().


Member Data Documentation

CommandT SoccerCommand::commandType
 

type of this command

Definition at line 489 of file SoccerTypes.h.

Referenced by Player::deMeer5(), ActHandler::emptyQueue(), Player::executeStringCommand(), getCommandString(), BasicPlayer::intercept(), WorldModel::isCollisionAfterDash(), isIllegal(), ActHandler::isQueueEmpty(), makeCommand(), WorldModel::predictStateAfterCommand(), WorldModel::processQueuedCommands(), ActHandler::putCommandInQueue(), ActHandler::sendCommands(), show(), WorldModel::showQueuedCommands(), SoccerCommand(), WorldModel::updateAgentAndBallAfterSense(), and WorldModel::WorldModel().

double SoccerCommand::dAngle
 

angle of this command (for turn,turn_neck)

Definition at line 490 of file SoccerTypes.h.

Referenced by Player::executeStringCommand(), makeCatchCommand(), makeCommand(), makeKickCommand(), makeTurnCommand(), makeTurnNeckCommand(), WorldModel::predictStateAfterCommand(), show(), and SoccerCommand().

double SoccerCommand::dPower
 

power of this command (for kick,dash)

Definition at line 491 of file SoccerTypes.h.

Referenced by Player::deMeer5(), Player::executeStringCommand(), makeCommand(), makeDashCommand(), makeKickCommand(), WorldModel::predictStateAfterCommand(), show(), and SoccerCommand().

double SoccerCommand::dX
 

x coordinate (for move)

Definition at line 494 of file SoccerTypes.h.

Referenced by Player::executeStringCommand(), makeChangePlayerCommand(), makeCommand(), makeMoveCommand(), WorldModel::predictStateAfterCommand(), and show().

double SoccerCommand::dY
 

y coordinate (for move)

Definition at line 495 of file SoccerTypes.h.

Referenced by Player::executeStringCommand(), makeChangePlayerCommand(), makeCommand(), makeMoveCommand(), WorldModel::predictStateAfterCommand(), and show().

int SoccerCommand::iTimes
 

how many cycles will command be sent in a row

Definition at line 497 of file SoccerTypes.h.

Referenced by Player::executeStringCommand(), ActHandler::sendCommands(), show(), and SoccerCommand().

ServerSettings* SoccerCommand::SS [private]
 

ServerSettings are used to check ranges of command

Definition at line 469 of file SoccerTypes.h.

Referenced by getCommandString(), makeCatchCommand(), makeDashCommand(), makeKickCommand(), makeTurnCommand(), and makeTurnNeckCommand().

char SoccerCommand::str[MAX_SAY_MSG]
 

str (for say)

Definition at line 496 of file SoccerTypes.h.

Referenced by Player::executeStringCommand(), getCommandString(), makeCatchCommand(), makeChangePlayerCommand(), makeChangeViewCommand(), makeCommand(), makeDashCommand(), makeKickCommand(), makeMoveCommand(), makeSayCommand(), makeSenseBodyCommand(), makeTurnCommand(), makeTurnNeckCommand(), show(), and SoccerCommand().

Time SoccerCommand::time
 

command time, will be set by worldmodel

Definition at line 488 of file SoccerTypes.h.

Referenced by WorldModel::isQueuedActionPerformed(), WorldModel::processQueuedCommands(), show(), and WorldModel::updateAgentAndBallAfterSense().

ViewAngleT SoccerCommand::va
 

view angle (for change_view)

Definition at line 493 of file SoccerTypes.h.

Referenced by Player::executeStringCommand(), makeChangeViewCommand(), makeCommand(), show(), and SoccerCommand().

ViewQualityT SoccerCommand::vq
 

view quality (for change_view)

Definition at line 492 of file SoccerTypes.h.

Referenced by Player::executeStringCommand(), makeChangeViewCommand(), makeCommand(), show(), and SoccerCommand().


The documentation for this class was generated from the following files:
Generated on Thu Mar 7 00:37:58 2002 for UvA Trilearn 2001 by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001