⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 worldmodelupdate_8c-source.html

📁 仿真人工智能是指用人工的方法和技术
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<!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>WorldModelUpdate.C Source File</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> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; </center><hr><h1>WorldModelUpdate.C</h1><a href="WorldModelUpdate_8C.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <font class="comment">/*</font>00002 <font class="comment">Copyright (c) 2000,2001, Jelle Kok, University of Amsterdam</font>00003 <font class="comment">All rights reserved.</font>00004 <font class="comment"></font>00005 <font class="comment">Redistribution and use in source and binary forms, with or without </font>00006 <font class="comment">modification, are permitted provided that the following conditions are met:</font>00007 <font class="comment"></font>00008 <font class="comment">1. Redistributions of source code must retain the above copyright notice, this </font>00009 <font class="comment">list of conditions and the following disclaimer. </font>00010 <font class="comment"></font>00011 <font class="comment">2. Redistributions in binary form must reproduce the above copyright notice, </font>00012 <font class="comment">this list of conditions and the following disclaimer in the documentation </font>00013 <font class="comment">and/or other materials provided with the distribution. </font>00014 <font class="comment"></font>00015 <font class="comment">3. Neither the name of the University of Amsterdam nor the names of its </font>00016 <font class="comment">contributors may be used to endorse or promote products derived from this </font>00017 <font class="comment">software without specific prior written permission. </font>00018 <font class="comment"></font>00019 <font class="comment">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" </font>00020 <font class="comment">AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE </font>00021 <font class="comment">IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE </font>00022 <font class="comment">DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE </font>00023 <font class="comment">FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL </font>00024 <font class="comment">DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR </font>00025 <font class="comment">SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER </font>00026 <font class="comment">CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, </font>00027 <font class="comment">OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE </font>00028 <font class="comment">OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</font>00029 <font class="comment">*/</font>00044 <font class="preprocessor">#include "<a class="code" href="WorldModel_8h.html">WorldModel.h</a>"</font>00045 <font class="preprocessor">#include &lt;stdio.h&gt;</font>      <font class="comment">// needed for sprintf</font>00046 00047 <font class="comment">/******************************************************************************/</font>00048 <font class="comment">/********************** CLASS WORLDMODEL **************************************/</font>00049 <font class="comment">/******************************************************************************/</font>00050 00051 <a name="l00063"></a><a class="code" href="classWorldModel.html#a88">00063</a> <font class="keywordtype">void</font> <a class="code" href="classWorldModel.html#a88">WorldModel::processSeeGlobalInfo</a>( <a class="code" href="SoccerTypes_8h.html#a240">ObjectT</a> o, <a class="code" href="classTime.html">Time</a> time,00064       <a class="code" href="classVecPosition.html">VecPosition</a> pos, <a class="code" href="classVecPosition.html">VecPosition</a> vel, <a class="code" href="Geometry_8h.html#a2">AngDeg</a> angBody, <a class="code" href="Geometry_8h.html#a2">AngDeg</a> angNeck)00065 {00066   <a class="code" href="classDynamicObject.html">DynamicObject</a> * dobj;00067   <a class="code" href="classPlayerObject.html">PlayerObject</a> * pobj;00068 00069   <font class="keywordflow">if</font>( o == <a class="code" href="SoccerTypes_8h.html#a240a113">OBJECT_ILLEGAL</a> )00070     <font class="keywordflow">return</font>;00071   <font class="keywordflow">if</font>( <a class="code" href="classSoccerTypes.html#d12">SoccerTypes::isPlayer</a>( o ) )00072   {00073     pobj = (<a class="code" href="classPlayerObject.html">PlayerObject</a>*)<a class="code" href="classWorldModel.html#c0">getObjectPtrFromType</a>( o );00074     pobj-&gt;<a class="code" href="classObject.html#a20">setTimeLastSeen</a>( time );00075     pobj-&gt;<a class="code" href="classObject.html#a12">setGlobalPosition</a>( pos, time );00076     pobj-&gt;<a class="code" href="classDynamicObject.html#a7">setGlobalVelocity</a>( vel, time );00077     pobj-&gt;<a class="code" href="classPlayerObject.html#a9">setGlobalBodyAngle</a>( angBody, time );00078     pobj-&gt;<a class="code" href="classPlayerObject.html#a13">setGlobalNeckAngle</a>( <a class="code" href="classVecPosition.html#d1">VecPosition::normalizeAngle</a>(angBody+angNeck),00079                                                                      time );00080     pobj-&gt;<a class="code" href="classPlayerObject.html#a3">setIsKnownPlayer</a>( <font class="keyword">true</font> );00081   }00082   <font class="keywordflow">else</font> <font class="keywordflow">if</font>( <a class="code" href="classSoccerTypes.html#d8">SoccerTypes::isBall</a>( o ) )00083   {00084     dobj = (<a class="code" href="classDynamicObject.html">DynamicObject</a>*)<a class="code" href="classWorldModel.html#c0">getObjectPtrFromType</a>( o );00085     dobj-&gt;<a class="code" href="classObject.html#a20">setTimeLastSeen</a>( time );00086     dobj-&gt;<a class="code" href="classObject.html#a12">setGlobalPosition</a>( pos, time );00087     dobj-&gt;<a class="code" href="classDynamicObject.html#a7">setGlobalVelocity</a>( vel, time );00088   }00089 }00090 <a name="l00102"></a><a class="code" href="classWorldModel.html#a89">00102</a> <font class="keywordtype">bool</font> <a class="code" href="classWorldModel.html#a89">WorldModel::processNewAgentInfo</a>( <a class="code" href="SoccerTypes_8h.html#a245">ViewQualityT</a> vq, <a class="code" href="SoccerTypes_8h.html#a244">ViewAngleT</a> va,00103      <font class="keywordtype">double</font> dStamina, <font class="keywordtype">double</font> dEffort, <font class="keywordtype">double</font> dSpeed, <a class="code" href="Geometry_8h.html#a2">AngDeg</a> angSpeed,00104      <a class="code" href="Geometry_8h.html#a2">AngDeg</a> angHeadAngle )00105 {00106   <a class="code" href="classStamina.html">Stamina</a> sta = <a class="code" href="classWorldModel.html#o14">agentObject</a>.<a class="code" href="classAgentObject.html#a9">getStamina</a>();00107 00108   sta.<a class="code" href="classStamina.html#a3">setStamina</a>                   ( dStamina                              );00109   sta.<a class="code" href="classStamina.html#a5">setEffort</a>                    ( dEffort                               );00110   <a class="code" href="classWorldModel.html#o14">agentObject</a>.<a class="code" href="classAgentObject.html#a10">setStamina</a>           ( sta                                   );00111   <a class="code" href="classWorldModel.html#o14">agentObject</a>.<a class="code" href="classAgentObject.html#a8">setViewQuality</a>       ( vq                                    );00112   <a class="code" href="classWorldModel.html#o14">agentObject</a>.<a class="code" href="classAgentObject.html#a6">setViewAngle</a>         ( va                                    );00113   <a class="code" href="classWorldModel.html#o14">agentObject</a>.<a class="code" href="classAgentObject.html#a12">setSpeedRelToNeck</a>    ( <a class="code" href="classVecPosition.html">VecPosition</a>( dSpeed, angSpeed, POLAR) );00114   <a class="code" href="classWorldModel.html#o14">agentObject</a>.<a class="code" href="classAgentObject.html#a15">setBodyAngleRelToNeck</a>( angHeadAngle                          );00115 00116   <font class="keywordflow">return</font> <font class="keyword">true</font>;00117 }00118 <a name="l00138"></a><a class="code" href="classWorldModel.html#a90">00138</a> <font class="keywordtype">void</font> <a class="code" href="classWorldModel.html#a90">WorldModel::processNewObjectInfo</a>( <a class="code" href="SoccerTypes_8h.html#a240">ObjectT</a> o, <a class="code" href="classTime.html">Time</a> time,00139       <font class="keywordtype">double</font> dDist, <font class="keywordtype">int</font> iDir, <font class="keywordtype">double</font> dDistChange, <font class="keywordtype">double</font> dDirChange,00140       <a class="code" href="Geometry_8h.html#a2">AngDeg</a> angRelBodyAng,   <a class="code" href="Geometry_8h.html#a2">AngDeg</a> angRelNeckAng, <font class="keywordtype">bool</font> isGoalie )00141 {00142   <font class="keywordflow">if</font>( dDist == <a class="code" href="SoccerTypes_8h.html#a19">UnknownDoubleValue</a> || o == <a class="code" href="SoccerTypes_8h.html#a240a113">OBJECT_ILLEGAL</a> )00143     <font class="keywordflow">return</font>; <font class="comment">// no sense to update when only angle is known.</font>00144 00145   <font class="keywordflow">if</font>( <a class="code" href="classSoccerTypes.html#d3">SoccerTypes::isFlag</a>( o ) )00146   {00147     <a class="code" href="classWorldModel.html#o19">Flags</a>[<a class="code" href="classSoccerTypes.html#d14">SoccerTypes::getIndex</a>(o)].setRelativePosition(dDist,(<font class="keywordtype">double</font>)iDir,time);00148     <a class="code" href="classWorldModel.html#o19">Flags</a>[<a class="code" href="classSoccerTypes.html#d14">SoccerTypes::getIndex</a>(o)].setTimeLastSeen    ( time                );00149     <a class="code" href="classWorldModel.html#o19">Flags</a>[<a class="code" href="classSoccerTypes.html#d14">SoccerTypes::getIndex</a>(o)].setType            ( o                   );00150   }00151   <font class="keywordflow">else</font> <font class="keywordflow">if</font>( <a class="code" href="classSoccerTypes.html#d12">SoccerTypes::isPlayer</a>( o ) || <a class="code" href="classSoccerTypes.html#d8">SoccerTypes::isBall</a>( o ) )00152   {00153     <a class="code" href="classDynamicObject.html">DynamicObject</a> *d = NULL;00154 00155     <font class="comment">// if we do not have all information, update UnknownPlayer array</font>00156     <font class="keywordflow">if</font>( !( <a class="code" href="classSoccerTypes.html#d13">SoccerTypes::isKnownPlayer</a>( o ) || <a class="code" href="classSoccerTypes.html#d8">SoccerTypes::isBall</a>( o ) ) )00157     {00158       <a class="code" href="classWorldModel.html#o17">UnknownPlayers</a>[<a class="code" href="classWorldModel.html#o18">iNrUnknownPlayers</a>].setIsKnownPlayer( <font class="keyword">false</font> );00159       d = &amp;<a class="code" href="classWorldModel.html#o17">UnknownPlayers</a>[<a class="code" href="classWorldModel.html#o18">iNrUnknownPlayers</a>];00160       <a class="code" href="classWorldModel.html#o18">iNrUnknownPlayers</a>++;00161     }00162     <font class="keywordflow">else</font> <font class="comment">// else update the known object (teammate, opponent, ball)</font>00163     {00164       d = (<a class="code" href="classDynamicObject.html">DynamicObject</a>*)<a class="code" href="classWorldModel.html#c0">getObjectPtrFromType</a>( o );00165       <font class="keywordflow">if</font>( <a class="code" href="classSoccerTypes.html#d12">SoccerTypes::isPlayer</a>( o ) )00166         ((<a class="code" href="classPlayerObject.html">PlayerObject</a>*)d)-&gt;setIsKnownPlayer( <font class="keyword">true</font> );00167     }00168 00169     <font class="keywordflow">if</font>( d != NULL )  <font class="comment">// if object was known</font>00170     {00171       <font class="comment">// set all values for this dynamicobject      </font>00172       d-&gt;<a class="code" href="classObject.html#a7">setRelativePosition</a>( dDist, (<font class="keywordtype">double</font>)iDir, time );00173       <font class="keywordflow">if</font>( dDistChange != <a class="code" href="SoccerTypes_8h.html#a19">UnknownDoubleValue</a> )

⌨️ 快捷键说明

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