freemarkpos.cpp.svn-base

来自「一个巴西大学编写的2D仿真组足球机器人程序」· SVN-BASE 代码 · 共 39 行

SVN-BASE
39
字号
#include "FreeMarkPos.h"SoccerCommand FreeMarkPos::primaryAction(){   oponnent = WM->getClosestInSetTo( OBJECT_SET_OPPONENTS,WM->getAgentObjectType() );   distRelOpon = WM->getRelativeDistance( oponnent );   distRelBall = WM->getRelativeDistance( OBJECT_BALL );   if( distRelOpon < distRelBall )   {      posRelOpon = WM->getRelativePosition( oponnent );      posRelBall = WM->getRelativePosition( OBJECT_BALL );      aux = posRelBall.operator *(posRelOpon);      angulo = (acos(aux.modulo(aux)/(distRelBall*distRelOpon)))*180/3.14159;      if( angulo < 30 )      {         if( posRelOpon.modulo(posRelOpon) < 10 )         {            if(WM->getAgentGlobalPosition().getX() >  WM->getGlobalPosition(OBJECT_BALL).getX() + 10)            {               aux= WM->getAgentGlobalPosition();               aux=(posRelBall.operator *( 0.5 ).operator +((posRelBall.operator *( 0.5 )).normal(posRelBall))).operator - (aux);               return moveToPos( aux , PS->getPlayerWhenToTurnAngle() );            }         }      }//       else//       {//          if( WM->getAgentStamina().getStamina() > SS->getRecoverDecThr()*SS->getStaminaMax()+800 )//          {//             moveToPos( (WM->getBallPos() - WM->getAgentGlobalPosition())/20 + WM->getStrategicPosition(), PS->getPlayerWhenToTurnAngle() );//          }//       }   }}SoccerCommand FreeMarkPos::cuncurrentAction(){   return turnNeckToPoint( OBJECT_BALL , primarySoc );}

⌨️ 快捷键说明

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