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

Representations/WLan/TeamMessage.h

Go to the documentation of this file.
00001 /**
00002  * @file Representations/WLan/TeamMessage.h
00003  *
00004  * Declaration of class TeamMessage
00005  *
00006  * @author <A href=mailto:roefer@tzi.de>Thomas Röfer</A>
00007  * @author <A href=mailto:sebastian.schmidt@udo.edu>Sebastian Schmidt</A>
00008  * @author <A href=mailto:m_wachter@gmx.de>Michael Wachter</A>
00009  */ 
00010 
00011 #ifndef __TeamMessage_h_
00012 #define __TeamMessage_h_
00013 
00014 #include "Tools/Streams/InOut.h"
00015 #include "Tools/Player.h"
00016 #include "Representations/Cognition/RobotPose.h"
00017 #include "Representations/Cognition/BallModel.h"
00018 #include "Representations/Cognition/ObstaclesModel.h"
00019 #include "Representations/Perception/PlayersPercept.h"
00020 #include "Representations/WLan/BehaviorTeamMessage.h"
00021 #include "Modules/SensorBehaviorControl/SensorBehaviorTeamMessage.h"
00022 #include "Representations/Motion/OdometryData.h"
00023 #include "Representations/Perception/MultipleBallPerceptList.h"
00024 #include "Representations/Cognition/RobotPoseCollection.h"
00025 #include "Representations/Perception/MultipleBallPerceptList.h"
00026 #include "Modules/TeamBallLocator/GT2005Particles/GT2005ParticleContainerSend.h"
00027 
00028 class TeamMessage;
00029 class TeamMessageMessageCollection;
00030 /**
00031  * Streaming operator that reads a team message from a stream.
00032  * @param stream The stream from which is read.
00033  * @param teamMessage The object to be read.
00034  * @return The stream.
00035  */ 
00036 In& operator>>(In& stream,TeamMessage& teamMessage);
00037 
00038 /**
00039  * Streaming operator that writes a team message to a stream.
00040  * @param stream The stream to write on.
00041  * @param teamMessage The object to be written.
00042  * @return The stream.
00043  */ 
00044 Out& operator<<(Out& stream, const TeamMessage& teamMessage);
00045 
00046 
00047 /** 
00048  * @class TeamMessage
00049  *
00050  * Represents a collection of all data that is exchanged between the different robots.
00051  */
00052 class TeamMessage
00053 {
00054   public:
00055     
00056     unsigned int timeStamp; /**< The time stamp of the sending robot. */
00057     unsigned int lastReceivedTimeStamp[4]; /**< The timeStamp of the last package received from the receiving robot. */
00058     unsigned int incomingTimeStamp[4]; /**< The local receiving time of the last package received from the receiving robot. */
00059 
00060     RobotPose robotPose; /**< The robot pose of the robot. */
00061     bool sendRobotPose; /**< Send robotPose if true. */
00062     
00063     SeenBallState seenBallState; /**< The ball seen by the robot. */
00064     bool sendSeenBallState; /**< Send seenBallState if true. */
00065     
00066     BehaviorTeamMessage behaviorTeamMessage; /**< Messages by the behavior */
00067     bool sendBehaviorTeamMessage; /**< Send behaviorTeamMessage if true */
00068     
00069     PlayersPercept playersPercept; /**< */
00070     bool sendPlayersPercept; /**> Send playersPercept if true */
00071 
00072     SensorBehaviorTeamMessage sensorBehaviorTeamMessage; /**> */
00073     bool sendSensorBehaviorTeamMessage; /**> Send sensorBehaviorTeamMessage if true */
00074 
00075     OdometryData odometryData; /**> The odometry data of the robot */
00076     bool sendOdometryData; /**> Send odometryData if true */
00077 
00078     MultipleBallPerceptList multipleBallPerceptList; /**> The list of ball percepts of the robot*/
00079     bool sendMultipleBallPerceptList; /**> Send multipleBallPerceptList if true */
00080 
00081     GT2005ParticleContainerSend gt2005ParticleContainerSend; /**> The representative ball particles of the robot */
00082     bool sendGT2005ParticleContainerSend; /**> Send gt2005ParticleContainerSend if true */
00083 
00084     RobotPoseCollection robotPoseCollection; /**> The possible and most reliable robot poses */
00085     bool sendRobotPoseCollection; /**> Send robotPoseCollection if true */
00086 
00087     ObstaclesModel obstaclesModel; /**> The obstacles models of the robot */
00088     bool sendObstaclesModel; /**> Send obstaclesModel if true */
00089 
00090     signed long timeOffset; /**< timeOffset  Remote time - local time */
00091     Player::playerNumber playerNumberOfSender; /**< The player number of the Sender */
00092        
00093     /**
00094      * Constructor.
00095      */
00096     TeamMessage();
00097 
00098     virtual ~TeamMessage();
00099 
00100     /**
00101      * The function determines, whether the team message is actual.
00102      * @return Did the communication take less than 1 seconds?
00103      */
00104     bool isActual() const;
00105     bool isActual(int i) const;
00106 
00107     /**
00108      * This function returns the time of the remote player in the time 
00109      * system of the local player
00110      */
00111     long getTimeStampInOwnTime() const ;
00112 
00113     /**
00114      * This function converts a remote timeStamp to the local time system
00115      * @param time the timeStamp to be converted
00116      */
00117     long getTimeInOwnTime(long time) const;
00118 
00119     /**
00120      * This function converts a local timeStamp to the remote time system
00121      * @param time the timeStamp to be converted
00122      */
00123     long getTimeInRemoteTime(long time) const;
00124 
00125     /**
00126      * This function sets all send-markers to false. Its called by the TeamMessageCollection
00127      */
00128 
00129     void resetSendMarkers();
00130     
00131   private:
00132     // used to crypt the robotpose
00133     // this is only to stop non-GT Teams, which use our code, to retrieve the robot
00134     // position.
00135     // Darmstadt ? Crypto disabled because we have a better solution  ;) 
00136     // static int cryptWord;
00137     static void read(In& stream,Vector2<double>& v);
00138     static void read(In& stream,Pose2D& p);
00139     static void write(Out& stream,const Vector2<double>& v);
00140     static void write(Out& stream,const Pose2D& p);
00141     friend In& operator>>(In& stream,TeamMessage& teamMessage);
00142     friend Out& operator<<(Out& stream, const TeamMessage& teamMessage);
00143 };
00144 
00145 /** A TeamMessage from team mate 1 */
00146 class TeamMessage1 : public TeamMessage {};
00147 
00148 /** A TeamMessage from team mate 2 */
00149 class TeamMessage2 : public TeamMessage {};
00150 
00151 /** A TeamMessage from team mate 3 */
00152 class TeamMessage3 : public TeamMessage {};
00153 
00154 class TeamMessage4 : public TeamMessage {};
00155 
00156 #endif //__TeamMessage_h_

Generated on Mon Mar 20 22:00:04 2006 for GT2005 by doxygen 1.3.6