classsensehandler.html
来自「仿真人工智能是指用人工的方法和技术」· HTML 代码 · 共 916 行 · 第 1/4 页
HTML
916 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>SenseHandler class Reference</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body bgcolor="#ffffff"><!-- Generated by Doxygen 1.2.12 --><center><a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> </center><hr><h1>SenseHandler Class Reference</h1><code>#include <<a class="el" href="SenseHandler_8h-source.html">SenseHandler.h</a>></code><p>Collaboration diagram for SenseHandler:<p><center><img src="classSenseHandler__coll__graph.gif" border="0" usemap="#SenseHandler__coll__map" alt="Collaboration graph"></center><map name="SenseHandler__coll__map"><area href="classPlayerSettings.html" shape="rect" coords="25,36,115,55" alt=""><area href="classWorldModel.html" shape="rect" coords="193,127,275,146" alt=""><area href="classServerSettings.html" shape="rect" coords="25,158,115,176" alt=""><area href="classConnection.html" shape="rect" coords="197,246,271,264" alt=""></map><center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center><a href="classSenseHandler-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0><tr><td colspan=2><br><h2>Public Methods</h2></td></tr><tr><td nowrap align=right valign=top> </td><td valign=bottom><a class="el" href="classSenseHandler.html#a0">SenseHandler</a> (<a class="el" href="classConnection.html">Connection</a> *c, <a class="el" href="classWorldModel.html">WorldModel</a> *wm, <a class="el" href="classServerSettings.html">ServerSettings</a> *ss, <a class="el" href="classPlayerSettings.html">PlayerSettings</a> *ps)</td></tr><tr><td nowrap align=right valign=top>void </td><td valign=bottom><a class="el" href="classSenseHandler.html#a1">handleMessagesFromServer</a> ()</td></tr><tr><td nowrap align=right valign=top>void </td><td valign=bottom><a class="el" href="classSenseHandler.html#a2">setTimeSignal</a> ()</td></tr><tr><td nowrap align=right valign=top>bool </td><td valign=bottom><a class="el" href="classSenseHandler.html#a3">analyzeMessage</a> (char *strMsg)</td></tr><tr><td nowrap align=right valign=top>bool </td><td valign=bottom><a class="el" href="classSenseHandler.html#a4">analyzeSeeGlobalMessage</a> (char *strMsg)</td></tr><tr><td nowrap align=right valign=top>bool </td><td valign=bottom><a class="el" href="classSenseHandler.html#a5">analyzeSeeMessage</a> (char *strMsg)</td></tr><tr><td nowrap align=right valign=top>bool </td><td valign=bottom><a class="el" href="classSenseHandler.html#a6">analyzeSenseMessage</a> (char *strMsg)</td></tr><tr><td nowrap align=right valign=top>bool </td><td valign=bottom><a class="el" href="classSenseHandler.html#a7">analyzeInitMessage</a> (char *strMsg)</td></tr><tr><td nowrap align=right valign=top>bool </td><td valign=bottom><a class="el" href="classSenseHandler.html#a8">analyzeHearMessage</a> (char *strMsg)</td></tr><tr><td nowrap align=right valign=top>bool </td><td valign=bottom><a class="el" href="classSenseHandler.html#a9">analyzePlayerMessage</a> (char *strMsg)</td></tr><tr><td nowrap align=right valign=top>bool </td><td valign=bottom><a class="el" href="classSenseHandler.html#a10">analyzeChangePlayerTypeMessage</a> (char *strMsg)</td></tr><tr><td nowrap align=right valign=top>bool </td><td valign=bottom><a class="el" href="classSenseHandler.html#a11">analyzeServerParamMessage</a> (char *strMsg)</td></tr><tr><td nowrap align=right valign=top>bool </td><td valign=bottom><a class="el" href="classSenseHandler.html#a12">analyzeCheckBall</a> (char *strMsg)</td></tr><tr><td nowrap align=right valign=top>bool </td><td valign=bottom><a class="el" href="classSenseHandler.html#a13">analyzePlayerTypeMessage</a> (char *strMsg)</td></tr><tr><td nowrap align=right valign=top>bool </td><td valign=bottom><a class="el" href="classSenseHandler.html#a14">analyzePlayerParamMessage</a> (char *strMsg)</td></tr><tr><td colspan=2><br><h2>Private Attributes</h2></td></tr><tr><td nowrap align=right valign=top><a class="el" href="classWorldModel.html">WorldModel</a> * </td><td valign=bottom><a class="el" href="classSenseHandler.html#o0">WM</a></td></tr><tr><td nowrap align=right valign=top><a class="el" href="classServerSettings.html">ServerSettings</a> * </td><td valign=bottom><a class="el" href="classSenseHandler.html#o1">SS</a></td></tr><tr><td nowrap align=right valign=top><a class="el" href="classPlayerSettings.html">PlayerSettings</a> * </td><td valign=bottom><a class="el" href="classSenseHandler.html#o2">PS</a></td></tr><tr><td nowrap align=right valign=top><a class="el" href="classConnection.html">Connection</a> * </td><td valign=bottom><a class="el" href="classSenseHandler.html#o3">connection</a></td></tr><tr><td nowrap align=right valign=top>int </td><td valign=bottom><a class="el" href="classSenseHandler.html#o4">iTimeSignal</a></td></tr><tr><td nowrap align=right valign=top>int </td><td valign=bottom><a class="el" href="classSenseHandler.html#o5">iTriCounter</a></td></tr><tr><td nowrap align=right valign=top>int </td><td valign=bottom><a class="el" href="classSenseHandler.html#o6">iSimStep</a></td></tr><tr><td nowrap align=right valign=top>itimerval </td><td valign=bottom><a class="el" href="classSenseHandler.html#o7">itv</a></td></tr></table><hr><a name="_details"></a><h2>Detailed Description</h2>Class SenseHandler receives input from a (Robocup Simulation) server (through an instance of <a class="el" href="classConnection.html">Connection</a>). The class contains methods to parse the incoming messages and updates the <a class="el" href="classWorldModel.html">WorldModel</a> accordingly. It is used by creating a SenseHandler class and then assigning a specific thread to the function <a class="el" href="classSenseHandler.html#a1">handleMessagesFromServer</a>() (this thread has to call function sense_callback). In this way all messages are received and parsed (since the receiveMessage from the <a class="el" href="classConnection.html">Connection</a> blocks till a message arrives). Other threads can think about the next action while the SenseHandler updates the <a class="el" href="classWorldModel.html">WorldModel</a> each time new information arrives. <p><p>Definition at line <a class="el" href="SenseHandler_8h-source.html#l00065">65</a> of file <a class="el" href="SenseHandler_8h-source.html">SenseHandler.h</a>.<hr><h2>Constructor & Destructor Documentation</h2><a name="a0" doxytag="SenseHandler::SenseHandler"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> SenseHandler::SenseHandler </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="classConnection.html">Connection</a> * </td> <td class="mdname" nowrap> <em>c</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap><a class="el" href="classWorldModel.html">WorldModel</a> * </td> <td class="mdname" nowrap> <em>wm</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap><a class="el" href="classServerSettings.html">ServerSettings</a> * </td> <td class="mdname" nowrap> <em>ss</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap><a class="el" href="classPlayerSettings.html">PlayerSettings</a> * </td> <td class="mdname" nowrap> <em>ps</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Constructor for the SenseHandler. It needs a reference to a connection and a reference to a worldmodel. <dl compact><dt><b>Parameters: </b><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>c</em> </td><td><a class="el" href="classConnection.html">Connection</a> from which input is received </td></tr><tr><td valign=top><em>wm</em> </td><td><a class="el" href="classWorldModel.html">WorldModel</a> to which new information will be sent for processing </td></tr><tr><td valign=top><em>ss</em> </td><td><a class="el" href="classServerSettings.html">ServerSettings</a> that contain the parameters used by the server </td></tr><tr><td valign=top><em>ps</em> </td><td><a class="el" href="classPlayerSettings.html">PlayerSettings</a> that determine how to interact with messages. </td></tr></table></dl><p>Definition at line <a class="el" href="SenseHandler_8C-source.html#l00075">75</a> of file <a class="el" href="SenseHandler_8C-source.html">SenseHandler.C</a>.<p>References <a class="el" href="SenseHandler_8h-source.html#l00069">connection</a>, <a class="el" href="ServerSettings_8C-source.html#l01639">ServerSettings::getSimulatorStep</a>(), <a class="el" href="SenseHandler_8h-source.html#l00072">iSimStep</a>, <a class="el" href="SenseHandler_8h-source.html#l00070">iTimeSignal</a>, <a class="el" href="SenseHandler_8h-source.html#l00073">itv</a>, <a class="el" href="SenseHandler_8h-source.html#l00068">PS</a>, <a class="el" href="SenseHandler_8h-source.html#l00067">SS</a>, and <a class="el" href="SenseHandler_8h-source.html#l00066">WM</a>. </td> </tr></table><hr><h2>Member Function Documentation</h2><a name="a10" doxytag="SenseHandler::analyzeChangePlayerTypeMessage"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> bool SenseHandler::analyzeChangePlayerTypeMessage </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">char * </td> <td class="mdname1" valign="top" nowrap> <em>strMsg</em> </td> <td class="md" valign="top">) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>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 <a class="el" href="classServerSettings.html">ServerSettings</a> according to the values associated with this player type. <dl compact><dt><b>Parameters: </b><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>strMsg</em> </td><td>string that contains the player type message. </td></tr></table></dl><dl compact><dt><b>Returns: </b><dd>bool indicating whether player type of agent changed. </dl><p>Definition at line <a class="el" href="SenseHandler_8C-source.html#l00620">620</a> of file <a class="el" href="SenseHandler_8C-source.html">SenseHandler.C</a>.<p>References <a class="el" href="WorldModel_8C-source.html#l00282">WorldModel::getPlayerNumber</a>(), <a class="el" href="Parse_8C-source.html#l00107">Parse::parseFirstInt</a>(), <a class="el" href="WorldModelUpdate_8C-source.html#l01812">WorldModel::updateSSToHeteroPlayerType</a>(), and <a class="el" href="SenseHandler_8h-source.html#l00066">WM</a>.<p>Referenced by <a class="el" href="SenseHandler_8C-source.html#l00163">analyzeMessage</a>(). </td> </tr></table><a name="a12" doxytag="SenseHandler::analyzeCheckBall"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> bool SenseHandler::analyzeCheckBall </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">char * </td> <td class="mdname1" valign="top" nowrap> <em>strMsg</em> </td> <td class="md" valign="top">) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>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>). <dl compact><dt><b>Parameters: </b><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>strMsg</em> </td><td>string that contains the check_ball message </td></tr></table></dl><dl compact><dt><b>Returns: </b><dd>bool indicating whether update succeeded. </dl><p>Definition at line <a class="el" href="SenseHandler_8C-source.html#l00606">606</a> of file <a class="el" href="SenseHandler_8C-source.html">SenseHandler.C</a>.<p>References <a class="el" href="SoccerTypes_8C-source.html#l01801">SoccerTypes::getBallStatusFromStr</a>(), <a class="el" href="Parse_8C-source.html#l00107">Parse::parseFirstInt</a>(), <a class="el" href="WorldModel_8C-source.html#l00435">WorldModel::setCheckBallStatus</a>(), <a class="el" href="WorldModel_8C-source.html#l00416">WorldModel::setTimeCheckBall</a>(), and <a class="el" href="SenseHandler_8h-source.html#l00066">WM</a>.<p>Referenced by <a class="el" href="SenseHandler_8C-source.html#l00163">analyzeMessage</a>(). </td> </tr></table><a name="a8" doxytag="SenseHandler::analyzeHearMessage"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> bool SenseHandler::analyzeHearMessage </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">char * </td> <td class="mdname1" valign="top" nowrap> <em>strMsg</em> </td> <td class="md" valign="top">) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?