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

Platform/Aperios1.3.2/GTCamTimeSyncHandler.h

Go to the documentation of this file.
00001 /** 
00002 * @file  Platform/Aperios1.3.2/GTCamTimeSyncHandler.h
00003 * @author Matthias Meyer
00004 */
00005 
00006 #ifndef _GTCamTimeSyncHandler_h
00007 #define _GTCamTimeSyncHandler_h
00008 
00009 #include "UDPEndpoint.h"
00010 #include "Tools/Player.h"
00011 #include <Tools/debugging/debugging.h>
00012 #include "Representations/Cognition/GTCamWorldState.h"
00013 #include "NetConfig.h"
00014 #include "Tools/TRingBufferWithSum.h"
00015 #include "Representations/Perception/Image.h"
00016 #include <stdio.h>
00017 #include <iostream.h>
00018 
00019 class GTCamTimeSyncHandler: public UDPEndpoint
00020 {
00021 public:
00022   GTCamTimeSyncHandler();
00023   ~GTCamTimeSyncHandler() {} ;
00024   void initGTCamTimeSyncHandler(GTCamWorldState* myState, Image* image);  // Init the TimeSync Handler (bind, etc.)
00025   virtual void onReceive(void* data, int size);             // Receive data from network
00026   void startTimeSync();                                     // Trigger the TimeSyncing
00027   void calculateOffset();                                   // calculate the TimeOffset
00028 
00029   long offset;
00030   long frameOffset;
00031   bool inSync;                                              // Flag: Are we in Sync
00032   IPAddress timeServer;                                     // IP of the TimeSync Server
00033 Image* image;
00034 
00035 private:
00036   TRingBufferWithSum<double,25> buffer; // Buffer of the last 50 offsets
00037   TRingBufferWithSum<long,25> frameNumberBuffer;
00038   GTCamWorldState* state;               // The Worldstate
00039                             // Image to get the actual framenumber from.
00040   long robotTimeRequestWasSent;         // timestamps
00041   long robotTimeRequestWasReceived;
00042   long serverTimeInResponse;
00043   long frameNumberTimeRequestWasSent;
00044   long frameNumberTimeRequestWasReceived;
00045   bool received2Packages;               // Flag: Did we receive 2 packages ?
00046 };
00047 
00048 #endif 

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