#include <SenseHandler.h>
Collaboration diagram for SenseHandler:
Public Methods | |
SenseHandler (Connection *c, WorldModel *wm, ServerSettings *ss, PlayerSettings *ps) | |
void | handleMessagesFromServer () |
void | setTimeSignal () |
bool | analyzeMessage (char *strMsg) |
bool | analyzeSeeGlobalMessage (char *strMsg) |
bool | analyzeSeeMessage (char *strMsg) |
bool | analyzeSenseMessage (char *strMsg) |
bool | analyzeInitMessage (char *strMsg) |
bool | analyzeHearMessage (char *strMsg) |
bool | analyzePlayerMessage (char *strMsg) |
bool | analyzeChangePlayerTypeMessage (char *strMsg) |
bool | analyzeServerParamMessage (char *strMsg) |
bool | analyzeCheckBall (char *strMsg) |
bool | analyzePlayerTypeMessage (char *strMsg) |
bool | analyzePlayerParamMessage (char *strMsg) |
Private Attributes | |
WorldModel * | WM |
ServerSettings * | SS |
PlayerSettings * | PS |
Connection * | connection |
int | iTimeSignal |
int | iTriCounter |
int | iSimStep |
itimerval | itv |
Definition at line 65 of file SenseHandler.h.
|
Constructor for the SenseHandler. It needs a reference to a connection and a reference to a worldmodel.
Definition at line 75 of file SenseHandler.C. References connection, ServerSettings::getSimulatorStep(), iSimStep, iTimeSignal, itv, PS, SS, and WM. |
|
This method analyzes the change player type message. This method checks whether the player that changed type equals the agent. When this is the case, it adjust the ServerSettings according to the values associated with this player type.
Definition at line 620 of file SenseHandler.C. References WorldModel::getPlayerNumber(), Parse::parseFirstInt(), WorldModel::updateSSToHeteroPlayerType(), and WM. Referenced by analyzeMessage(). |
|
This method analyzes the check_ball message that is only received by the coach. It sets the information in the Worldmodel what the status of the ball is. The format is as follows (check_ball <time> <status>).
Definition at line 606 of file SenseHandler.C. References SoccerTypes::getBallStatusFromStr(), Parse::parseFirstInt(), WorldModel::setCheckBallStatus(), WorldModel::setTimeCheckBall(), and WM. Referenced by analyzeMessage(). |
|
|
This method analyzes an init message. All information from the initialization is parsed and updated in the WorldModel. An init message looks like (init [l|r] 10 before_kick_off)
Definition at line 404 of file SenseHandler.C. References SoccerTypes::getPlayModeFromStr(), SoccerTypes::getSideFromStr(), SoccerTypes::getTeammateObjectFromIndex(), Parse::parseFirstInt(), WorldModel::setAgentObjectType(), WorldModel::setPlayerNumber(), WorldModel::setPlayMode(), WorldModel::setSide(), and WM. Referenced by analyzeMessage(). |
|
This method analyzes the type of the incoming message and calls the message that corresponds to this message.
Definition at line 163 of file SenseHandler.C. References analyzeChangePlayerTypeMessage(), analyzeCheckBall(), analyzeHearMessage(), analyzeInitMessage(), analyzePlayerParamMessage(), analyzePlayerTypeMessage(), analyzeSeeGlobalMessage(), analyzeSeeMessage(), analyzeSenseMessage(), and analyzeServerParamMessage(). Referenced by handleMessagesFromServer(). |
|
This method analyzes a player message. Messages from teammates are encoded, so first the message is decoded to see if the message is from a teammate. When this is the case all information (position and velocity from sender and ball and position from all opponents and teammates) are parsed and passed to the WorldModel. The format of the received message is: (say ***** my_x my_y my_vel_x my_vel_y (ball_x ball_y ball_vel_x ball_vel_y ball_conf) (team_nr pos_x pos_y conf ...) (opp_nr pos_x pos_y conf ...))
Definition at line 493 of file SenseHandler.C. References WorldModel::getCurrentCycle(), SoccerTypes::getOpponentObjectFromIndex(), WorldModel::getSide(), SoccerTypes::getTeammateObjectFromIndex(), Parse::gotoFirstNonSpace(), Parse::gotoFirstOccurenceOf(), OBJECT_OPPONENT_UNKNOWN, OBJECT_TEAMMATE_UNKNOWN, ObjectT, Parse::parseFirstDouble(), Parse::parseFirstInt(), WorldModel::processPerfectHearInfo(), WorldModel::processPerfectHearInfoBall(), VecPosition::setX(), VecPosition::setY(), SIDE_LEFT, WorldModel::strLastHearMessage, and WM. Referenced by analyzeHearMessage(). |
|
This method analyzes the player_param message that indicates the ranges of the possible values for the heterogeneous player types. Nothing is done with this information.
Definition at line 780 of file SenseHandler.C. Referenced by analyzeMessage(). |
|
This method analyze a player type message. This message contains the values associated with a specific heterogeneous player type. The values are parsed from the message and supplied to the WorldModel method processNewHeteroPlayer.
Definition at line 753 of file SenseHandler.C. References Parse::parseFirstDouble(), Parse::parseFirstInt(), WorldModel::processNewHeteroPlayer(), and WM. Referenced by analyzeMessage(). |
|
This method analyzes a See Message. All information from the different objects that is stored in a see message is updated in the worldmodel. A see message looks like(see 0 ((g r) 64.1 13) ((f r t) 65.4 -16) ....
Definition at line 285 of file SenseHandler.C. References AngDeg, WorldModel::getCurrentTime(), SoccerTypes::getObjectFromStr(), WorldModel::getTeamName(), OBJECT_ILLEGAL, ObjectT, Parse::parseFirstDouble(), Parse::parseFirstInt(), WorldModel::processSeeGlobalInfo(), WorldModel::setTimeLastSeeGlobalMessage(), WorldModel::strLastSeeMessage, UnknownAngleValue, UnknownDoubleValue, Time::updateTime(), and WM. Referenced by analyzeMessage(). |
|
This method analyzes a see Message. All information from the different objects that are stored in a see message is updated in the worldmodel. A see message looks like(see 0 ((g r) 64.1 13) ((f r t) 65.4 -16) ....
Definition at line 206 of file SenseHandler.C. References AngDeg, WorldModel::getAgentViewFrequency(), SoccerTypes::getObjectFromStr(), WorldModel::getTeamName(), Time::getTime(), Time::getTimeDifference(), WorldModel::getTimeLastSeeMessage(), WorldModel::getTimeLastSenseMessage(), iTriCounter, WorldModel::mapUnknownPlayers(), OBJECT_ILLEGAL, ObjectT, Parse::parseFirstDouble(), Parse::parseFirstInt(), WorldModel::processNewObjectInfo(), WorldModel::setTimeLastSeeMessage(), WorldModel::strLastSeeMessage, UnknownDoubleValue, UnknownIntValue, UnknownTime, and WM. Referenced by analyzeMessage(). |
|
This method analyzes a sense message. All information from the player is parsed and updated in the WorldModel. A sense message looks like (sense_body 0 (view_mode high normal) (stamina 2000 1) (speed 0 0) (head_angle 0) (kick 0) (dash 0) (turn 0) (say 0) (turn_neck 0) (catch 0) (move 0) (change_view 0))
Definition at line 345 of file SenseHandler.C. References AngDeg, CMD_CATCH, CMD_CHANGEVIEW, CMD_DASH, CMD_KICK, CMD_MOVE, CMD_SAY, CMD_TURN, CMD_TURNNECK, WorldModel::getCurrentTime(), Time::getTime(), Time::getTimeDifference(), SoccerTypes::getViewAngleFromStr(), SoccerTypes::getViewQualityFromStr(), Parse::gotoFirstOccurenceOf(), iTimeSignal, Parse::parseFirstDouble(), Parse::parseFirstInt(), WorldModel::processNewAgentInfo(), WorldModel::setNrOfCommands(), WorldModel::setTimeLastSenseMessage(), setTimeSignal(), WorldModel::strLastSenseMessage, Time::updateTime(), ViewAngleT, ViewQualityT, and WM. Referenced by analyzeMessage(). |
|
This method analyzes the server_param message. This message contains all the server parameters. All settings of the ServerSettings are changed according to the supplied values. This makes the reading from a server configuration file obsolete.
Definition at line 637 of file SenseHandler.C. References Parse::parseFirstDouble(), Parse::parseFirstInt(), ServerSettings::setAudioCutDist(), ServerSettings::setBallAccelMax(), ServerSettings::setBallDecay(), ServerSettings::setBallRand(), ServerSettings::setBallSize(), ServerSettings::setBallSpeedMax(), ServerSettings::setBallWeight(), ServerSettings::setCatchableAreaL(), ServerSettings::setCatchableAreaW(), ServerSettings::setCatchBanCycle(), ServerSettings::setCatchProbability(), ServerSettings::setCkickMargin(), ServerSettings::setClangAdviceWin(), ServerSettings::setClangDefineWin(), ServerSettings::setClangInfoWin(), ServerSettings::setClangMessDelay(), ServerSettings::setClangMessPerCycle(), ServerSettings::setClangMetaWin(), ServerSettings::setClangWinSize(), ServerSettings::setDashPowerRate(), ServerSettings::setEffortDec(), ServerSettings::setEffortDecThr(), ServerSettings::setEffortInc(), ServerSettings::setEffortIncThr(), ServerSettings::setEffortMin(), ServerSettings::setForbidKickOffOffside(), ServerSettings::setGoalieMaxMoves(), ServerSettings::setGoalWidth(), ServerSettings::setHalfTime(), ServerSettings::setHearDecay(), ServerSettings::setHearInc(), ServerSettings::setHearMax(), ServerSettings::setInertiaMoment(), ServerSettings::setKickableMargin(), ServerSettings::setKickPowerRate(), ServerSettings::setKickRand(), ServerSettings::setMaximalKickDist(), ServerSettings::setMaxMoment(), ServerSettings::setMaxNeckAng(), ServerSettings::setMaxNeckMoment(), ServerSettings::setMaxPower(), ServerSettings::setMinMoment(), ServerSettings::setMinNeckAng(), ServerSettings::setMinNeckMoment(), ServerSettings::setMinPower(), ServerSettings::setOffsideActiveAreaSize(), ServerSettings::setOffsideKickMargin(), ServerSettings::setPlayerAccelMax(), ServerSettings::setPlayerDecay(), ServerSettings::setPlayerRand(), ServerSettings::setPlayerSize(), ServerSettings::setPlayerSpeedMax(), ServerSettings::setPlayerWeight(), ServerSettings::setQuantizeStep(), ServerSettings::setQuantizeStepL(), ServerSettings::setRecoverDec(), ServerSettings::setRecoverDecThr(), ServerSettings::setRecoverMin(), ServerSettings::setRecvStep(), ServerSettings::setSayCoachCntMax(), ServerSettings::setSayCoachMsgSize(), ServerSettings::setSayMsgSize(), ServerSettings::setSendStep(), ServerSettings::setSenseBodyStep(), ServerSettings::setSimulatorStep(), ServerSettings::setSlowDownFactor(), ServerSettings::setStaminaIncMax(), ServerSettings::setStaminaMax(), ServerSettings::setUseOffside(), ServerSettings::setVisibleAngle(), ServerSettings::setVisibleDistance(), ServerSettings::setWindDir(), ServerSettings::setWindForce(), ServerSettings::setWindRand(), and SS. Referenced by analyzeMessage(). |
|
This is the main routine of this class. It loops forever (till the thread is destroyed) and receives and parses the incoming messages. Definition at line 101 of file SenseHandler.C. References analyzeMessage(), connection, MAX_MSG, and Connection::receiveMessage(). Referenced by sense_callback(). |
|
This method sets the time signal. This is the time that should be waited before the next action should be sent to the server. As soon as a sense message arrives this method is called. Using the information from the member variable 'iTriCounter' which denotes when the see message will arrive in this cycle (0=first half, 1=2nd half, 2=no see, all for the default view frequency) the timer is set. The values that denote the fraction of the simulation step that is waited are all defined in PlayerSettings, such that they can be easily changed. Definition at line 125 of file SenseHandler.C. References WorldModel::getAgentViewFrequency(), PlayerSettings::getFractionWaitNoSee(), PlayerSettings::getFractionWaitSeeBegin(), PlayerSettings::getFractionWaitSeeEnd(), iSimStep, iTimeSignal, iTriCounter, itv, PS, and WM. Referenced by analyzeSenseMessage(). |
|
Connection with server to receive messages Definition at line 69 of file SenseHandler.h. Referenced by handleMessagesFromServer(), and SenseHandler(). |
|
Length (microsec) of server cycles Definition at line 72 of file SenseHandler.h. Referenced by SenseHandler(), and setTimeSignal(). |
|
Wait time (microsec) before sense calls act Definition at line 70 of file SenseHandler.h. Referenced by analyzeSenseMessage(), SenseHandler(), and setTimeSignal(). |
|
Used to indicate when see message will arive Definition at line 71 of file SenseHandler.h. Referenced by analyzeSeeMessage(), and setTimeSignal(). |
|
timer used to set alarm to send action Definition at line 73 of file SenseHandler.h. Referenced by SenseHandler(), and setTimeSignal(). |
|
PlayerSettings containing all client settings Definition at line 68 of file SenseHandler.h. Referenced by SenseHandler(), and setTimeSignal(). |
|
ServerSettings containing all server settings Definition at line 67 of file SenseHandler.h. Referenced by analyzeServerParamMessage(), and SenseHandler(). |
|
Worldmodel containing all data of the match Definition at line 66 of file SenseHandler.h. Referenced by analyzeChangePlayerTypeMessage(), analyzeCheckBall(), analyzeHearMessage(), analyzeInitMessage(), analyzePlayerMessage(), analyzePlayerTypeMessage(), analyzeSeeGlobalMessage(), analyzeSeeMessage(), analyzeSenseMessage(), SenseHandler(), and setTimeSignal(). |