Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Representations/Cognition/PlayerPoseCollection.h

Go to the documentation of this file.
00001 /**
00002  * @file PlayerPoseCollection.h
00003  * 
00004  * Declaration of class PlayerPoseCollection
00005  * @author <A href=mailto:kspiess@informatik.uni-bremen.de>Kai Spiess</A>
00006  */ 
00007 
00008 #ifndef __PlayerPoseCollection_h_
00009 #define __PlayerPoseCollection_h_
00010 
00011 #include "Tools/Streams/InOut.h"
00012 #include "Tools/Math/Pose2D.h"
00013 #include "Tools/Player.h"
00014 
00015 
00016 /**
00017  *  This class contains the informations about the PlayerPose 
00018  *  of a located robot. This is not for informations about the own robot.
00019  */
00020 class PlayerPose
00021 {
00022 public:
00023   /** Constructor */
00024   PlayerPose(){speed = 0;playerNumber=Player::undefinedPlayerNumber;sigmaMin=-1;sigmaMaj=-1;};
00025   /** Copy-Constructor */
00026   PlayerPose(const PlayerPose& other){*this = other;};
00027   /** Destructor */
00028   ~PlayerPose(){};
00029 
00030   unsigned long frameNumber; /**< The frame number of the image that was used to create the percept. */
00031   
00032   void setFrameNumber(unsigned long frameNumber) {this->frameNumber = frameNumber;}
00033 
00034   /** sets the pose */
00035   void setPose(const Pose2D& p) {pose = p;}
00036 
00037   /** sets the pose */
00038   void setPose(const double& x, const double& y, const double& rotation)
00039   { pose.translation.x = x; pose.translation.y = y; pose.rotation = rotation; }
00040 
00041   /** returns the pose */
00042   const Pose2D& getPose() const {return pose;}
00043 
00044   /** sets the speed */
00045   void setSpeed(const double& _speed) {
00046     speed = _speed;
00047   }
00048 
00049   /** returns the speed */
00050   const double& getSpeed() const {return speed;}
00051 
00052   /** sets the validity */
00053   void setValidity(const double& v) {validity = v;}
00054 
00055   /** returns the validity */
00056   const double& getValidity() const {return validity;}
00057 
00058   /** sets the playerNumber */
00059   void setPlayerNumber(const Player::playerNumber n) {playerNumber = n;}
00060 
00061   /** returns the playerRole */
00062   const Player::playerNumber& getPlayerNumber() const {return playerNumber;}
00063 
00064   /** returns the player number as an Integer */
00065   int getPlayerNumberAsInt() const {return (int)playerNumber; }
00066 
00067   /** copies another PlayerPose to this one */
00068   void operator = (const PlayerPose& other);
00069 
00070   /** sets the sigmaMin */
00071   void setSigmaMin(const double sigma) {sigmaMin = sigma;}
00072 
00073   /** returns the sigmaMin */
00074   const double& getSigmaMin() const {return sigmaMin;}
00075 
00076   /** sets the sigmaMaj */
00077   void setSigmaMaj(const double sigma) {sigmaMaj = sigma;}
00078 
00079   /** returns the sigmaMaj */
00080   const double& getSigmaMaj() const {return sigmaMaj;}
00081 
00082   /** sets the cosAngle */
00083   void setCosAngle(const double cos) {cosAngle = cos;}
00084 
00085   /** returns the cosAngle */
00086   const double& getCosAngle() const {return cosAngle;}
00087 
00088   /** sets the sinAngle */
00089   void setSinAngle(const double sin) {sinAngle = sin;}
00090 
00091   /** returns the sinAngle */
00092   const double& getSinAngle() const {return sinAngle;}
00093 
00094 private:
00095   /** The position and orientation of the player as a Pose2D */
00096   Pose2D pose;
00097 
00098   /** The speed of the player */
00099   double speed;
00100 
00101   /** The validity of the located robot */
00102   double validity;
00103 
00104   /** Playerrole */
00105   Player::playerNumber playerNumber;
00106 
00107   /** The variance in Min-direction */
00108   double sigmaMin;
00109 
00110   /** The variance in Maj-direction */
00111   double sigmaMaj;
00112 
00113   /** The cosinus of the angle of the variance-ellipse */
00114   double cosAngle;
00115 
00116   /** The sinus of the angle of the variance-ellipse */
00117   double sinAngle;
00118 
00119 };
00120 
00121 /**
00122  * Streaming operator that reads a PlayerPose from a stream.
00123  * @param stream The stream from which is read.
00124  * @param playerPose The PlayerPose object.
00125  * @return The stream.
00126  */ 
00127 In& operator>>(In& stream,PlayerPose& playerPose);
00128 
00129 /**
00130  * Streaming operator that writes a PlayerPose to a stream.
00131  * @param stream The stream to write on.
00132  * @param playerPose The PlayerPose object.
00133  * @return The stream.
00134  */ 
00135 Out& operator<<(Out& stream, const PlayerPose& playerPose);
00136 
00137 
00138 
00139 /**
00140  *  This class contains the PlayerPoses of all detected robots.
00141  */
00142 class PlayerPoseCollection
00143 {
00144 public:
00145   /** Constructor */
00146   PlayerPoseCollection();
00147 
00148   /** Copy-Constructor */
00149   PlayerPoseCollection(PlayerPoseCollection& other);
00150 
00151   /** Destructor */
00152   ~PlayerPoseCollection();
00153 
00154   /** sets a player pose of the own team at a given index */
00155   void setOwnPlayerPose(int index, const PlayerPose& pose) {ownPlayerPoses[index] = pose;}
00156 
00157   /** sets a player pose of the own team at a given index */
00158   void setOwnPlayerPose(int index, const double& x, const double& y, const double& rotation) 
00159   {ownPlayerPoses[index].setPose(x,y,rotation);}
00160 
00161   /** sets a player pose of the own team at a given index */
00162   void setOwnPlayerPose(int index, const double& x, const double& y, const double& rotation, const double& validity) 
00163   {
00164     ownPlayerPoses[index].setPose(x,y,rotation);
00165     ownPlayerPoses[index].setValidity(validity);
00166   }
00167 
00168   /** returns a player pose of the own team for a given index */
00169   const PlayerPose& getOwnPlayerPose(int index) const {return ownPlayerPoses[index];}
00170 
00171   /** sets a player pose of the opponent team at a given index */
00172   void setOpponentPlayerPose(int index, const PlayerPose& pose) {opponentPlayerPoses[index] = pose;}
00173 
00174   /** sets a player pose of the opponent team at a given index */
00175   void setOpponentPlayerPose(int index, const double& x, const double& y, const double& rotation) 
00176   {opponentPlayerPoses[index].setPose(x,y,rotation);}
00177 
00178   /** sets a player pose of the opponent team at a given index */
00179   void setOpponentPlayerPose(int index, const double& x, const double& y, const double& rotation, const double& validity) 
00180   {
00181     opponentPlayerPoses[index].setPose(x,y,rotation);
00182     opponentPlayerPoses[index].setValidity(validity);
00183   }
00184   
00185   /** returns a player pose of the opponent team for a given index */
00186   const PlayerPose& getOpponentPlayerPose(int index) const {return opponentPlayerPoses[index];}
00187 
00188   /** copies another PlayerPoseCollection to this one */
00189   void operator = (const PlayerPoseCollection& other);
00190 
00191   /** Number of located opponent robots */
00192   int numberOfOpponentPlayers;
00193 
00194   /** Number of located own robots */
00195   int numberOfOwnPlayers;
00196 
00197   /** give the In operator acess to protected members */
00198   friend In& operator>>(In& stream,PlayerPoseCollection& playerPoseCollection);
00199 
00200   /** give the Out operator acess to protected members */
00201   friend Out& operator<<(Out& stream, const PlayerPoseCollection& playerPoseCollection);
00202 
00203 protected:
00204   /** A list of located opponent robots */
00205   PlayerPose opponentPlayerPoses[4];
00206 
00207   /** A list of located own robots */
00208   PlayerPose ownPlayerPoses[3];
00209 };
00210 
00211 /**
00212  * Streaming operator that reads a PlayerPoseCollection from a stream.
00213  * @param stream The stream from which is read.
00214  * @param playerPoseCollection The PlayerPoseCollection object.
00215  * @return The stream.
00216  */ 
00217 In& operator>>(In& stream,PlayerPoseCollection& playerPoseCollection);
00218  
00219 /**
00220  * Streaming operator that writes a PlayerPoseCollection to a stream.
00221  * @param stream The stream to write on.
00222  * @param playerPoseCollection The PlayerPoseCollection object.
00223  * @return The stream.
00224  */ 
00225 Out& operator<<(Out& stream, const PlayerPoseCollection& playerPoseCollection);
00226 
00227 
00228 #endif //__PlayerPoseCollection_h_
00229 
00230 /*
00231  * Change log :
00232  * 
00233  * $Log: PlayerPoseCollection.h,v $
00234  * Revision 1.1.1.1  2004/05/22 17:25:15  cvsadm
00235  * created new repository GT2004_WM
00236  *
00237  * Revision 1.4  2004/01/19 14:55:23  dueffert
00238  * all frameNumbers (and not only some of them) are unsigned long now
00239  *
00240  * Revision 1.3  2003/12/06 17:45:33  loetzsch
00241  * replaced Player::playerRole (goalie, defender, striker1, striker2)
00242  * by Player::playerNumber (one, two, three, four)
00243  *
00244  * Revision 1.2  2003/11/18 16:09:10  goehring
00245  * frameNumber added
00246  *
00247  * Revision 1.1  2003/10/07 10:07:01  cvsadm
00248  * Created GT2004 (M.J.)
00249  *
00250  * Revision 1.1.1.1  2003/07/02 09:40:22  cvsadm
00251  * created new repository for the competitions in Padova from the 
00252  * tamara CVS (Tuesday 2:00 pm)
00253  *
00254  * removed unused solutions
00255  *
00256  * Revision 1.7  2003/05/13 14:32:33  mkunz
00257  * added setOwnPlayerPose-method with validity
00258  *
00259  * Revision 1.6  2003/04/19 03:17:59  pruente
00260  * Merged in changes by Carsten: - Added collision prohibition
00261  *
00262  *
00263  * Revision 1.5  2003/03/16 20:15:12  thiel
00264  * changed set-methods from const double& to const double
00265  * operator= completed with missing attributs
00266  *
00267  * Revision 1.4  2003/03/12 13:33:29  schmidt
00268  * Added some result data from the sensor fusion merge process to the playerPose.
00269  *
00270  * Revision 1.3  2003/02/27 10:06:59  schmidt
00271  * Added three variants of a SensorFusionPlayersLocator.
00272  *
00273  * Revision 1.2  2002/09/22 18:40:51  risler
00274  * added new math functions, removed GTMath library
00275  *
00276  * Revision 1.1  2002/09/10 15:26:39  cvsadm
00277  * Created new project GT2003 (M.L.)
00278  * - Cleaned up the /Src/DataTypes directory
00279  * - Removed Challenge Code
00280  * - Removed processing of incoming audio data
00281  * - Renamed AcousticMessage to SoundRequest
00282  *
00283  * Revision 1.3  2002/07/23 13:32:57  loetzsch
00284  * new streaming classes
00285  *
00286  * removed many #include statements
00287  *
00288  * Revision 1.2  2002/06/10 14:15:34  kspiess
00289  * new set methode
00290  *
00291  * Revision 1.1.1.1  2002/05/10 12:40:13  cvsadm
00292  * Moved GT2002 Project from ute to tamara.
00293  *
00294  * Revision 1.8  2002/02/05 03:36:12  loetzsch
00295  * replaced direct member access by
00296  * inline const VALUE& get...() const   and
00297  * inline void set...(const Value&) methods.
00298  *
00299  * Revision 1.7  2002/02/03 14:37:58  juengel
00300  * Drawing of the world state removed from Berlin2001BehaviorControl.
00301  * Drawing method for world states added to PaintMethods.
00302  * Drawing of the world state added to the Processes with BehaviorControl.
00303  *
00304  * Revision 1.6  2002/01/15 10:15:30  kspiess
00305  * Streaming-Operatoren für PlayerPose hinzugefügt
00306  *
00307  * Revision 1.5  2002/01/13 14:08:57  kspiess
00308  * Pose2D eingebaut
00309  *
00310  * Revision 1.4  2001/12/20 23:15:17  kspiess
00311  * PlayerPoseCollection implementiert
00312  *
00313  * Revision 1.3  2001/12/10 17:47:06  risler
00314  * change log added
00315  *
00316  */

Generated on Thu Sep 23 19:57:35 2004 for GT2004 by doxygen 1.3.6