Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Objects.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 
00046 #ifndef _OBJECTS_
00047 #define _OBJECTS_
00048 
00049 #include "SoccerTypes.h"  // needed for ObjectT
00050 
00051 /*****************************************************************************/
00052 /********************** CLASS OBJECT *****************************************/
00053 /*****************************************************************************/
00054 
00061 class Object
00062 {
00063 protected:
00064   ObjectT     objectType;             
00065   Time        timeLastSeen;           
00067   VecPosition posGlobal;              
00068   Time        timeGlobalPosition;     
00069   VecPosition posRelative;            
00070   Time        timeRelativePosition;   
00071   VecPosition posGlobalLastSee;       
00072   Time        timeGlobalPosDerivedFromSee;
00075 public:
00076   Object( );
00077 
00079   virtual void show( ostream& os = cout ) = 0;
00080 
00081   // non-standard get and set methods (all defined here)
00082   AngDeg      getRelativeAngle              (                                );
00083   double      getRelativeDistance           (                                );
00084   double      getConfidence                 ( Time        time               );
00085 
00086   // standard get and set methods
00087   bool        setType                       ( ObjectT     o                  );
00088   ObjectT     getType                       (                          ) const;
00089 
00090   bool        setRelativePosition           ( double      dDist,
00091                                               AngDeg      dAng,
00092                                               Time        time               );
00093   bool        setRelativePosition           ( VecPosition v,
00094                                               Time        time               );
00095   VecPosition getRelativePosition           (                          ) const;
00096 
00097   bool        setTimeRelativePosition       ( Time        time               );
00098   Time        getTimeRelativePosition       (                          ) const;
00099 
00100   bool        setGlobalPosition             ( VecPosition p,
00101                                               Time        time               );
00102   VecPosition getGlobalPosition             (                          ) const;
00103 
00104   bool        setTimeGlobalPosition         ( Time        time               );
00105   Time        getTimeGlobalPosition         (                          ) const;
00106 
00107   bool        setGlobalPositionLastSee      ( VecPosition p,
00108                                               Time        time               );
00109   VecPosition getGlobalPositionLastSee      (                          ) const;
00110 
00111   bool        setTimeGlobalPosDerivedFromSee( Time        time               );
00112   Time        getTimeGlobalPosDerivedFromSee(                          ) const;
00113 
00114   bool        setTimeLastSeen               ( Time        time               );
00115   Time        getTimeLastSeen               (                          ) const;
00116 
00117 };
00118 
00119 /*****************************************************************************/
00120 /********************** CLASS FIXEDOBJECT ************************************/
00121 /*****************************************************************************/
00122 
00126 class FixedObject : public Object
00127 {
00128 public:
00129   // specific methods
00130   VecPosition getGlobalPosition( SideT s, double dGoalWidth = 14.02 ) const;
00131   AngDeg      getGlobalAngle   ( SideT s                                  );
00132 
00133   void show                    ( ostream & os = cout                      );
00134 };
00135 
00136 /*****************************************************************************/
00137 /********************** CLASS DYNAMICOBJECT **********************************/
00138 /*****************************************************************************/
00139 
00143 class DynamicObject: public Object
00144 {
00145 protected:
00146 
00147   // global velocity information
00148   VecPosition vecGlobalVelocity;      
00149   Time        timeGlobalVelocity;     
00151   // sensor information
00152   double      dRelativeDistanceChange;
00153   double      dRelativeAngleChange;   
00154   Time        timeChangeInformation;  
00156   VecPosition vecGlobalVelocityLastSee;
00159 public:
00160   DynamicObject( );
00161 
00162   // standard get and set methods
00163   bool        setRelativeDistanceChange( double      d,   Time time );
00164   double      getRelativeDistanceChange(                            ) const;
00165 
00166   bool        setRelativeAngleChange   ( double      d,   Time time );
00167   double      getRelativeAngleChange   (                            ) const;
00168 
00169   bool        setTimeChangeInformation ( Time        time           );
00170   Time        getTimeChangeInformation (                            )  const;
00171 
00172   bool        setGlobalVelocity        ( VecPosition v,   Time time );
00173   VecPosition getGlobalVelocity        (                            )  const;
00174   double      getSpeed                 (                            )  const;
00175 
00176   bool        setTimeGlobalVelocity    ( Time        time           );
00177   Time        getTimeGlobalVelocity    (                            )  const;
00178   
00179   bool        setGlobalVelocityLastSee ( VecPosition vec            );
00180   VecPosition getGlobalVelocityLastSee (                            )   const;
00181 
00182 };
00183 
00184 /*****************************************************************************/
00185 /********************* CLASS PLAYEROBJECT ************************************/
00186 /*****************************************************************************/
00187 
00190 class PlayerObject: public DynamicObject
00191 {
00192 protected:
00193   bool    isKnownPlayer;         
00194   ObjectT objRangeMin;           
00195   ObjectT objRangeMax;           
00196   bool    isGoalie;              
00197   AngDeg  angGlobalBodyAngle;    
00198   AngDeg  angGlobalNeckAngle;    
00199   AngDeg  angGlobalBodyAngleLastSee;
00200   Time    timeGlobalAngles;      
00201   int     iHeteroPlayerType;     
00203   Time    m_timeTackle;          
00205   AngDeg  m_angGlobalArm;        
00206   Time    m_timeGlobalArm;       
00208 private:
00209   AngDeg  angRelativeBodyAngle;  
00210   AngDeg  angRelativeNeckAngle;  
00211   Time    timeRelativeAngles;    
00214 public:
00215   PlayerObject( );
00216 
00217   void    show( ostream & os = cout );
00218   void    show( const char * strTeamName, ostream & os = cout );
00219 
00220   // standard get and set methods
00221   bool    setPossibleRange     ( ObjectT objMin, ObjectT objMax );
00222   bool    isInRange            ( ObjectT obj,    bool bTeamFirst);
00223   ObjectT getMinRange          (                                );
00224   ObjectT getMaxRange          (                                );
00225   
00226   bool    setIsKnownPlayer     ( bool     b                     );
00227   bool    getIsKnownPlayer     (                                ) const;
00228 
00229   bool    setIsGoalie          ( bool     b                     );
00230   bool    getIsGoalie          (                                ) const;
00231 
00232   bool    setRelativeBodyAngle ( AngDeg   ang,   Time    time   );
00233   AngDeg  getRelativeBodyAngle (                                ) const;
00234   bool    setGlobalBodyAngle   ( AngDeg   ang,   Time    time   );
00235   AngDeg  getGlobalBodyAngle   (                                ) const;
00236 
00237   bool    setRelativeNeckAngle ( AngDeg   ang,   Time    time   );
00238   AngDeg  getRelativeNeckAngle (                                ) const;
00239   bool    setGlobalNeckAngle   ( AngDeg   ang,   Time    time   );
00240   AngDeg  getGlobalNeckAngle   (                                ) const;
00241 
00242   bool    setTimeRelativeAngles( Time     time                  );
00243   Time    getTimeRelativeAngles(                                ) const;
00244   bool    setTimeGlobalAngles  ( Time     time                  );
00245   Time    getTimeGlobalAngles  (                                ) const;
00246 
00247   bool    setGlobalBodyAngleLastSee( AngDeg ang                 );
00248   AngDeg  getGlobalBodyAngleLastSee(                            ) const;
00249 
00250   bool    setHeteroPlayerType  ( int      index                 ) ;
00251   int     getHeteroPlayerType  (                                ) const;   
00252  
00253   bool    setTimeTackle        ( Time     time                  );
00254   Time    getTimeTackle        (                                ) const;
00255 
00256   bool    setGlobalArm         ( AngDeg   ang,   Time    time   );
00257   AngDeg  getGlobalArm         (                                ) const;
00258 
00259   bool    setTimeGlobalArm     ( Time     time                  );
00260   Time    getTimeGlobalArm     (                                ) const;
00261 
00262 };
00263 
00264 /*****************************************************************************/
00265 /********************* CLASS BALLOBJECT **************************************/
00266 /*****************************************************************************/
00267 
00271 class BallObject: public DynamicObject
00272 {
00273 public:
00274   BallObject();
00275   void show( ostream & os = cout );
00276 
00277 };
00278 
00279 /*****************************************************************************/
00280 /********************* CLASS STAMINA *****************************************/
00281 /*****************************************************************************/
00282 
00291 class Stamina
00292 {
00293   double m_dStamina;              
00294   double m_dEffort;               
00295   double m_dRecovery;             
00297 public:
00298   Stamina( double dSta = 4000.0, double dEff=1.0, double dRec=1.0 );
00299   void         show        ( ostream & os = cout                     );
00300 
00301   // return value how tired an agent is
00302   TiredNessT   getTiredNess( double dRecDecThr,   double dStaminaMax );
00303   
00304   // standard get and set methods.
00305   double       getStamina  (                                         ) const;
00306   bool         setStamina  ( double d                                );
00307   double       getEffort   (                                         ) const;
00308   bool         setEffort   ( double d                                );
00309   double       getRecovery (                                         ) const;
00310   bool         setRecovery ( double d                                );
00311 };
00312 
00313 /*****************************************************************************/
00314 /********************* CLASS AGENTOBJECT *************************************/
00315 /*****************************************************************************/
00316 
00319 class AgentObject: public PlayerObject
00320 {
00321   ViewAngleT   viewAngle;             
00322   ViewQualityT viewQuality;           
00324   Stamina      stamina;               
00325   VecPosition  velSpeedRelToNeck;     
00326   AngDeg       angBodyAngleRelToNeck; 
00328   VecPosition  posPositionDifference; 
00330   bool         m_bArmMovable;         
00331   int          m_iArmExpires;         
00332   VecPosition  m_posGlobalArm;       ;
00333   int          m_iTackleExpires;      
00335 public:
00336   AgentObject( double dStaminaMax = 4000 );
00337 
00338   void         show( ostream & os = cout );
00339   void         show( const char * strTeamName, ostream & os = cout );
00340 
00341   // standard get and set methods
00342   VecPosition  getPositionDifference(                  ) const;
00343   bool         setPositionDifference( VecPosition  v   );
00344 
00345   ViewAngleT   getViewAngle         (                  ) const;
00346   bool         setViewAngle         ( ViewAngleT   v   );
00347 
00348   ViewQualityT getViewQuality       (                  ) const;
00349   bool         setViewQuality       ( ViewQualityT v   );
00350 
00351   Stamina      getStamina           (                  ) const;
00352   bool         setStamina           ( Stamina      sta );
00353 
00354   VecPosition  getSpeedRelToNeck    (                  ) const;
00355   bool         setSpeedRelToNeck    ( VecPosition  v   );
00356 
00357   bool         setGlobalNeckAngle   ( AngDeg       ang );
00358 
00359   AngDeg       getBodyAngleRelToNeck(                  ) const;
00360   bool         setBodyAngleRelToNeck( AngDeg       ang );
00361 
00362   bool         getArmMovable        (                  ) const;
00363   bool         setArmMovable        ( bool         b   );
00364 
00365   int          getArmExpires        (                  ) const;
00366   bool         setArmExpires        ( int          i   );
00367 
00368   VecPosition  getGlobalArmPosition (                  ) const;
00369   bool         setGlobalArmPosition ( VecPosition  v   );
00370 
00371   int          getTackleExpires     (                  ) const;
00372   bool         setTackleExpires     ( int          i   );   
00373 } ;
00374 
00375 
00376 #endif

Generated on Fri Nov 7 11:45:40 2003 for UvA Trilearn 2003 Base Code by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001