00001 /** 00002 * @file Motion.h 00003 * Declaration of Motion 00004 * @author <A href=mailto:brunn@sim.informatik.tu-darmstadt.de>Ronnie Brunn</A>, <A href=mailto:kuntze@sim.informatik.tu-darmstadt.de>Nicolai Kuntze</A>, <A href=mailto:kunz@sim.informatik.tu-darmstadt.de>Michael Kunz</A> 00005 * @author Max Risler 00006 */ 00007 00008 #ifndef __Motion_h_ 00009 #define __Motion_h_ 00010 00011 #include "Tools/Process.h" 00012 00013 #include "Modules/SensorDataProcessor/SensorDataProcessorSelector.h" 00014 #include "Modules/HeadControl/HeadControlSelector.h" 00015 #include "Modules/LEDControl/LEDControlSelector.h" 00016 #include "Modules/SoundControl/SoundControlSelector.h" 00017 #include "Modules/MotionControl/MotionControlSelector.h" 00018 #include "Tools/Debugging/Trace.h" 00019 00020 #include "PackageMotionCognition.h" 00021 #include "PackageCognitionMotion.h" 00022 00023 /** 00024 * @class Motion 00025 * 00026 * A process for actorics. 00027 */ 00028 class Motion : public Process 00029 { 00030 private: 00031 DEBUGGING; 00032 RECEIVER(SensorDataBuffer); 00033 RECEIVER(PackageCognitionMotion); 00034 SHARED_SENDER(Trace); 00035 SHARED_RECEIVER(Trace); 00036 00037 SENDER_MOTORCOMMANDS; 00038 SENDER_SOUNDDATA; 00039 SENDER(PackageMotionCognition); 00040 SENDER(OdometryData); 00041 public: 00042 00043 Motion(); 00044 00045 ~Motion(); 00046 00047 /** is called from the framework once in every frame */ 00048 virtual int main(); 00049 00050 /** is called direct before the first call of main() */ 00051 virtual void init(); 00052 00053 /** 00054 * The function handles incoming debug messages. 00055 * @param message the message to handle 00056 * @return Has the message been handled? 00057 */ 00058 virtual bool handleMessage(InMessage& message); 00059 00060 protected: 00061 //!@name modules 00062 //!@{ 00063 00064 /** a reference to the sensor data processor */ 00065 SensorDataProcessorSelector* pSensorDataProcessor; 00066 00067 /** a pointer to the HeadControl module */ 00068 HeadControlSelector *pHeadControl; 00069 00070 /** a pointer to the LEDControl module */ 00071 LEDControlSelector *pLEDControl; 00072 00073 /** a pointer to the MotionControl module */ 00074 MotionControlSelector *pMotionControl; 00075 00076 /** a pointer to the SoundControl module */ 00077 SoundControlSelector *pSoundControl; 00078 00079 //!@} 00080 unsigned int motionControlExecuteSlowMotion; 00081 00082 //!@name representations 00083 //!@{ 00084 00085 /** the head motion request */ 00086 HeadMotionRequest headMotionRequest; 00087 00088 /** The position and rotation of the camera relative to the robot */ 00089 CameraMatrix cameraMatrix; 00090 00091 /** The psd percept calculated by the sensor data processor */ 00092 PSDPercept psdPercept; 00093 00094 /** The body percept calculated by the sensor data processor */ 00095 BodyPercept bodyPercept; 00096 00097 /** The height and the inclination of the robot's body */ 00098 BodyPosture bodyPosture; 00099 00100 /** The odometry which was calculated in the before last frame */ 00101 OdometryData lastOdometry; 00102 00103 /** obstacles model from cognition */ 00104 ObstaclesModel obstaclesModel; 00105 00106 /** Frame number in which robot pose was last updated */ 00107 unsigned long lastFrameRobotPoseWasUpdated; 00108 00109 /** Used to update robot pose */ 00110 RingBuffer<OdometryData,40> odometryHistory; 00111 //!@} 00112 00113 /** 00114 * Can be used to slow down the game for debugging purposes (slow motion). 00115 * Is multiplied to the incoming MotionRequest and to the outgoing executedMotionRequest. 00116 * 1: Normal speed -- 0.1: almost dont move 00117 */ 00118 double gameSpeed; 00119 00120 /** Specifies if the head is blocked by a special action or walk.*/ 00121 bool headIsBlockedBySpecialActionOrWalk; 00122 00123 /** Has a trace already been stored? */ 00124 bool traceStored; 00125 #ifndef NDEBUG 00126 bool replace; 00127 Pose2D walkParams; 00128 #endif 00129 }; 00130 00131 #endif // __Motion_h_
1.3.6