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

Objects.h

Go to the documentation of this file.
00001 /*
00002 Copyright (c) 2000-2002, 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 */
00045 #ifndef _OBJECTS_
00046 #define _OBJECTS_
00047 
00048 #include "SoccerTypes.h"  // needed for ObjectT
00049 
00050 /*****************************************************************************/
00051 /********************** CLASS OBJECT *****************************************/
00052 /*****************************************************************************/
00053 
00060 class Object
00061 {
00062 protected:
00063   ObjectT     objectType;             
00064   Time        timeLastSeen;           
00066   VecPosition posGlobal;              
00067   Time        timeGlobalPosition;     
00068   VecPosition posRelative;            
00069   Time        timeRelativePosition;   
00070   VecPosition posGlobalLastSee;       
00071   Time        timeGlobalPosDerivedFromSee;
00074 public:
00075   Object( );
00076 
00078   virtual void show( ostream& os = cout ) = 0;
00079 
00080   // non-standard get and set methods (all defined here)
00081   AngDeg      getRelativeAngle              (                                 );
00082   double      getRelativeDistance           (                                 );
00083   double      getConfidence                 ( Time        time                );
00084 
00085   // standard get and set methods
00086   bool        setType                       ( ObjectT     o                   );
00087   ObjectT     getType                       (                           ) const;
00088 
00089   bool        setRelativePosition           ( double      dDist,
00090                                               AngDeg      dAng,
00091                                               Time        time                );
00092   bool        setRelativePosition           ( VecPosition v,
00093                                               Time        time                );
00094   VecPosition getRelativePosition           (                           ) const;
00095 
00096   bool        setTimeRelativePosition       ( Time        time                );
00097   Time        getTimeRelativePosition       (                           ) const;
00098 
00099   bool        setGlobalPosition             ( VecPosition p,
00100                                               Time        time                );
00101   VecPosition getGlobalPosition             (                           ) const;
00102 
00103   bool        setTimeGlobalPosition         ( Time        time                );
00104   Time        getTimeGlobalPosition         (                           ) const;
00105 
00106   bool        setGlobalPositionLastSee      ( VecPosition p,
00107                                               Time        time                );
00108   VecPosition getGlobalPositionLastSee      (                           ) const;
00109 
00110   bool        setTimeGlobalPosDerivedFromSee( Time        time                );
00111   Time        getTimeGlobalPosDerivedFromSee(                           ) const;
00112 
00113   bool        setTimeLastSeen               ( Time        time                );
00114   Time        getTimeLastSeen               (                           ) const;
00115 
00116 };
00117 
00118 /*****************************************************************************/
00119 /********************** CLASS FIXEDOBJECT ************************************/
00120 /*****************************************************************************/
00121 
00125 class FixedObject : public Object
00126 {
00127 public:
00128   // specific methods
00129   VecPosition getGlobalPosition( SideT s, double dGoalWidth = 14.02 ) const;
00130   AngDeg      getGlobalAngle   ( SideT s                                  );
00131 
00132   void show                    ( ostream & os = cout                      );
00133 };
00134 
00135 /*****************************************************************************/
00136 /********************** CLASS DYNAMICOBJECT **********************************/
00137 /*****************************************************************************/
00138 
00142 class DynamicObject: public Object
00143 {
00144 protected:
00145 
00146   // global velocity information
00147   VecPosition vecGlobalVelocity;      
00148   Time        timeGlobalVelocity;     
00150   // sensor information
00151   double      dRelativeDistanceChange;
00152   double      dRelativeAngleChange;   
00153   Time        timeChangeInformation;  
00155 public:
00156   DynamicObject( );
00157 
00158   // standard get and set methods
00159   bool        setRelativeDistanceChange( double      d,   Time time );
00160   double      getRelativeDistanceChange(                            ) const;
00161 
00162   bool        setRelativeAngleChange   ( double      d,   Time time );
00163   double      getRelativeAngleChange   (                            ) const;
00164 
00165   bool        setTimeChangeInformation ( Time        time           );
00166   Time        getTimeChangeInformation (                            )  const;
00167 
00168   bool        setGlobalVelocity        ( VecPosition v,   Time time );
00169   VecPosition getGlobalVelocity        (                            )  const;
00170   double      getSpeed                 (                            )  const;
00171 
00172   bool        setTimeGlobalVelocity    ( Time        time           );
00173   Time        getTimeGlobalVelocity    (                            )  const;
00174 
00175 };
00176 
00177 /******************************************************************************/
00178 /********************** CLASS PLAYEROBJECT ************************************/
00179 /******************************************************************************/
00180 
00183 class PlayerObject: public DynamicObject
00184 {
00185 protected:
00186   bool    isKnownPlayer;         
00187   ObjectT objRangeMin;           
00188   ObjectT objRangeMax;           
00189   bool    isGoalie;              
00190   AngDeg  angGlobalBodyAngle;    
00191   AngDeg  angGlobalNeckAngle;    
00192   Time    timeGlobalAngles;      
00194 private:
00195   AngDeg angRelativeBodyAngle;  
00196   AngDeg angRelativeNeckAngle;  
00197   Time   timeRelativeAngles;    
00200 public:
00201   PlayerObject( );
00202 
00203   void    show( ostream & os = cout );
00204   void    show( const char * strTeamName, ostream & os = cout );
00205 
00206   // standard get and set methods
00207   bool    setPossibleRange     ( ObjectT objMin, ObjectT objMax );
00208   bool    isInRange            ( ObjectT obj                    );  
00209   ObjectT getMinRange          (                                );
00210   ObjectT getMaxRange          (                                );
00211   
00212   bool    setIsKnownPlayer     ( bool     b                     );
00213   bool    getIsKnownPlayer     (                                ) const;
00214 
00215   bool    setIsGoalie          ( bool     b                     );
00216   bool    getIsGoalie          (                                ) const;
00217 
00218   bool    setRelativeBodyAngle ( AngDeg   ang,   Time    time   );
00219   AngDeg  getRelativeBodyAngle (                                )  const;
00220   bool    setGlobalBodyAngle   ( AngDeg   ang,   Time    time   );
00221   AngDeg  getGlobalBodyAngle   (                                )  const;
00222 
00223   bool    setRelativeNeckAngle ( AngDeg   ang,   Time    time   );
00224   AngDeg  getRelativeNeckAngle (                                )  const;
00225   bool    setGlobalNeckAngle   ( AngDeg   ang,   Time    time   );
00226   AngDeg  getGlobalNeckAngle   (                                )  const;
00227 
00228   bool    setTimeRelativeAngles( Time     time                  );
00229   Time    getTimeRelativeAngles(                                ) const;
00230   bool    setTimeGlobalAngles  ( Time     time                  );
00231   Time    getTimeGlobalAngles  (                                ) const;
00232 
00233 };
00234 
00235 /******************************************************************************/
00236 /********************** CLASS BALLOBJECT **************************************/
00237 /******************************************************************************/
00238 
00242 class BallObject: public DynamicObject
00243 {
00244 public:
00245   BallObject();
00246   void show( ostream & os = cout );
00247 
00248 };
00249 
00250 /******************************************************************************/
00251 /********************** CLASS STAMINA *****************************************/
00252 /******************************************************************************/
00253 
00262 class Stamina
00263 {
00264   double m_dStamina;              
00265   double m_dEffort;               
00266   double m_dRecovery;             
00268 public:
00269   Stamina( double dSta = 4000.0, double dEff=1.0, double dRec=1.0 );
00270   void         show        ( ostream & os = cout                     );
00271 
00272   // return value how tired an agent is
00273   TiredNessT   getTiredNess( double dRecDecThr,   double dStaminaMax );
00274   
00275   // standard get and set methods.
00276   double       getStamina  (                                         ) const;
00277   bool         setStamina  ( double d                                );
00278   double       getEffort   (                                         ) const;
00279   bool         setEffort   ( double d                                );
00280   double       getRecovery (                                         ) const;
00281   bool         setRecovery ( double d                                );
00282 };
00283 
00284 /******************************************************************************/
00285 /********************** CLASS AGENTOBJECT *************************************/
00286 /******************************************************************************/
00287 
00290 class AgentObject: public PlayerObject
00291 {
00292   ViewAngleT   viewAngle;             
00293   ViewQualityT viewQuality;           
00295   Stamina      stamina;               
00296   VecPosition  velSpeedRelToNeck;     
00297   AngDeg       angBodyAngleRelToNeck; 
00299   VecPosition  posPositionDifference; 
00301 public:
00302   AgentObject( double dStaminaMax = 4000 );
00303 
00304   void         show( ostream & os = cout );
00305   void         show( const char * strTeamName, ostream & os = cout );
00306 
00307   // standard get and set methods
00308   VecPosition  getPositionDifference(                  ) const;
00309   bool         setPositionDifference( VecPosition  v   );
00310 
00311   ViewAngleT   getViewAngle         (                  ) const;
00312   bool         setViewAngle         ( ViewAngleT   v   );
00313 
00314   ViewQualityT getViewQuality       (                  ) const;
00315   bool         setViewQuality       ( ViewQualityT v   );
00316 
00317   Stamina      getStamina           (                  ) const;
00318   bool         setStamina           ( Stamina      sta );
00319 
00320   VecPosition  getSpeedRelToNeck    (                  ) const;
00321   bool         setSpeedRelToNeck    ( VecPosition  v   );
00322 
00323   bool         setGlobalNeckAngle   ( AngDeg       ang );
00324 
00325   AngDeg       getBodyAngleRelToNeck(                  ) const;
00326   bool         setBodyAngleRelToNeck( AngDeg       ang );
00327 } ;
00328 
00329 
00330 #endif

Generated on Tue Jul 2 10:18:52 2002 for UvA Trilearn 2002 by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001