classbasicplayer.html

来自「仿真人工智能是指用人工的方法和技术」· HTML 代码 · 共 758 行 · 第 1/5 页

HTML
758
字号
<p>This method can be called to create a <a class="el" href="classSoccerCommand.html">SoccerCommand</a> that dashes to a point. This skill enables an agent to dash to a given point. It receives a global position 'pos' as its only argument and returns a dash command that causes the agent to come as close to this point as possible. Since the agent can only move forwards or backwards, the closest point to the target position that he can reach by dashing is the orthogonal projection of 'pos' onto the line that extends into the direction of his body (forwards and backwards). The power that must be supplied to the dash command is computed using the 'getPowerForDash' method which takes the position of 'pos' relative to the agent as input. <dl compact><dt><b>Parameters: </b><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>pos</em>&nbsp;</td><td>global position to which the agent wants to dash </td></tr></table></dl><dl compact><dt><b>Returns: </b><dd><a class="el" href="classSoccerCommand.html">SoccerCommand</a> dash command to move closer to 'pos' </dl><p>Definition at line <a class="el" href="BasicPlayer_8C-source.html#l00210">210</a> of file <a class="el" href="BasicPlayer_8C-source.html">BasicPlayer.C</a>.<p>References <a class="el" href="namespace_3globalScope_4.html#a247a181">CMD_DASH</a>, <a class="el" href="WorldModel_8C-source.html#l00547">WorldModel::getAgentEffort</a>(), <a class="el" href="WorldModel_8C-source.html#l00533">WorldModel::getAgentGlobalBodyAngle</a>(), <a class="el" href="WorldModel_8C-source.html#l00568">WorldModel::getAgentGlobalPosition</a>(), <a class="el" href="WorldModel_8C-source.html#l00554">WorldModel::getAgentGlobalVelocity</a>(), <a class="el" href="WorldModelHighLevel_8C-source.html#l01126">WorldModel::getPowerForDash</a>(), and <a class="el" href="BasicPlayer_8h-source.html#l00058">WM</a>.<p>Referenced by <a class="el" href="BasicPlayer_8C-source.html#l00671">interceptCloseGoalie</a>(), <a class="el" href="BasicPlayer_8C-source.html#l00442">moveToPos</a>(), and <a class="el" href="BasicPlayer_8C-source.html#l00962">moveToPosAlongLine</a>().    </td>  </tr></table><a name="b28" doxytag="BasicPlayer::defendGoalLine"></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"> <a class="el" href="classSoccerCommand.html">SoccerCommand</a> BasicPlayer::defendGoalLine </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">double&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp; <em>dDist</em>          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap><code> [protected]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>This skill enables an agent (usually the goalkeeper) to defend his own goal line. To this end the agent moves to a position along a line l which runs parallel to the goal line at a small distance 'dDist' (supplied as an argument) from the goal. The guard point to which the agent moves depends on the predicted position of the ball in the next cycle and is chosen in anticipation of a future shot on goal. This means that the guard point is selected in such a way that it will be most difficult for the opponent team to pass the goalkeeper. To find this point we need to look at the angle that the ball makes with respect to the left and right goal posts and we need to determine which point on l covers this angle in the most optimal way, i.e. leaves an equal gap to the left and to the right of the goalkeeper. Let m be the line that goes through the center point of the goal line and through the predicted ball position in the next cycle. Since this line m bisects the above-mentioned angle, the optimal guard point on l can be computed by determining the intersection between l and m. Note that in our current implementation the goalkeeper always stays in front of the goal mouth to avoid leaving an open goal when the ball is passed to an opponent in the center of the penalty area. The computed guard point is therefore adjusted if it lies too far to the side . After computing the guard point the goalkeeper needs to move to this point while keeping sight of the ball. If the distance between the current goalkeeper position and the line l is larger than DefendGoalLineMaxDist (which has a value of 3.0 in our current implementation) the moveToPos skill is used to move directly towards the guard point. This can happen, for example, when the goalkeeper has moved forward from his line to intercept the ball and now has to move back to his line again. Note that the fourth argument supplied to the moveToPos skill equals true in this case to indicate that the goalkeeper wants to turn his back to the guard point in order to keep the ball in sight while moving. However, if the distance between the guard point and l is less than DefendGoalLineMaxDist then the moveToPosAlongLine skill is used to move along l to the guard point. This skill receives an argument `sign' representing a prediction of the agent's movement in the coming cycles. This value is used to adjust the agent's body direction when necessary. In this case it can be expected that the goalkeeper will move along l in the same direction as the ball and `sign' is therefore determined by looking at the ball velocity in cycle t. <dl compact><dt><b>Parameters: </b><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>dDist</em>&nbsp;</td><td>distance before goal the goalkeeper will move along </td></tr></table></dl><dl compact><dt><b>Returns: </b><dd><a class="el" href="classSoccerCommand.html">SoccerCommand</a> to defend the goal line. </dl><p>Definition at line <a class="el" href="BasicPlayer_8C-source.html#l01521">1521</a> of file <a class="el" href="BasicPlayer_8C-source.html">BasicPlayer.C</a>.<p>References <a class="el" href="Geometry_8h-source.html#l00052">AngDeg</a>, <a class="el" href="WorldModel_8C-source.html#l00533">WorldModel::getAgentGlobalBodyAngle</a>(), <a class="el" href="WorldModel_8C-source.html#l00568">WorldModel::getAgentGlobalPosition</a>(), <a class="el" href="WorldModel_8C-source.html#l00620">WorldModel::getBallPos</a>(), <a class="el" href="WorldModel_8C-source.html#l00803">WorldModel::getConfidence</a>(), <a class="el" href="Geometry_8C-source.html#l00589">VecPosition::getDistanceTo</a>(), <a class="el" href="WorldModel_8C-source.html#l00689">WorldModel::getGlobalVelocity</a>(), <a class="el" href="ServerSettings_8C-source.html#l00523">ServerSettings::getGoalWidth</a>(), <a class="el" href="Geometry_8C-source.html#l01278">Line::getIntersection</a>(), <a class="el" href="Geometry_8C-source.html#l00542">VecPosition::getX</a>(), <a class="el" href="Geometry_8C-source.html#l00558">VecPosition::getY</a>(), <a class="el" href="WorldModelHighLevel_8C-source.html#l00675">WorldModel::isInOwnPenaltyArea</a>(), <a class="el" href="Geometry_8C-source.html#l01475">Line::makeLineFromPositionAndAngle</a>(), <a class="el" href="Geometry_8C-source.html#l01447">Line::makeLineFromTwoPoints</a>(), <a class="el" href="BasicPlayer_8C-source.html#l00442">moveToPos</a>(), <a class="el" href="BasicPlayer_8C-source.html#l00962">moveToPosAlongLine</a>(), <a class="el" href="namespace_3globalScope_4.html#a240a24">OBJECT_BALL</a>, <a class="el" href="SoccerTypes_8h-source.html#l00075">PITCH_LENGTH</a>, <a class="el" href="Geometry_8C-source.html#l00550">VecPosition::setY</a>(), <a class="el" href="Geometry_8C-source.html#l00057">sign</a>(), <a class="el" href="BasicPlayer_8h-source.html#l00059">SS</a>, <a class="el" href="WorldModel_8h-source.html#l00165">WorldModel::strLastSeeMessage</a>, and <a class="el" href="BasicPlayer_8h-source.html#l00058">WM</a>.    </td>  </tr></table><a name="b22" doxytag="BasicPlayer::directPass"></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"> <a class="el" href="classSoccerCommand.html">SoccerCommand</a> BasicPlayer::directPass </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top"><a class="el" href="SoccerTypes_8h.html#a240">ObjectT</a>&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>o</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap><a class="el" href="SoccerTypes_8h.html#a254">PassT</a>&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>passType</em></td>        </tr>        <tr>          <td></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"><code> [protected]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>This skill enables an agent to pass the ball directly to another player. It receives two arguments, 'o' and 'passType', which respectively denote the object (usually a teammate) to which the agent wants to pass the ball and the kind of pass (either normal or fast) that should be given. This skill uses the kickTo skill to pass the ball to the current location of the object o with a certain desired end speed depending on the type of pass. <dl compact><dt><b>Parameters: </b><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>o</em>&nbsp;</td><td>object to which a direct pass should be given </td></tr><tr><td valign=top><em>passType</em>&nbsp;</td><td>kind of pass (either PASS_NORMAL or PASS_FAST ) </td></tr></table></dl><dl compact><dt><b>Returns: </b><dd><a class="el" href="classSoccerCommand.html">SoccerCommand</a> to perform a direct pass to object 'o' </dl><p>Definition at line <a class="el" href="BasicPlayer_8C-source.html#l01120">1120</a> of file <a class="el" href="BasicPlayer_8C-source.html">BasicPlayer.C</a>.<p>References <a class="el" href="namespace_3globalScope_4.html#a247a180">CMD_ILLEGAL</a>, <a class="el" href="PlayerSettings_8C-source.html#l00341">PlayerSettings::getFastPassEndSpeed</a>(), <a class="el" href="WorldModel_8C-source.html#l00658">WorldModel::getGlobalPosition</a>(), <a class="el" href="PlayerSettings_8C-source.html#l00323">PlayerSettings::getPassEndSpeed</a>(), <a class="el" href="BasicPlayer_8C-source.html#l00775">kickTo</a>(), <a class="el" href="SoccerTypes_8h-source.html#l00102">ObjectT</a>, <a class="el" href="namespace_3globalScope_4.html#a254a234">PASS_FAST</a>, <a class="el" href="namespace_3globalScope_4.html#a254a235">PASS_NORMAL</a>, <a class="el" href="SoccerTypes_8h-source.html#l00383">PassT</a>, <a class="el" href="BasicPlayer_8h-source.html#l00060">PS</a>, and <a class="el" href="BasicPlayer_8h-source.html#l00058">WM</a>.    </td>  </tr></table><a name="b21" doxytag="BasicPlayer::dribble"></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"> <a class="el" href="classSoccerCommand.html">SoccerCommand</a> BasicPlayer::dribble </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top"><a class="el" href="Geometry_8h.html#a2">AngDeg</a>&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>ang</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap><a class="el" href="SoccerTypes_8h.html#a253">DribbleT</a>&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>dribbleT</em></td>        </tr>        <tr>          <td></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"><code> [protected]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>This skill enables an agent to dribble with the ball, i.e. to move with the ball while keeping it within a certain distance. This amounts to repeatedly kicking the ball at a certain speed into a desired direction and then intercepting it again. Two arguments, the angle 'ang' and type 'dribbleT', are supplied to this skill which respectively denote the global direction towards which the agent wants to dribble and the kind of dribble that must be performed. We distinguish three kinds of dribbling:<ul><li>DRIBBLE FAST: a fast dribble action in which the agent kicks the ball relatively far ahead of him.<li>DRIBBLE SLOW: a slower dribble action in which the agent keeps the ball closer than on a fast dribble.<li>DRIBBLE WITH BALL: a safe dribble action in which the agent keeps the ball very close to his body.</ul>It is important to realize that this skill is only called when the ball is located within the agent's kickable range. This means that it is only responsible for the kicking part of the overall dribbling behavior, i.e. it only causes the ball to be kicked a certain distance ahead into the desired direction 'ang'. If the absolute angle between 'ang' and the agent's body direction is larger than DribbleTurnAngle (which currently has a value of 30 degrees) then the agent uses the turnWithBallTo skill to turn with the ball towards the global angle 'ang'. Otherwise, he uses the kickTo skill to kick the ball into the desired direction towards a point that lies a certain distance ahead depending on the type of dribble. After the kick, the ball will move out of the agent's kickable range and as a result the agent will try to intercept it using the intercept skill. The dribbling skill can then be called again once the agent has succeeded in intercepting the ball. This sequence of kicking and intercepting will repeat itself until the agent decides to perform another skill. Note that during the dribble the power of a kick depends on the distance that the ball should travel and on the speed that it should have when it reaches the target point. In our current implementation this speed equals 0.5 (=DribbleKickEndSpeed) for any type of dribble. Experiments have shown that lower end speed values cause the agent to intercept the ball before it reaches the target point which slows the dribble down significantly. <dl compact><dt><b>Parameters: </b><dd><table border=0 cellspacing=2 cellpadding=0>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?