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 00019 #include "PackageMotionCognition.h" 00020 #include "PackageCognitionMotion.h" 00021 00022 /** 00023 * @class Motion 00024 * 00025 * A process for actorics. 00026 */ 00027 class Motion : public Process 00028 { 00029 private: 00030 DEBUGGING; 00031 RECEIVER(SensorDataBuffer); 00032 RECEIVER(PackageCognitionMotion); 00033 00034 SENDER_MOTORCOMMANDS; 00035 SENDER_SOUNDDATA; 00036 SENDER(PackageMotionCognition); 00037 SENDER(OdometryData); 00038 public: 00039 00040 Motion(); 00041 00042 ~Motion(); 00043 00044 /** is called from the framework once in every frame */ 00045 virtual int main(); 00046 00047 /** 00048 * The function handles incoming debug messages. 00049 * @param message the message to handle 00050 * @return Has the message been handled? 00051 */ 00052 virtual bool handleMessage(InMessage& message); 00053 00054 protected: 00055 //!@name modules 00056 //!@{ 00057 00058 /** a reference to the sensor data processor */ 00059 SensorDataProcessorSelector* pSensorDataProcessor; 00060 00061 /** a pointer to the HeadControl module */ 00062 HeadControlSelector *pHeadControl; 00063 00064 /** a pointer to the LEDControl module */ 00065 LEDControlSelector *pLEDControl; 00066 00067 /** a pointer to the MotionControl module */ 00068 MotionControlSelector *pMotionControl; 00069 00070 /** a pointer to the SoundControl module */ 00071 SoundControlSelector *pSoundControl; 00072 00073 //!@} 00074 00075 unsigned long frameNumber; 00076 00077 unsigned int motionControlExecuteSlowMotion; 00078 00079 //!@name representations 00080 //!@{ 00081 00082 /** the head motion request */ 00083 HeadMotionRequest headMotionRequest; 00084 00085 /** The position and rotation of the camera relative to the robot */ 00086 CameraMatrix cameraMatrix; 00087 00088 /** The psd percept calculated by the sensor data processor */ 00089 PSDPercept psdPercept; 00090 00091 /** The body percept calculated by the sensor data processor */ 00092 BodyPercept bodyPercept; 00093 00094 /** The height and the inclination of the robot's body */ 00095 BodyPosture bodyPosture; 00096 00097 /** The odometry which was calculated in the before last frame */ 00098 OdometryData lastOdometry; 00099 00100 /** Frame number in which robot pose was last updated */ 00101 unsigned long lastFrameRobotPoseWasUpdated; 00102 00103 /** Used to update robot pose */ 00104 RingBuffer<OdometryData,40> odometryHistory; 00105 //!@} 00106 00107 /** 00108 * Can be used to slow down the game for debugging purposes (slow motion). 00109 * Is multiplied to the incoming MotionRequest and to the outgoing executedMotionRequest. 00110 * 1: Normal speed -- 0.1: almost dont move 00111 */ 00112 double gameSpeed; 00113 00114 /** Specifies if the head is blocked by a special action or walk.*/ 00115 bool headIsBlockedBySpecialActionOrWalk; 00116 }; 00117 00118 #endif // __Motion_h_ 00119 00120 /* 00121 * Change log : 00122 * 00123 * $Log: Motion.h,v $ 00124 * Revision 1.6 2004/06/15 17:47:33 juengel 00125 * Removed unused variable frameNumberImage. 00126 * 00127 * Revision 1.5 2004/06/09 18:58:31 spranger 00128 * added MotionControl-slowmotion 00129 * 00130 * Revision 1.4 2004/05/27 10:20:14 loetzsch 00131 * clean up in the robot pose update 00132 * 00133 * Revision 1.3 2004/05/27 09:40:09 loetzsch 00134 * clean up 00135 * 00136 * Revision 1.2 2004/05/26 15:18:44 juengel 00137 * Added BodyPosture. 00138 * 00139 * Revision 1.1.1.1 2004/05/22 17:24:58 cvsadm 00140 * created new repository GT2004_WM 00141 * 00142 * Revision 1.8 2004/05/18 11:38:16 loetzsch 00143 * the Motion process now also executes a SensorDataProcessor for the calculation of the cameraMatrix 00144 * 00145 * Revision 1.7 2004/03/20 17:20:01 juengel 00146 * Added selector for LEDControl 00147 * 00148 * Revision 1.6 2004/03/20 09:55:27 roefer 00149 * Preparation for improved odometry 00150 * 00151 * Revision 1.5 2004/03/16 14:00:21 juengel 00152 * Integrated Improvments from "Günne" 00153 * -ATH2004ERS7Behavior 00154 * -ATHHeadControl 00155 * -KickSelectionTable 00156 * -KickEditor 00157 * 00158 * Revision 1.2 2004/03/15 17:11:40 hoffmann 00159 * - added ATH2004HeadControl 00160 * - added ATH2004LEDControl 00161 * - headmotiontester shows "tilt2" 00162 * - motion process updates odometry while no new robotPose is received, added to motion request 00163 * - some ui adjustments 00164 * - added member function to "field" to find out if robot is in own penalty area for use in the obstacles locator 00165 * 00166 * Revision 1.4 2004/03/04 10:05:27 jhoffman 00167 * - motion process now uses odometry to propagate the robot pose while no new robot pose is being sent (this makes headcontrol a little better) 00168 * - removed headcontrol member variable "propagatedPose" from headcontrol and cognition->motion-sender 00169 * 00170 * Revision 1.3 2004/01/19 14:56:22 dueffert 00171 * all frameNumbers (and not only some of them) are unsigned long now 00172 * 00173 * Revision 1.2 2003/11/14 19:02:26 goehring 00174 * frameNumber added 00175 * 00176 * Revision 1.1 2003/10/07 10:07:01 cvsadm 00177 * Created GT2004 (M.J.) 00178 * 00179 * Revision 1.2 2003/08/09 14:53:10 dueffert 00180 * files and docu beautified 00181 * 00182 * Revision 1.1.1.1 2003/07/02 09:40:25 cvsadm 00183 * created new repository for the competitions in Padova from the 00184 * tamara CVS (Tuesday 2:00 pm) 00185 * 00186 * removed unused solutions 00187 * 00188 * Revision 1.13 2003/05/27 16:16:10 juengel 00189 * Added headIsBlockedBySpecialActionOrWalk. 00190 * 00191 * Revision 1.12 2003/05/13 11:42:05 goehring 00192 * CollisionDetector removed 00193 * 00194 * Revision 1.11 2003/05/02 18:26:17 risler 00195 * SensorDataBuffer added 00196 * replaced SensorData with SensorDataBuffer 00197 * full SensorData resolution now accessible 00198 * 00199 * Revision 1.10 2003/04/25 19:49:44 goehring 00200 * Added new module CollisionDetector 00201 * 00202 * Revision 1.9 2003/03/20 20:34:21 loetzsch 00203 * Game Toolbar now can adjust the game speed 00204 * 00205 * Revision 1.8 2002/11/19 17:38:31 dueffert 00206 * doxygen bugs corrected 00207 * 00208 * Revision 1.7 2002/09/18 19:52:36 loetzsch 00209 * the head state is now sent from Motion to Cognition using the package. 00210 * 00211 * Revision 1.6 2002/09/17 23:55:22 loetzsch 00212 * - unraveled several datatypes 00213 * - changed the WATCH macro 00214 * - completed the process restructuring 00215 * 00216 * Revision 1.5 2002/09/12 14:20:05 juengel 00217 * Created a package for all data sent from Cognition to Motion. 00218 * 00219 * Revision 1.4 2002/09/11 20:06:19 loetzsch 00220 * continued experiments with modules/solutions 00221 * 00222 * Revision 1.3 2002/09/11 13:43:19 loetzsch 00223 * Created a package for all data that are sent from Motion to Cognition. 00224 * Removed all previous Senders 00225 * 00226 * Revision 1.2 2002/09/11 00:06:59 loetzsch 00227 * continued change of module/solution mechanisms 00228 * 00229 * Revision 1.1 2002/09/10 15:41:25 cvsadm 00230 * Created new project GT2003 (M.L.) 00231 * - Cleaned up the /Src/DataTypes directory 00232 * - Removed challenge related source code 00233 * - Removed processing of incoming audio data 00234 * - Renamed AcousticMessage to SoundRequest 00235 * - Removed all process layouts 00236 * - Added process layout CMD 00237 * 00238 * Revision 1.7 2002/07/23 13:40:52 loetzsch 00239 * - new streaming classes 00240 * - removed many #include statements 00241 * - new design of debugging architecture 00242 * - exchanged StaticQueue with MessageQueue 00243 * - new debug message handling 00244 * - general clean up 00245 * 00246 * Revision 1.6 2002/07/13 10:54:58 roefer 00247 * New command and sound sender 00248 * 00249 * Revision 1.5 2002/05/27 15:39:13 fischer 00250 * Added SoundState (Sender and Receiver) 00251 * 00252 * Revision 1.4 2002/05/25 22:52:19 roefer 00253 * WLan, first working approach 00254 * 00255 * Revision 1.3 2002/05/16 22:36:12 roefer 00256 * Team communication and GTMath bugs fixed 00257 * 00258 * Revision 1.2 2002/05/15 07:29:56 hebbel 00259 * Uses Soundprotocol 00260 * 00261 * Revision 1.1.1.1 2002/05/10 12:40:19 cvsadm 00262 * Moved GT2002 Project from ute to tamara. 00263 * 00264 * Revision 1.15 2002/05/06 16:03:48 hebbel 00265 * Added buffered Sender for SoundDataOut 00266 * 00267 * Revision 1.14 2002/05/04 17:47:44 loetzsch 00268 * LEDControl now has access to an instance of WLanStatus 00269 * (which shall be displayed then with the green leds. follows next) 00270 * 00271 * Revision 1.13 2002/04/29 17:17:28 hebbel 00272 * Put SoundPlay to Motion Process 00273 * 00274 * Revision 1.12 2002/02/05 20:02:16 risler 00275 * handleDebugMessage now returns bool, added debug message handling to ImageProcessor 00276 * 00277 * Revision 1.11 2002/01/30 17:29:56 loetzsch 00278 * handleDebugMessage um Parameter timestamp erweitert 00279 * 00280 * Revision 1.10 2001/12/21 14:09:39 roefer 00281 * Added several destructors 00282 * 00283 * Revision 1.9 2001/12/15 20:32:08 roefer 00284 * Senders and receivers are now part of the processes 00285 * 00286 * Revision 1.8 2001/12/14 12:34:09 dueffert 00287 * no message 00288 * 00289 * Revision 1.7 2001/12/13 18:49:25 risler 00290 * added odometry updates in GT2001MotionNetSpecialActions 00291 * 00292 * Revision 1.6 2001/12/12 18:08:56 loetzsch 00293 * Streaming- Operatoren für Bilder eingebaut, DebugKeyTable nicht- statisch gemacht, Debuggin Mechanismen weitergemacht, Bilder aus Logfiles in RobotControl anzeigen, Logfiles in HU1/Debug auf den Stick schreiben 00294 * 00295 * Revision 1.5 2001/12/11 18:14:45 kosen 00296 * SensorData added. 00297 * 00298 * problems with Receiver (multiple definition error) solved. 00299 * 00300 * Revision 1.4 2001/12/11 16:21:55 kosen 00301 * SensorData added 00302 * 00303 * Revision 1.3 2001/12/10 17:47:08 risler 00304 * change log added 00305 * 00306 */