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,2001, 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 */
00041 #ifndef _OBJECTS_
00042 #define _OBJECTS_
00043 
00044 #include "SoccerTypes.h"  // needed for ObjectT
00045 // #include "Geometry.h"     // needed for VecPosition
00046 
00047 /*****************************************************************************/
00048 /********************** CLASS OBJECT *****************************************/
00049 /*****************************************************************************/
00050 
00057 class Object
00058 {
00059 protected:
00060   ObjectT     objectType;             
00061   Time        timeLastSeen;           
00063   VecPosition posGlobal;              
00064   Time        timeGlobalPosition;     
00065   VecPosition posRelative;            
00066   Time        timeRelativePosition;   
00067   VecPosition posGlobalLastSee;       
00068   Time        timeGlobalPosDerivedFromSee;
00071 public:
00072   Object( );
00073 
00075   virtual void show( ostream& os = cout ) = 0;
00076 
00077   // non-standard get and set methods (all defined here)
00078   AngDeg      getRelativeAngle              (                                 );
00079   double      getRelativeDistance           (                                 );
00080   double      getConfidence                 ( Time        time                );
00081 
00082   // standard get and set methods
00083   bool        setType                       ( ObjectT     o                   );
00084   ObjectT     getType                       (                           ) const;
00085 
00086   bool        setRelativePosition           ( double      dDist,
00087                                               AngDeg      dAng,
00088                                               Time        time                );
00089   bool        setRelativePosition           ( VecPosition v,
00090                                               Time        time                );
00091   VecPosition getRelativePosition           (                           ) const;
00092 
00093   bool        setTimeRelativePosition       ( Time        time                );
00094   Time        getTimeRelativePosition       (                           ) const;
00095 
00096   bool        setGlobalPosition             ( VecPosition p,
00097                                               Time        time                );
00098   VecPosition getGlobalPosition             (                           ) const;
00099 
00100   bool        setTimeGlobalPosition         ( Time        time                );
00101   Time        getTimeGlobalPosition         (                           ) const;
00102 
00103   bool        setGlobalPositionLastSee      ( VecPosition p,
00104                                               Time        time                );
00105   VecPosition getGlobalPositionLastSee      (                           ) const;
00106 
00107   bool        setTimeGlobalPosDerivedFromSee( Time        time                );
00108   Time        getTimeGlobalPosDerivedFromSee(                           ) const;
00109 
00110   bool        setTimeLastSeen               ( Time        time                );
00111   Time        getTimeLastSeen               (                           ) const;
00112 
00113 };
00114 
00115 /*****************************************************************************/
00116 /********************** CLASS FIXEDOBJECT ************************************/
00117 /*****************************************************************************/
00118 
00122 class FixedObject : public Object
00123 {
00124 public:
00125   // specific methods
00126   VecPosition getGlobalPosition( SideT s, double dGoalWidth = 14.02 ) const;
00127   AngDeg      getGlobalAngle   ( SideT s                                  );
00128 
00129   void show                    ( ostream & os = cout                      );
00130 };
00131 
00132 /*****************************************************************************/
00133 /********************** CLASS DYNAMICOBJECT **********************************/
00134 /*****************************************************************************/
00135 
00139 class DynamicObject: public Object
00140 {
00141 protected:
00142 
00143   // global velocity information
00144   VecPosition vecGlobalVelocity;      
00145   Time        timeGlobalVelocity;     
00147   // sensor information
00148   double      dRelativeDistanceChange;
00149   double      dRelativeAngleChange;   
00150   Time        timeChangeInformation;  
00152 public:
00153   DynamicObject( );
00154 
00155   // standard get and set methods
00156   bool        setRelativeDistanceChange( double      d,   Time time );
00157   double      getRelativeDistanceChange(                            ) const;
00158 
00159   bool        setRelativeAngleChange   ( double      d,   Time time );
00160   double      getRelativeAngleChange   (                            ) const;
00161 
00162   bool        setTimeChangeInformation ( Time        time           );
00163   Time        getTimeChangeInformation (                            )  const;
00164 
00165   bool        setGlobalVelocity        ( VecPosition v,   Time time );
00166   VecPosition getGlobalVelocity        (                            )  const;
00167   double      getSpeed                 (                            )  const;
00168 
00169   bool        setTimeGlobalVelocity    ( Time        time           );
00170   Time        getTimeGlobalVelocity    (                            )  const;
00171 
00172 };
00173 
00174 /******************************************************************************/
00175 /********************** CLASS PLAYEROBJECT ************************************/
00176 /******************************************************************************/
00177 
00180 class PlayerObject: public DynamicObject
00181 {
00182 protected:
00183   bool   isKnownPlayer;         
00184   bool   isGoalie;              
00185   AngDeg angGlobalBodyAngle;    
00186   AngDeg angGlobalNeckAngle;    
00187   Time   timeGlobalAngles;      
00189 private:
00190   AngDeg angRelativeBodyAngle;  
00191   AngDeg angRelativeNeckAngle;  
00192   Time   timeRelativeAngles;    
00195 public:
00196   PlayerObject( );
00197 
00198   void   show( ostream & os = cout );
00199   void   show( const char * strTeamName, ostream & os = cout );
00200 
00201   // standard get and set methods
00202 
00203   bool   setIsKnownPlayer     ( bool   b              );
00204   bool   getIsKnownPlayer     (                       ) const;
00205 
00206   bool   setIsGoalie          ( bool   b              );
00207   bool   getIsGoalie          (                       ) const;
00208 
00209   bool   setRelativeBodyAngle ( AngDeg ang, Time time );
00210   AngDeg getRelativeBodyAngle (                       )  const;
00211   bool   setGlobalBodyAngle   ( AngDeg ang, Time time );
00212   AngDeg getGlobalBodyAngle   (                       )  const;
00213 
00214   bool   setRelativeNeckAngle ( AngDeg ang, Time time );
00215   AngDeg getRelativeNeckAngle (                       )  const;
00216   bool   setGlobalNeckAngle   ( AngDeg ang, Time time );
00217   AngDeg getGlobalNeckAngle   (                       )  const;
00218 
00219   bool   setTimeRelativeAngles( Time   time           );
00220   Time   getTimeRelativeAngles(                       ) const;
00221   bool   setTimeGlobalAngles  ( Time   time           );
00222   Time   getTimeGlobalAngles  (                       ) const;
00223 
00224 };
00225 
00226 /******************************************************************************/
00227 /********************** CLASS BALLOBJECT **************************************/
00228 /******************************************************************************/
00229 
00233 class BallObject: public DynamicObject
00234 {
00235 public:
00236   BallObject();
00237   void show( ostream & os = cout );
00238 
00239 };
00240 
00241 /******************************************************************************/
00242 /********************** CLASS STAMINA *****************************************/
00243 /******************************************************************************/
00244 
00253 class Stamina
00254 {
00255   double m_dStamina;              
00256   double m_dEffort;               
00257   double m_dRecovery;             
00259 public:
00260   Stamina( double dSta = 4000.0, double dEff=1.0, double dRec=1.0 );
00261   void   show( ostream & os = cout );
00262 
00263   // standard get and set methods.
00264   double getStamina (          ) const;
00265   bool   setStamina ( double d );
00266   double getEffort  (          ) const;
00267   bool   setEffort  ( double d );
00268   double getRecovery(          ) const;
00269   bool   setRecovery( double d );
00270 };
00271 
00272 /******************************************************************************/
00273 /********************** CLASS AGENTOBJECT *************************************/
00274 /******************************************************************************/
00275 
00278 class AgentObject: public PlayerObject
00279 {
00280   ViewAngleT   viewAngle;             
00281   ViewQualityT viewQuality;           
00283   Stamina      stamina;               
00284   VecPosition  velSpeedRelToNeck;     
00285   AngDeg       angBodyAngleRelToNeck; 
00287   VecPosition  posPositionDifference; 
00289 public:
00290   AgentObject( double dStaminaMax = 4000 );
00291 
00292   void         show( ostream & os = cout );
00293   void         show( const char * strTeamName, ostream & os = cout );
00294 
00295   // standard get and set methods
00296   VecPosition  getPositionDifference(                  ) const;
00297   bool         setPositionDifference( VecPosition  v   );
00298 
00299   ViewAngleT   getViewAngle         (                  ) const;
00300   bool         setViewAngle         ( ViewAngleT   v   );
00301 
00302   ViewQualityT getViewQuality       (                  ) const;
00303   bool         setViewQuality       ( ViewQualityT v   );
00304 
00305   Stamina      getStamina           (                  ) const;
00306   bool         setStamina           ( Stamina      sta );
00307 
00308   VecPosition  getSpeedRelToNeck    (                  ) const;
00309   bool         setSpeedRelToNeck    ( VecPosition  v   );
00310 
00311   bool         setGlobalNeckAngle   ( AngDeg       ang );
00312 
00313   AngDeg       getBodyAngleRelToNeck(                  ) const;
00314   bool         setBodyAngleRelToNeck( AngDeg       ang );
00315 } ;
00316 
00317 
00318 #endif

Generated on Thu Mar 7 00:37:42 2002 for UvA Trilearn 2001 by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001