src/SoccerTypes.h

Go to the documentation of this file.
00001 /*
00002 Copyright (c) 2000-2003, Jelle Kok, University of Amsterdam
00003 All rights reserved.
00004 
00005 Redistribution and use in source and binary forms, with or without
00006 modification, are permitted provided that the following conditions are met:
00007 
00008 1. Redistributions of source code must retain the above copyright notice, this
00009 list of conditions and the following disclaimer.
00010 
00011 2. Redistributions in binary form must reproduce the above copyright notice,
00012 this list of conditions and the following disclaimer in the documentation
00013 and/or other materials provided with the distribution.
00014 
00015 3. Neither the name of the University of Amsterdam nor the names of its
00016 contributors may be used to endorse or promote products derived from this
00017 software without specific prior written permission.
00018 
00019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00020 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00021 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00022 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
00023 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00024 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00025 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00026 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00027 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00028 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00029 */
00030 
00054 #ifndef _SOCCERTYPES_
00055 #define _SOCCERTYPES_
00056 
00057 #include <iostream>       // needed for output stream.
00058 #include "Geometry.h"     // needed for AngDeg
00059 #include "ServerSettings.h"
00060 
00061 
00062 /*****************************************************************************/
00063 /********************* DEFINES ***********************************************/
00064 /*****************************************************************************/
00065 
00066 #define MAX_TEAMMATES          11       
00067 #define MAX_OPPONENTS          11       
00068 #define MAX_PLAYERS MAX_TEAMMATES + MAX_OPPONENTS 
00069 #define MAX_HETERO_PLAYERS      7       
00070 #define MAX_MSG              4096       
00071 #define MAX_SAY_MSG            10       
00072 #define MAX_TEAM_NAME_LENGTH   64       
00073 #define MAX_FLAGS              55       
00074 #define MAX_LINES               4       
00075 #define DEFAULT_TEAM_NAME     "Team_L"  
00076 #define DEFAULT_OPPONENT_NAME "Team_R"  
00077 #define PITCH_LENGTH        105.0       
00078 #define PITCH_WIDTH          68.0       
00079 #define PITCH_MARGIN          5.0       
00080 #define PENALTY_AREA_LENGTH  16.5       
00081 #define PENALTY_AREA_WIDTH   40.32      
00082 #define PENALTY_X (PITCH_LENGTH/2.0-PENALTY_AREA_LENGTH) 
00084 #define KICK_RAYS_NR 40                 
00086 #define RAY_LENGTH          60.0        
00089 /*****************************************************************************/
00090 /********************* CONSTANTS *********************************************/
00091 /*****************************************************************************/
00092 const double  UnknownDoubleValue  = -1000.0; 
00093 const AngDeg  UnknownAngleValue   = -1000.0; 
00094 const int     UnknownIntValue     = -1000;   
00095 const int     UnknownTime         = -20;     
00096 const long    UnknownMessageNr    = -30;     
00098 /*****************************************************************************/
00099 /********************** ENUMERATIONS *****************************************/
00100 /*****************************************************************************/
00101 
00106 enum ObjectT { // don't change order
00107   OBJECT_BALL,             
00108   OBJECT_GOAL_L,               // 2 goals
00109   OBJECT_GOAL_R,           
00110   OBJECT_GOAL_UNKNOWN,     
00111   OBJECT_LINE_L,               // 4 lines
00112   OBJECT_LINE_R,           
00113   OBJECT_LINE_B,           
00114   OBJECT_LINE_T,           
00115   OBJECT_FLAG_L_T,            // 53 flags
00116   OBJECT_FLAG_T_L_50,      
00117   OBJECT_FLAG_T_L_40,      
00118   OBJECT_FLAG_T_L_30,      
00119   OBJECT_FLAG_T_L_20,      
00120   OBJECT_FLAG_T_L_10,      
00121   OBJECT_FLAG_T_0,         
00122   OBJECT_FLAG_C_T,         
00123   OBJECT_FLAG_T_R_10,      
00124   OBJECT_FLAG_T_R_20,      
00125   OBJECT_FLAG_T_R_30,      
00126   OBJECT_FLAG_T_R_40,      
00127   OBJECT_FLAG_T_R_50,      
00128   OBJECT_FLAG_R_T,         
00129   OBJECT_FLAG_R_T_30,      
00130   OBJECT_FLAG_R_T_20,      
00131   OBJECT_FLAG_R_T_10,      
00132   OBJECT_FLAG_G_R_T,       
00133   OBJECT_FLAG_R_0,         
00134   OBJECT_FLAG_G_R_B,       
00135   OBJECT_FLAG_R_B_10,      
00136   OBJECT_FLAG_R_B_20,      
00137   OBJECT_FLAG_R_B_30,      
00138   OBJECT_FLAG_R_B,         
00139   OBJECT_FLAG_B_R_50,      
00140   OBJECT_FLAG_B_R_40,      
00141   OBJECT_FLAG_B_R_30,      
00142   OBJECT_FLAG_B_R_20,      
00143   OBJECT_FLAG_B_R_10,      
00144   OBJECT_FLAG_C_B,         
00145   OBJECT_FLAG_B_0,         
00146   OBJECT_FLAG_B_L_10,      
00147   OBJECT_FLAG_B_L_20,      
00148   OBJECT_FLAG_B_L_30,      
00149   OBJECT_FLAG_B_L_40,      
00150   OBJECT_FLAG_B_L_50,      
00151   OBJECT_FLAG_L_B,         
00152   OBJECT_FLAG_L_B_30,      
00153   OBJECT_FLAG_L_B_20,      
00154   OBJECT_FLAG_L_B_10,      
00155   OBJECT_FLAG_G_L_B,       
00156   OBJECT_FLAG_L_0,         
00157   OBJECT_FLAG_G_L_T,       
00158   OBJECT_FLAG_L_T_10,      
00159   OBJECT_FLAG_L_T_20,      
00160   OBJECT_FLAG_L_T_30,      
00161   OBJECT_FLAG_P_L_T,       
00162   OBJECT_FLAG_P_L_C,       
00163   OBJECT_FLAG_P_L_B,       
00164   OBJECT_FLAG_P_R_T,       
00165   OBJECT_FLAG_P_R_C,       
00166   OBJECT_FLAG_P_R_B,       
00167   OBJECT_FLAG_C,           
00168   OBJECT_TEAMMATE_1,           // teammates 61
00169   OBJECT_TEAMMATE_2,       
00170   OBJECT_TEAMMATE_3,       
00171   OBJECT_TEAMMATE_4,       
00172   OBJECT_TEAMMATE_5,       
00173   OBJECT_TEAMMATE_6,       
00174   OBJECT_TEAMMATE_7,       
00175   OBJECT_TEAMMATE_8,       
00176   OBJECT_TEAMMATE_9,       
00177   OBJECT_TEAMMATE_10,      
00178   OBJECT_TEAMMATE_11,      
00179   OBJECT_TEAMMATE_UNKNOWN, 
00180   OBJECT_OPPONENT_1,           // opponents 73
00181   OBJECT_OPPONENT_2,       
00182   OBJECT_OPPONENT_3,       
00183   OBJECT_OPPONENT_4,       
00184   OBJECT_OPPONENT_5,       
00185   OBJECT_OPPONENT_6,       
00186   OBJECT_OPPONENT_7,       
00187   OBJECT_OPPONENT_8,       
00188   OBJECT_OPPONENT_9,       
00189   OBJECT_OPPONENT_10,      
00190   OBJECT_OPPONENT_11,      
00191   OBJECT_OPPONENT_UNKNOWN,     // 84
00192   OBJECT_PLAYER_UNKNOWN,   
00193   OBJECT_UNKNOWN,          
00194   OBJECT_TEAMMATE_GOALIE,  
00195   OBJECT_OPPONENT_GOALIE,  
00196   OBJECT_ILLEGAL,          
00197   OBJECT_MAX_OBJECTS,        // 90
00198   OBJECT_SELECT_PLAYER     
00199 } ;
00200 
00203 enum ObjectSetT
00204 {
00205   OBJECT_SET_TEAMMATES,        
00206   OBJECT_SET_OPPONENTS,        
00207   OBJECT_SET_PLAYERS,          
00208   OBJECT_SET_TEAMMATES_NO_GOALIE,
00209   OBJECT_SET_FLAGS,            
00210   OBJECT_SET_LINES,            
00211   OBJECT_SET_ILLEGAL           
00212 } ;
00213 
00217 enum PlayModeT {
00218   PM_BEFORE_KICK_OFF,        
00219   PM_KICK_OFF_LEFT,          
00220   PM_KICK_OFF_RIGHT,         
00221   PM_KICK_IN_LEFT,           
00222   PM_KICK_IN_RIGHT,          
00223   PM_CORNER_KICK_LEFT,       
00224   PM_CORNER_KICK_RIGHT,      
00225   PM_GOAL_KICK_LEFT,         
00226   PM_GOAL_KICK_RIGHT,        
00227   PM_GOAL_LEFT,              
00228   PM_GOAL_RIGHT,             
00229   PM_FREE_KICK_FAULT_LEFT,   
00230   PM_FREE_KICK_FAULT_RIGHT,      
00231   PM_FREE_KICK_LEFT,         
00232   PM_FREE_KICK_RIGHT,        
00233   PM_INDIRECT_FREE_KICK_RIGHT,
00234   PM_INDIRECT_FREE_KICK_LEFT,
00235   PM_BACK_PASS_LEFT,         
00236   PM_BACK_PASS_RIGHT,        
00237   PM_OFFSIDE_LEFT,           
00238   PM_OFFSIDE_RIGHT,          
00239   PM_PLAY_ON,                
00240   PM_TIME_OVER,              
00241   PM_PENALTY_SETUP_LEFT,     
00242   PM_PENALTY_SETUP_RIGHT,    
00243   PM_PENALTY_READY_LEFT,     
00244   PM_PENALTY_READY_RIGHT,    
00245   PM_PENALTY_TAKEN_LEFT,     
00246   PM_PENALTY_TAKEN_RIGHT,    
00247   PM_FROZEN,                 
00248   PM_QUIT,                   
00249   PM_ILLEGAL                 
00250 } ;
00251 
00255 enum RefereeMessageT {
00256   REFC_ILLEGAL,                
00257   REFC_BEFORE_KICK_OFF,        
00258   REFC_KICK_OFF_LEFT,          
00259   REFC_KICK_OFF_RIGHT,         
00260   REFC_KICK_IN_LEFT,           
00261   REFC_KICK_IN_RIGHT,          
00262   REFC_CORNER_KICK_LEFT,       
00263   REFC_CORNER_KICK_RIGHT,      
00264   REFC_GOAL_KICK_LEFT,         
00265   REFC_GOAL_KICK_RIGHT,        
00266   REFC_FREE_KICK_LEFT,         
00267   REFC_FREE_KICK_RIGHT,        
00268   REFC_INDIRECT_FREE_KICK_RIGHT,
00269   REFC_INDIRECT_FREE_KICK_LEFT,
00270   REFC_FREE_KICK_FAULT_LEFT,   
00271   REFC_FREE_KICK_FAULT_RIGHT,  
00272   REFC_BACK_PASS_LEFT,         
00273   REFC_BACK_PASS_RIGHT,        
00274   REFC_PLAY_ON,                
00275   REFC_TIME_OVER,              
00276   REFC_FROZEN,                 
00277   REFC_QUIT,                   
00278   REFC_OFFSIDE_LEFT,           
00279   REFC_OFFSIDE_RIGHT,          
00280   REFC_HALF_TIME,              
00281   REFC_TIME_UP,                
00282   REFC_TIME_UP_WITHOUT_A_TEAM, 
00283   REFC_TIME_EXTENDED,          
00284   REFC_FOUL_LEFT,              
00285   REFC_FOUL_RIGHT,             
00286   REFC_GOAL_LEFT,              
00287   REFC_GOAL_RIGHT,             
00288   REFC_DROP_BALL,              
00289   REFC_GOALIE_CATCH_BALL_LEFT, 
00290   REFC_GOALIE_CATCH_BALL_RIGHT,
00291   REFC_PENALTY_SETUP_LEFT,     
00292   REFC_PENALTY_SETUP_RIGHT,    
00293   REFC_PENALTY_READY_LEFT,     
00294   REFC_PENALTY_READY_RIGHT,    
00295   REFC_PENALTY_TAKEN_LEFT,     
00296   REFC_PENALTY_TAKEN_RIGHT,    
00297   REFC_PENALTY_MISS_LEFT,      
00298   REFC_PENALTY_MISS_RIGHT,     
00299   REFC_PENALTY_SCORE_LEFT,     
00300   REFC_PENALTY_SCORE_RIGHT,    
00301   REFC_PENALTY_FOUL_LEFT,      
00302   REFC_PENALTY_FOUL_RIGHT,     
00303   REFC_PENALTY_ONFIELD_LEFT,   
00304   REFC_PENALTY_ONFIELD_RIGHT,  
00305   REFC_PENALTY_WINNER_LEFT,    
00306   REFC_PENALTY_WINNER_RIGHT,   
00307   REFC_PENALTY_DRAW            
00308 } ;
00309 
00312 enum ViewAngleT  {
00313   VA_NARROW,  
00314   VA_NORMAL,  
00315   VA_WIDE,    
00316   VA_ILLEGAL  
00317 };
00318 
00321 enum ViewQualityT {
00322   VQ_HIGH,    
00323   VQ_LOW,     
00324   VQ_ILLEGAL  
00325 };
00326 
00328 enum SideT {
00329   SIDE_LEFT,     
00330   SIDE_RIGHT,    
00331   SIDE_ILLEGAL   
00332 } ;
00333 
00336 enum CommandT {
00337   CMD_ILLEGAL,      
00338   CMD_DASH,         
00339   CMD_TURN,         
00340   CMD_TURNNECK,     
00341   CMD_CHANGEVIEW,   
00342   CMD_CATCH,        
00343   CMD_KICK,         
00344   CMD_MOVE,         
00345   CMD_SENSEBODY,    
00346   CMD_SAY,          
00347   CMD_CHANGEPLAYER, 
00348   CMD_ATTENTIONTO,  
00349   CMD_TACKLE,       
00350   CMD_POINTTO,      
00351   CMD_MAX_COMMANDS  
00352 } ;
00353 
00359 enum PlayerT {
00360   PT_ILLEGAL,             
00361   PT_GOALKEEPER,          
00362   PT_DEFENDER_CENTRAL,    
00363   PT_DEFENDER_SWEEPER,    
00364   PT_DEFENDER_WING,       
00365   PT_MIDFIELDER_CENTER,   
00366   PT_MIDFIELDER_WING,     
00367   PT_ATTACKER_WING,       
00368   PT_ATTACKER,            
00369   MAX_PLAYER_TYPES
00370 } ;
00371 
00374 enum PlayerSetT {
00375   PS_DEFENDERS,           
00376   PS_MIDFIELDERS,         
00377   PS_ATTACKERS,           
00378   PS_ALL                  
00379 } ;
00380 
00383 enum FormationT {
00384   FT_ILLEGAL,             
00385   FT_INITIAL,             
00386   FT_433_OFFENSIVE,       
00387   FT_334_OFFENSIVE,       
00388   FT_DEFENSIVE,           
00389   FT_OPEN_DEFENSIVE,      
00390   FT_343_ATTACKING,       
00391   MAX_FORMATION_TYPES
00392 } ;
00393 
00396 enum BallStatusT {
00397   BS_ILLEGAL,           
00398   BS_IN_FIELD,          
00399   BS_GOAL_LEFT,         
00400   BS_GOAL_RIGHT,        
00401   BS_OUT_OF_FIELD       
00402 } ;
00403 
00405 enum ActionT {
00406   ACT_ILLEGAL,                    
00407   ACT_SEARCH_BALL,                
00408   ACT_KICK_BALL,                  
00409   ACT_CATCH_BALL,                 
00410   ACT_INTERCEPT,                  
00411   ACT_MARK,                       
00412   ACT_TELEPORT_TO_STRATEGIC_POSITION, 
00413   ACT_WATCH_BALL,                 
00414   ACT_ANTICIPATE_BALL,            
00415   ACT_GOTO_STRATEGIC_POSITION,    
00416   ACT_TURN_BODY_TO_CENTER,        
00417   ACT_MOVE_TO_DEAD_BALL_POSITION, 
00418   ACT_INTERCEPT_SCORING_ATTEMPT,  
00419   ACT_DEFEND_GOALLINE,            
00420   ACT_TELEPORT_AFTER_CATCH,       
00421   ACT_TACKLE,                     
00422   ACT_HOLD_BALL                   
00423 } ;
00424 
00425 
00427 enum MarkT {
00428   MARK_ILLEGAL,    
00429   MARK_GOAL,       
00430   MARK_BISECTOR,   
00431   MARK_BALL        
00432 } ;
00433 
00435 enum DribbleT {
00436   DRIBBLE_ILLEGAL, 
00437   DRIBBLE_WITHBALL,
00438   DRIBBLE_SLOW,    
00439   DRIBBLE_FAST     
00440 } ;
00441 
00443 enum PassT {
00444   PASS_ILLEGAL,    
00445   PASS_FAST,       
00446   PASS_NORMAL      
00447 } ;
00448 
00450 enum ClearBallT {
00451   CLEAR_BALL_ILLEGAL,    
00452   CLEAR_BALL_OFFENSIVE,  
00453   CLEAR_BALL_DEFENSIVE,  
00454   CLEAR_BALL_OFFENSIVE_SIDE, 
00455   CLEAR_BALL_GOAL        
00456 } ;
00457 
00460 enum TiredNessT {
00461   TIREDNESS_ILLEGAL,     
00462   TIREDNESS_GOOD,        
00463   TIREDNESS_AVERAGE,     
00464   TIREDNESS_BAD,         
00465   TIREDNESS_VERY_BAD,    
00466   TIREDNESS_TERRIBLE     
00467 } ;
00468 
00475 enum FeatureT {
00476   FEATURE_ILLEGAL,                   
00477   FEATURE_FASTEST_OPPONENT_TO_BALL,  
00478   FEATURE_FASTEST_TEAMMATE_TO_BALL,  
00479   FEATURE_FASTEST_PLAYER_TO_BALL,    
00480   FEATURE_FASTEST_TEAMMATE_TO_BALL_NO_GOALIE, 
00481   FEATURE_INTERCEPTION_POINT_BALL,   
00482   FEATURE_INTERCEPT_CLOSE,           
00483   FEATURE_INTERCEPT_CYCLES_ME,       
00484   FEATURE_BEST_SCORING_POINT,        
00485   MAX_FEATURES
00486 } ;
00487   
00489 enum DirectionT {
00490   DIR_ILLEGAL,                 
00491   DIR_NORTH,                   
00492   DIR_NORTHWEST,               
00493   DIR_NORTHEAST,               
00494   DIR_CENTER,                  
00495   DIR_EAST,                    
00496   DIR_WEST,                    
00497   DIR_SOUTHWEST,               
00498   DIR_SOUTHEAST,               
00499   DIR_SOUTH,                   
00500   DIR_MAX                      
00501 } ;
00502 
00504 enum SucceedT  {
00505   SUCCEED_ILLEGAL,             
00506   SUCCEED_ALWAYS,              
00507   SUCCEED_DOUBTFUL,            
00508   SUCCEED_NEVER                
00509 } ;
00510 
00511 
00512 /*****************************************************************************/
00513 /********************** CLASS TIME   *****************************************/
00514 /*****************************************************************************/
00515 
00528 class Time
00529 {
00530   int m_iTime;            
00531   int m_iStopped;         
00533 public:
00534          Time             ( int     iTime = -1, int iStopped = 0 );
00535   bool   updateTime       ( int     iTime                        );
00536   bool   setTimeStopped   ( int     iTime                        );
00537   int    getTime          (                                      );
00538   int    getTimeStopped   (                                      );
00539   int    getTimeDifference( Time    t                            );
00540   bool   isStopped        (                                      );
00541   Time   getTimeAddedWith ( int     iCycles                      );
00542   bool   addToTime        ( int     iCycles                      );
00543   void   show             ( ostream &os = cout                   );
00544 
00545   // overloaded arithmetic operators
00546   Time   operator +       ( const int  &i );
00547   Time   operator +       ( Time t );
00548   Time   operator -       ( const int  &i );
00549   int    operator -       ( Time t );
00550   void   operator =       ( const int  &i );
00551   void   operator +=      ( Time t );
00552   void   operator +=      ( const int  &i );
00553   void   operator -=      ( Time t );
00554   void   operator -=      ( const int  &i );
00555   bool   operator !=      ( Time t );
00556   bool   operator !=      ( const int  &i );
00557   bool   operator ==      ( Time t );
00558   bool   operator ==      ( const int  &i );
00559   bool   operator <       ( Time t );
00560   bool   operator <       ( const int  &i );
00561   bool   operator <=      ( Time t );
00562   bool   operator <=      ( const int  &i );
00563   bool   operator >       ( Time t );
00564   bool   operator >       ( const int  &i );
00565   bool   operator >=      ( Time t );
00566   bool   operator >=      ( const int  &i );
00567 
00568 
00569   // methods for producing output
00570   friend ostream&   operator << ( ostream &os, Time t );
00571 } ;
00572 
00573 
00574 /*****************************************************************************/
00575 /********************* CLASS SOCCERCOMMAND ***********************************/
00576 /*****************************************************************************/
00577 
00583 class SoccerCommand
00584 {
00585   ServerSettings *SS; 
00587   // private methods to generate text string to sent to server
00588   bool  makeCatchCommand       ( char *str );
00589   bool  makeChangeViewCommand  ( char *str );
00590   bool  makeDashCommand        ( char *str );
00591   bool  makeKickCommand        ( char *str );
00592   bool  makeMoveCommand        ( char *str );
00593   bool  makeSayCommand         ( char *str );
00594   bool  makeSenseBodyCommand   ( char *str );
00595   bool  makeTurnCommand        ( char *str );
00596   bool  makeTurnNeckCommand    ( char *str );
00597   bool  makeChangePlayerCommand( char *str );
00598   bool  makeAttentionToCommand ( char *str );
00599   bool  makeTackleCommand      ( char *str );
00600   bool  makePointToCommand     ( char *str );
00601 
00602 public:
00603 
00604   // different variables that are used by the different possible commands
00605   // only the variables that are related to the current commandType have
00606   // legal values
00607   Time         time;        
00608   CommandT     commandType; 
00609   double       dAngle;      
00610   double       dPower;      
00611   ViewQualityT vq;          
00612   ViewAngleT   va;          
00613   double       dX;          
00614   double       dY;          
00615   char         str[MAX_SAY_MSG];
00616   int          iTimes;      
00618   SoccerCommand( CommandT com = CMD_ILLEGAL, double d1=UnknownDoubleValue,
00619                                              double d2=UnknownDoubleValue,
00620                                              double d3=UnknownDoubleValue );
00621   SoccerCommand( CommandT com,               char   *msg                  );
00622 
00623   // command to set the different values of the SoccerCommand
00624   void makeCommand( CommandT com, double     d1 = UnknownDoubleValue,
00625                                   double     d2 = UnknownDoubleValue,
00626                                   double     d3 = UnknownDoubleValue      );
00627   void makeCommand( CommandT com, ViewAngleT v,    ViewQualityT q         );
00628   void makeCommand( CommandT com, char       *msg                         );
00629 
00630   bool isIllegal  (                                                       );
00631 
00632   void show       ( ostream& os                                           );
00633 
00634   // used to return the string representation of this SoccerCommand
00635   bool getCommandString( char *str,         ServerSettings *ss           );
00636 } ;
00637 
00638 /*****************************************************************************/
00639 /********************* CLASS FEATURE *****************************************/
00640 /*****************************************************************************/
00641 
00646 class Feature
00647 {
00648   Time          m_timeSee;  
00649   Time          m_timeSense;
00650   Time          m_timeHear; 
00651   ObjectT       m_object;   
00652   double        m_dInfo;    
00653   VecPosition   m_vec;      
00654   SoccerCommand m_soc;      
00656 public:
00657   // standard get and set methods
00658   Feature(                                                                   );
00659   Feature(                    Time          timeSee,
00660                               Time          timeSense, 
00661                               Time          timeHear,
00662                               ObjectT       object,
00663                               double        dInfo = UnknownDoubleValue,
00664                               SoccerCommand soc   = SoccerCommand(CMD_ILLEGAL),
00665                               VecPosition   pos = VecPosition(0,0)           );
00666   bool          setFeature  ( Time          timeSee,
00667                               Time          timeSense,
00668                               Time          timeHear,
00669                               ObjectT       object,
00670                               double        dInfo = UnknownDoubleValue,
00671                               SoccerCommand soc   = SoccerCommand(CMD_ILLEGAL),
00672                               VecPosition   pos = VecPosition(0,0)           );
00673   bool          setTimeSee  ( Time          time                             );
00674   Time          getTimeSee  (                                                );
00675   bool          setTimeSense( Time          time                             );
00676   Time          getTimeSense(                                                );
00677   bool          setTimeHear ( Time          time                             );
00678   Time          getTimeHear (                                                );
00679   bool          setObject   ( ObjectT       obj                              );
00680   ObjectT       getObject   (                                                );
00681   bool          setInfo     ( double        d                                );
00682   double        getInfo     (                                                );
00683   bool          setVec      ( VecPosition   pos                              );
00684   VecPosition   getVec      (                                                );
00685   bool          setCommand  ( SoccerCommand soc                              );
00686   SoccerCommand getCommand  (                                                );
00687 
00688 } ;
00689 
00690 /*****************************************************************************/
00691 /********************** CLASS SOCCERTYPES ************************************/
00692 /*****************************************************************************/
00693 
00700 class SoccerTypes
00701 {
00702  public:
00703   // methods that deal with the differen objects
00704   static char*           getObjectStr              ( char         *strBuf,
00705                                                      ObjectT      o,
00706                                                      const char   *strTe=NULL);
00707   static ObjectT         getObjectFromStr          ( char         **str,
00708                                                      bool         *isGoalie,
00709                                                      const char   *strTeam   );
00710   static bool            isInSet                   ( ObjectT      o,
00711                                                      ObjectSetT   o_s,
00712                                                      ObjectT      objectGoalie=
00713                                                        OBJECT_TEAMMATE_1     );
00714   static bool            isPlayerTypeInSet         ( PlayerT      p,
00715                                                      PlayerSetT   p_s        );
00716   static bool            isFlag                    ( ObjectT      o          );
00717   static bool            isLine                    ( ObjectT      o          );
00718   static bool            isGoal                    ( ObjectT      o          );
00719   static ObjectT         getOwnGoal                ( SideT        s          );
00720   static ObjectT         getGoalOpponent           ( SideT        s          );
00721   static bool            isBall                    ( ObjectT      o          );
00722   static bool            isTeammate                ( ObjectT      o          );
00723   static bool            isOpponent                ( ObjectT      o          );
00724   static bool            isGoalie                  ( ObjectT      o          );
00725   static bool            isPlayer                  ( ObjectT      o          );
00726   static bool            isKnownPlayer             ( ObjectT      o          );
00727   static int             getIndex                  ( ObjectT      o          );
00728   static ObjectT         getTeammateObjectFromIndex( int          iIndex     );
00729   static ObjectT         getOpponentObjectFromIndex( int          iIndex     );
00730   static VecPosition     getGlobalPositionFlag     ( ObjectT      o,
00731                                                      SideT        s,
00732                                                      double dGoalWidth =14.02);
00733   static AngDeg          getGlobalAngleLine        ( ObjectT      o,
00734                                                      SideT        s          );
00735 
00736   // methods that deal with the differen play modes
00737   static PlayModeT       getPlayModeFromStr        ( char         *str       );
00738   static PlayModeT       getPlayModeFromRefereeMessage( RefereeMessageT rm   );
00739   static char*           getPlayModeStr            ( PlayModeT    p          );
00740   static char*           getRefereeMessageStr      ( RefereeMessageT r       );
00741   static RefereeMessageT getRefereeMessageFromStr  ( char         *str       );
00742 
00743   // methods that deal with the frequency of the visual information
00744   static char*           getViewAngleStr           ( ViewAngleT   v          );
00745   static ViewAngleT      getViewAngleFromStr       ( char         *str       );
00746   static AngDeg          getHalfViewAngleValue     ( ViewAngleT   va         );
00747   static char*           getViewQualityStr         ( ViewQualityT v          );
00748   static ViewQualityT    getViewQualityFromStr     ( char         *str       );
00749 
00750   // methods that deal with the commands
00751   static char*           getCommandStr             ( CommandT     com        );
00752   static bool            isPrimaryCommand          ( CommandT     com        );
00753 
00754   // methods that deal with the side information
00755   static char*           getSideStr                ( SideT        s          );
00756   static SideT           getSideFromStr            ( char*        str        );
00757 
00758   // methods that deal with the status of the ball.
00759   static char*           getBallStatusStr          ( BallStatusT  bs         );
00760   static BallStatusT     getBallStatusFromStr      ( char         *str       );
00761   
00762   static AngDeg          getAngleFromDirection     ( DirectionT   dir        );
00763 } ;
00764 
00765 #endif

Generated on Thu Apr 26 22:45:28 2007 for GangOfSix(GOS)-RoboCupTeamProject by  doxygen 1.5.1-p1