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

Processes/CMD/Cognition.h

Go to the documentation of this file.
00001 /** 
00002 * @file Processes/CMD/Cognition.h
00003 * Declaration of Cognition
00004 *
00005 * @author <a href="mailto:dueffert@informatik.hu-berlin.de">Uwe Düffert</a>
00006 * @author <a href="mailto:juengel@informatik.hu-berlin.de">Matthias Jüngel</a>
00007 * @author <a href="mailto:martin@martin-loetzsch.de">Martin Lötzsch</a>
00008 * @author <a href="mailto:risler@sim.informatik.tu-darmstadt.de">Max Risler</a>
00009 * @author <a href="mailto:roefer@tzi.de">Thomas Röfer</a>
00010 */
00011 
00012 #ifndef __Cognition_H__
00013 #define __Cognition_H__
00014 
00015 #include "Tools/Process.h"
00016 #include "Tools/Module/SolutionRequest.h"
00017 
00018 #include "Platform/Sensors.h"
00019 #include "Platform/UDPHandler.h"
00020 
00021 #include "PackageMotionCognition.h"
00022 #include "PackageCognitionMotion.h"
00023 
00024 #include "Representations/Behavior/BallHandling.h"
00025 #include "Modules/SensorDataProcessor/SensorDataProcessorSelector.h"
00026 #include "Modules/ImageProcessor/ImageProcessorSelector.h"
00027 #include "Modules/RobotStateDetector/RobotStateDetectorSelector.h"
00028 #include "Modules/TeamBallLocator/TeamBallLocatorSelector.h"
00029 #include "Modules/BallLocator/BallLocatorSelector.h"
00030 #include "Modules/PlayersLocator/PlayersLocatorSelector.h"
00031 #include "Modules/ObstaclesLocator/ObstaclesLocatorSelector.h"
00032 #include "Modules/SelfLocator/SelfLocatorSelector.h"
00033 #include "Modules/BehaviorControl/BehaviorControlSelector.h"
00034 #include "Modules/SensorBehaviorControl/SensorBehaviorControlSelector.h"
00035 #include "Modules/SpecialVision/DefaultSpecialVision.h"
00036 #include "Modules/CollisionDetector/CollisionDetectorSelector.h"
00037 #include "Modules/ColorTableMod/ColorTableModSelector.h"
00038 #include "Modules/GTCam/GTCamSelector.h"
00039 
00040 #include "Representations/Perception/ColorTable.h"
00041 #include "Representations/Perception/ColorTable64.h"
00042 #include "Representations/Perception/ColorTableTSL.h"
00043 #include "Representations/Perception/ColorTable32K.h"
00044 //#include "Representations/Perception/LandmarksPercept.h"
00045 #include "Representations/Perception/BallPercept.h"
00046 #include "Representations/Perception/PlayersPercept.h"
00047 #include "Representations/Perception/LinesPercept.h"
00048 #include "Representations/Perception/EdgesPercept.h"
00049 #include "Representations/Perception/CameraMatrix.h"
00050 #include "Representations/Cognition/GTCamWorldState.h"
00051 #include "Representations/Cognition/PassCorridorCollection.h"
00052 
00053 #include "Modules/BallLocator/GT2005Particles/GT2005ParticleContainer.h"
00054 #include "Representations/Cognition/RobotPoseCollection.h"
00055 #include "Tools/Debugging/Trace.h"
00056 
00057 /**
00058 * @class Cognition
00059 *
00060 * A Process for cognition related modules in the HU1 process layout.
00061 */
00062 class Cognition: public Process, public Sensors
00063 {
00064 private:
00065 #ifndef NO_PROCESS_FRAMEWORK
00066   DEBUGGING;
00067   GTCAM_HANDLER;
00068   GTCAM_TIMESYNC_HANDLER;
00069 
00070 // Use of StatusBroadcast
00071 #ifndef NSTATUSBROADCASTHANDLER
00072   STATUSBROADCAST_HANDLER;
00073 #endif
00074 
00075   RECEIVER(SensorDataBuffer);
00076   RECEIVER(Image);
00077   NET_RECEIVER(GameControlData);
00078   RECEIVER(PackageMotionCognition);
00079   RECEIVER(OdometryData);
00080 
00081 
00082 // Use of Network encryption
00083   NET_SENDER(TeamMessage1);
00084   NET_SENDER(TeamMessage2);
00085   NET_SENDER(TeamMessage3);
00086   NET_RECEIVER(TeamMessage1);
00087   NET_RECEIVER(TeamMessage2);
00088   NET_RECEIVER(TeamMessage3);
00089 #ifdef FIVEDOGS
00090   NET_RECEIVER(TeamMessage4);
00091   NET_SENDER(TeamMessage4);
00092 #endif
00093 
00094   SENDER(PackageCognitionMotion);
00095   SHARED_SENDER(Trace);
00096   SHARED_RECEIVER(Trace);
00097   UDP_HANDLER;
00098   UDP_BROADCAST_HANDLER(GameControlData);
00099 #endif
00100 
00101 #ifdef NO_PROCESS_FRAMEWORK
00102   MessageQueue theDebugReceiver;
00103   MessageQueue theDebugSender;
00104 
00105   SensorDataBuffer theSensorDataBufferReceiver;
00106   Image theImageReceiver;
00107   GameControlData theGameControlDataReceiver;
00108   PackageMotionCognition thePackageMotionCognitionReceiver;
00109   OdometryData theOdometryDataReceiver;
00110   PackageCognitionMotion thePackageCognitionMotionSender;
00111 #endif
00112 
00113 
00114 public:
00115   /** constructor */
00116   Cognition();
00117   
00118   /** destructor */
00119   ~Cognition();
00120   
00121   /** is called from the framework once in every frame */
00122   virtual int main();
00123   
00124   /** is called direct before the first call of main() */
00125   virtual void init();
00126   
00127   /** 
00128   * The function handles incoming debug messages.
00129   * @param message the message to handle
00130   * @return Has the message been handled?
00131   */
00132   virtual bool handleMessage(InMessage& message);
00133   
00134 protected:
00135   /** If true, then a new image was received in the current frame */
00136   bool processImage;
00137   
00138   /** If true, then new sensor data were received in the current frame */
00139   bool processSensorData;
00140   
00141   /** If true, then percepts were received or generated in the current frame */
00142   bool processPercepts;
00143 
00144   /** A GTCam Worldstate */
00145   GTCamWorldState gtCamWorldStateIN;
00146   GTCamWorldState gtCamWorldStateOUT;
00147   
00148   //!@name modules
00149   //!@{
00150   
00151   /** a reference to the colortable selector */
00152   ColorTableModSelector* pColorTableMod;
00153   
00154   /** a reference to the image processor */
00155   ImageProcessorSelector* pImageProcessor;
00156   
00157   /** a reference to the sensor data processor */
00158   SensorDataProcessorSelector* pSensorDataProcessor;
00159   
00160   /** a reference to the collision detector */
00161   CollisionDetectorSelector* pCollisionDetector;
00162   
00163   /** a reference to the robot state detector */
00164   RobotStateDetectorSelector* pRobotStateDetector;
00165   
00166   /** a reference to the ball-locator */
00167   BallLocatorSelector* pBallLocator;
00168   
00169   /** a reference to the team ball locator */
00170   TeamBallLocatorSelector* pTeamBallLocator;
00171   
00172   /** a reference to the players-locator */
00173   PlayersLocatorSelector* pPlayersLocator;
00174   
00175   /** a reference to the obstacles-locator */
00176   ObstaclesLocatorSelector* pObstaclesLocator;
00177   
00178   /** a reference to the self-locator */
00179   SelfLocatorSelector* pSelfLocator;
00180   
00181   /** a reference to the behavior control */
00182   BehaviorControlSelector* pBehaviorControl;
00183   
00184   /** a reference to sensor based behavior control */
00185   SensorBehaviorControlSelector* pSensorBehaviorControl;
00186   
00187   /** a reference to the special vison module*/
00188   SpecialVision* pSpecialVision;
00189 
00190   /** a reference to the GTCamSelector*/
00191   GTCamSelector* pGTCamSelector;
00192   
00193   //!@}
00194   
00195   //!@name representations
00196   //!@{
00197   
00198   /** the color tables */
00199   char colorTableBuffer[sizeof(ColorTable64) > sizeof(ColorTableTSL) 
00200     ? sizeof(ColorTable64) > sizeof(ColorTable32K) ? sizeof(ColorTable64) 
00201     : sizeof(ColorTable32K)
00202     : sizeof(ColorTableTSL) > sizeof (ColorTable32K)
00203     ? sizeof(ColorTableTSL) : sizeof(ColorTable32K)];
00204   /** the color table */
00205   ColorTable& colorTable;
00206   
00207   /** The offset and rotation of the camera */
00208   CameraMatrix cameraMatrix;
00209   
00210   /** Detected balls */
00211   BallPercept ballPercept;
00212   
00213   /** Detected players */
00214   PlayersPercept playersPercept;
00215   
00216   /** Detected obstacles */
00217   ObstaclesPercept obstaclesPercept;
00218   
00219   /** The collision percept */
00220   CollisionPercept collisionPercept;
00221   
00222   /** Detected lines */
00223   LinesPercept linesPercept;
00224   
00225   /** Detected edges */
00226   EdgesPercept edgesPercept;
00227   
00228   /** Detected switches */
00229   BodyPercept bodyPercept;
00230 
00231   /** The height and the inclination of the robot's body */
00232   BodyPosture bodyPosture;
00233 
00234   /** A spot relative to the robot that was detected by the PSD sensor */
00235   PSDPercept psdPercept;
00236   
00237   /** A special percept */
00238   SpecialPercept specialPercept;
00239   
00240   /** The request for the specialVision module*/
00241   SpecialVisionRequest specialVisionRequest;
00242   
00243   /** The request for calibration*/
00244   CalibrationRequest calibrationRequest;
00245   
00246   /** The sample set proxy linked to the sample set of the active locator */
00247   SampleSetProxy<PoseSample> selfLocatorSamples;
00248 
00249   /** The particles of the ball locator */
00250   GT2005ParticleContainer ballLocatorSamples;
00251 
00252   /** The calculated pass corridors */
00253   PassCorridorCollection passCorridorCollection;
00254 
00255   /** The players model set by the players locator */
00256   PlayersModel playersModel;
00257 
00258   /** The team message collection */
00259   TeamMessageCollection teamMessageCollection;
00260   
00261   /** The outgoing behavior team message */
00262   BehaviorTeamMessage outgoingBehaviorTeamMessage;
00263   
00264   /** Data produced by an extern sensor called joystick */
00265   JoystickData joystickData;
00266 
00267   /** robot pose collection */
00268   RobotPoseCollection robotPoseCollection;
00269 
00270   /** The feedback of the behavior about the ball handling */
00271   BallHandling ballHandling;
00272 
00273   unsigned long lastFrameNumber;
00274   
00275   void performFpsMeasure(); 
00276   unsigned long fpsCounter;
00277   unsigned long fpsLastMeasureTime;
00278   //!@}
00279 
00280   /** Has a trace already been stored? */
00281   bool traceStored;
00282 };
00283 
00284 
00285 #endif // __Cognition_H__

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