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

📄 worldmodel.h

📁 自己写的robocup-2d程序
💻 H
📖 第 1 页 / 共 4 页
字号:
  void          predictStaminaAfterDash    ( double         dPower,
                                             Stamina        *sta             );
  SoccerCommand predictCommandTurnTowards  ( ObjectT        obj,
                                             VecPosition    posTo,
                                             int            iCycles,
                                             double         dDistBack,
                                             bool           bMoveBack,
                                             VecPosition    *pos = NULL,
                                             VecPosition    *vel = NULL,
                                             AngDeg         *angBody = NULL  );
  SoccerCommand predictCommandToMoveToPos  ( ObjectT        obj,
                                             VecPosition    posTo,
                                             int            iCycles,
                                             double         dDistBack = 2.5,
                                             bool           bMoveBack = false,
                                             VecPosition    *pos = NULL,
                                             VecPosition    *vel = NULL,
                                             AngDeg         *angBody = NULL  );
  SoccerCommand predictCommandToInterceptBall( ObjectT      obj,
                                             SoccerCommand  soc,
                                             int            *iCycles = NULL ,
                                             VecPosition    *posIntercept=NULL,
                                             VecPosition    *pos = NULL,
                                             VecPosition    *vel = NULL,
                                             AngDeg         *angBody = NULL  );
  bool          isCollisionAfterCommand    ( SoccerCommand  soc              );


  ////////////////////////// HIGH-LEVEL METHODS (WorldModelHighLevel.C) ///////

  // methods that return the number of players in a certain area of the field
  int           getNrInSetInRectangle      ( ObjectSetT     objectSet,
                                             Rect           *rect = NULL     );
  int           getNrInSetInCircle         ( ObjectSetT     objectSet,
                                             Circle         c                );
  int           getNrInSetInCone           ( ObjectSetT     objectSet,
                                             double         dWidth,
                                             VecPosition    start,
                                             VecPosition    end              );
  bool          isEmptySpace               ( ObjectT        obj,
                                             AngDeg         ang,
                                             double         dDist = 4.0      );
  bool          coordinateWith             ( ObjectT        obj              );
                                             
  // method that return the closest or fastest player to a certain pos orobject
  ObjectT       getClosestInSetTo          ( ObjectSetT     objectSet,
                                             ObjectT        o ,
                                             double         *dDist = NULL,
                                             double         dConfThr = -1.0  );
  ObjectT       getClosestInSetTo          ( ObjectSetT     objectSet,
                                             VecPosition    pos,
                                             double         *dDist = NULL,
                                             double         dConfThr = -1.0  );
  ObjectT       getClosestInSetTo          ( ObjectSetT     objectSet,
                                             Line           l,
                                             VecPosition    pos1,
                                             VecPosition    pos2,
                                             double         *dDistToLine= NULL,
                                             double         *dDistPos1To=NULL);
  ObjectT       getClosestRelativeInSet    ( ObjectSetT     set,
                                             double         *dDist = NULL    );
  ObjectT       getSecondClosestInSetTo    ( ObjectSetT     objectSet,
                                             ObjectT        o,
                                             double         *dDist = NULL,
                                             double         dConfThr = -1.0  );
  ObjectT       getSecondClosestRelativeInSet( ObjectSetT   set,
                                             double         *dDist = NULL    );
  void          createInterceptFeatures    (                                 );
  ObjectT       getFastestInSetTo          ( ObjectSetT     objectSet,
                                             ObjectT        o,
                                             int            *iCycles = NULL  );
  ObjectT       getFastestInSetTo          ( ObjectSetT     objectSet,
                                             VecPosition    pos,
                                             VecPosition    vel,
                                             double         dDecay,
                                             int            *iCycles = NULL  );
  ObjectT       getFurthestInSetTo         ( ObjectSetT     objectSet,
                                             ObjectT        o ,
                                             double         *dDist = NULL,
                                             double         dConfThr = -1.0  );
  ObjectT       getFurthestRelativeInSet   ( ObjectSetT     set,
                                             double         *dDist = NULL    );
  VecPosition   getPosClosestOpponentTo    ( double         *dDist = NULL,
                                             ObjectT        o =OBJECT_ILLEGAL);
  double        getMaxTraveledDistance     ( ObjectT        o                );
  // various methods dealing with sets of objects
  ObjectT       getFirstEmptySpotInSet     ( ObjectSetT     objectSet,
                                             int            iUnknownPlayer=-1);

  // boolean methods that indicate whether an object fulfills a  constraint
  bool          isVisible                  ( ObjectT        o                );
  bool          isBallKickable             (                                 );
  bool          isBallCatchable            (                                 );
  bool          isBallHeadingToGoal        (                                 );
  bool          isBallInOurPossesion       (                                 );
  bool          isBallInOwnPenaltyArea     (                                 );
  bool          isInOwnPenaltyArea         ( VecPosition    pos              );
  bool          isInTheirPenaltyArea       ( VecPosition    pos              );
  bool          isConfidenceGood           ( ObjectT                         );
  bool          isConfidenceVeryGood       ( ObjectT                         );
  bool          isOnside                   ( ObjectT                         );
  bool          isOpponentAtAngle          ( AngDeg         ang,
                                             double         dDist            );

  // various methods that supply specific information about the field
  Time          getTimeFromConfidence      ( double         dConf            );
  double        getOffsideX                ( bool           bIncludeComm=true);
  VecPosition   getOuterPositionInField    ( VecPosition    pos,
                                             AngDeg         ang,
                                             double         dDist = 3.0,
                                             bool           bWithPenalty=true);
  AngDeg        getDirectionOfWidestAngle  ( VecPosition    posOrg,
                                             AngDeg         angMin,
                                             AngDeg         angMax,
                                             AngDeg         *ang,
                                             double         dDist            );
  bool          isInField                  ( VecPosition    pos,
                                             double         dMargin = 1      );
  bool          isBeforeGoal               ( VecPosition    pos              );
                                             
  // strategic positioning
  VecPosition   getStrategicPosition      ( ObjectT        obj,
					    FormationT     ft = FT_ILLEGAL   );
  VecPosition   getStrategicPosition      ( int            iPlayer = -1,
					    FormationT     ft = FT_ILLEGAL   );
  VecPosition   getMarkingPosition        ( VecPosition    pos,
					    double         dDist,
					    MarkT          mark              );
  int           getClosestPlayerInFormationTo( VecPosition pos,
                                            bool           bWithGoalie = 1,
                                            ObjectT        obj=OBJECT_ILLEGAL,
					    PlayerSetT     ps = PS_ALL,
					    FormationT     ft = FT_ILLEGAL   );


  // methods  for computing the actual argument for a soccer command.
  double        getActualKickPowerRate     (                                 );
  double        getKickPowerForSpeed       ( double         dDesiredSpeed    );
  double        getKickSpeedToTravel       ( double         dDistance,
                                             double         dEndSpeed        );
  double        getFirstSpeedFromEndSpeed  ( double         dEndSpeed,
                                             double         dCycles,
                                             double         dDecay = -1.0    );
  double        getFirstSpeedFromDist      ( double         dDist,
                                             double         dCycles,
                                             double         dDecay = -1.0    );
  double        getEndSpeedFromFirstSpeed  ( double         dFirstSpeed,
                                             double         dCycles          );
  AngDeg        getAngleForTurn            ( AngDeg         angDesiredAngle,
                                             double         dSpeed,
                                             ObjectT        o=OBJECT_ILLEGAL);
  AngDeg        getActualTurnAngle         ( AngDeg         angActualAngle,
                                             double         dSpeed,
                                             ObjectT        o=OBJECT_ILLEGAL);
  double        getPowerForDash            ( VecPosition    posRelTo,
                                             AngDeg         angBody,
                                             VecPosition    vel,
                                             double         dEffort,
                                             int            iCycles = 1      );


  ////////////////////////// VARIOUS (WorldModel.C) ///////////////////////////

  // constructor
  WorldModel                               ( ServerSettings *ss,
                                             PlayerSettings *ps,
                                             Formations     *fs              );
  ~WorldModel                              (                                 );

  // print information about WorldModel
  void          show                       ( ostream        &os = cout       );
  void          show                       ( ObjectSetT     set,
                                             ostream        &os = cout       );
  void          showQueuedCommands         ( ostream        &os = cout       );
  void          show                       ( ObjectT        o,
                                            ostream        &os = cout        );

  // methods that deal with timing information
  bool          waitForNewInformation      (                                 );

  // methods that deal with debugging
  void          logObjectInformation       ( int            iLogLevel,
                                             ObjectT        o                );
  void          logDrawInfo                ( int            iLogLevel        );
  void          logCoordInfo               ( int            iLogLevel        );
  bool          logCircle                  ( int            iLogLevel,
                                             VecPosition    pos,
                                             double         dRadius,
                                             bool           bAll = false     );
  bool          logLine                    ( int            iLogLevel,
                                             VecPosition    pos1,
                                             VecPosition    pos2,
                                             bool           bAll = false     );
  bool          logDrawBallInfo            ( int            iLogLevel        );
  void          drawCoordinationGraph      (                                 );
  
  // specific static variables
  char m_colorPlayers[11][8];       /*!< color information with which each
                                         player should draw its relevant info*/
  int m_iMultX;                     /*!< This variable denotes with which value
                                         the x coordinates of the draw
                                         information should be multiplied in
                                         order to convert the coordinates to 
                                         the coordinate system of the monitor*/
  int m_iMultY;                     /*!< This variable denotes with which value
                                         the y coordinates of the draw
                                         information should be multiplied in
                                         order to convert the coordinates to 
                                         the coordinate system of the monitor*/
                                         
  bool           isFeatureRelevant        ( FeatureT        type             );
  Feature        getFeature               ( FeatureT        type             );
  bool           setFeature               ( FeatureT        type,
                                            Feature         feature          );

public:
	void updateGlobalInformation();

	//预测当前情况下,假设球速度为velBall
	//o去截球的截球周期
	int predictInterCyc(ObjectT o, const VecPosition& posBall, const VecPosition& velBall);
	//预测对方最快球员的截球周期
	int predictFastestOppInterCyc(const VecPosition& posBall, const VecPosition& velBall);
};

#endif

⌨️ 快捷键说明

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