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

Modules/MotionControl/GT2004MotionControl.h

Go to the documentation of this file.
00001 /**
00002 * @file GT2004MotionControl.h
00003 * 
00004 * Definition of class GT2004MotionControl
00005 */
00006 
00007 #ifndef __GT2004MotionControl_h_
00008 #define __GT2004MotionControl_h_
00009 
00010 #include "MotionControl.h"
00011 
00012 #include "WakeUpEngine.h"
00013 
00014 #include "MotionStabilizer.h"
00015 
00016 #include "Modules/WalkingEngine/WalkingEngine.h"
00017 #include "Modules/SpecialActions/SpecialActions.h"
00018 #include "Modules/GetupEngine/GetupEngineSelector.h"
00019 
00020 #include "Modules/WalkingEngine/InvKinWalkingEngine.h"
00021 
00022 #include "Tools/Module/ModuleHandler.h"
00023 
00024 /** 
00025 * @class GT2004MotionControl
00026 * 
00027 * The default solution for the module MotionControl.
00028 * Integrates head joint values from the head control, joint values from walking
00029 * or special action engines and LED values from the LED control.
00030 */
00031 class GT2004MotionControl : public MotionControl, public MotionStabilizer
00032 {
00033 public:
00034 /** 
00035 * Constructor 
00036 * @param interfaces The paramters of the MotionControl module.
00037 * @param moduleHandler A reference to the ModuleHandler of the Process.
00038   */
00039   GT2004MotionControl(ModuleHandler& moduleHandler,
00040     const MotionControlInterfaces& interfaces);
00041   
00042   /** Destructor */
00043   ~GT2004MotionControl();
00044   
00045   /** Executes the module */
00046   virtual void execute();
00047   
00048   /** 
00049   * Called from a MessageQueue to distribute messages.
00050   * Use message.getMessageID to decide if the message is relavant for 
00051   * the MesssageHandler derivate.
00052   * Use message.bin, message.text or message.config as In streams to get the data from.
00053   * @param message The message that can be read.
00054   * @return true if the message was read (handled).
00055   */
00056   virtual bool handleMessage(InMessage& message);
00057   
00058 protected:
00059   /** determines the state of the MotionControl */
00060   void determineMotionControlState();
00061 
00062   /** sets the MotionControlState accordingly */
00063   void setMotionControlState();
00064 
00065   /** which module is currently used for calculation */
00066   // MotionRequest::MotionID currentMotionType;
00067   
00068   /** which module was used before */
00069   MotionRequest::MotionID lastMotionType;
00070 
00071   /** pointer to the WalkingEngine modules one for each walking type*/
00072   WalkingEngine *pWalkingEngine[WalkRequest::numOfWalkType];
00073   
00074   /** a pointer to the SpecialActions module */
00075   SpecialActions *pSpecialActions;
00076   
00077   /** a pointer to the GetupEngine module */
00078   GetupEngineSelector *pGetupEngine;
00079   
00080   /** 
00081   * a point to the single instance of the InvKinWalkingEngine
00082   * this is called by all different walk types using different parameter sets
00083   */
00084   InvKinWalkingEngine *pInvKinWalkingEngine;
00085 
00086   /** 
00087   * A reference to the ModuleHandler of the Process. 
00088   * Needed to create new solutions.
00089   */
00090   ModuleHandler& moduleHandler;
00091 
00092   /** counter used in wagTail */
00093   int tailCount;
00094   
00095   long lastHeadTilt, /**< Previous head tilt. */
00096        lastHeadPan, /**< Previous head pan. */
00097        lastHeadRoll; /**< Previous head roll. */
00098 
00099   /** executes the tail wag requested by motion request */
00100   void wagTail(
00101     const MotionRequest& motionRequest,
00102     const SensorData& sensorData,
00103     JointData& jointData
00104     );
00105 
00106   WakeUpEngine wakeUpEngine;
00107   // bool lastSpecialActionWasPlayDead;
00108   bool wakingUp;
00109 
00110   /** the last executed Motion indicated, that it´s possible to execute the motionRequest from Cognition */
00111   bool changeOfMotionControlStatePossible;
00112 
00113   /** the last cycle we were in */
00114   double positionInWalkCycle;
00115 
00116   /** The latest WalkRequest */
00117   WalkRequest latestWalkRequest;
00118 
00119   /** The latest SpecialActionRequest */
00120   SpecialActionRequest latestSpecialActionRequest;
00121 
00122   /** The state of the MotionControl */
00123   enum{
00124     stand,
00125     walk,
00126     specialAction,
00127     getup,
00128     wakeUp,
00129     playDead
00130   } motionControlState;
00131 };
00132 
00133 #endif// __GT2004MotionControl_h_
00134 
00135 /*
00136 * Change log :
00137 * 
00138 * $Log: GT2004MotionControl.h,v $
00139 * Revision 1.1  2004/07/10 00:18:30  spranger
00140 * renamed (readded) for coderelease
00141 *
00142 * Revision 1.7  2004/06/16 18:11:30  spranger
00143 * bugfix
00144 *
00145 * Revision 1.6  2004/06/14 17:07:39  spranger
00146 * removed breathe
00147 *
00148 * Revision 1.5  2004/06/14 15:05:52  spranger
00149 * redone statemachine, changed some interfaces
00150 *
00151 * Revision 1.4  2004/06/07 18:50:09  spranger
00152 * added positionInWalkCycle
00153 *
00154 * Revision 1.3  2004/06/02 17:19:31  spranger
00155 * cleanup
00156 *
00157 * Revision 1.2  2004/05/26 16:10:24  dueffert
00158 * better data types used
00159 *
00160 * Revision 1.1.1.1  2004/05/22 17:20:36  cvsadm
00161 * created new repository GT2004_WM
00162 *
00163 * Revision 1.4  2004/05/03 09:51:18  heinze
00164 * Prepared WakeUpEngine.
00165 *
00166 * Revision 1.3  2004/03/08 01:39:03  roefer
00167 * Interfaces should be const
00168 *
00169 * Revision 1.2  2004/01/21 14:31:58  loetzsch
00170 * Module Selectors create only the selected solution.
00171 * When the solution changes, the old solution is erased and the new
00172 * one ist created using createSolution(..)
00173 *
00174 * Revision 1.1  2003/10/06 14:10:13  cvsadm
00175 * Created GT2004 (M.J.)
00176 *
00177 * Revision 1.1.1.1  2003/07/02 09:40:24  cvsadm
00178 * created new repository for the competitions in Padova from the 
00179 * tamara CVS (Tuesday 2:00 pm)
00180 *
00181 * removed unused solutions
00182 *
00183 * Revision 1.8  2003/04/27 07:49:35  roefer
00184 * static vars -> member vars
00185 *
00186 * Revision 1.7  2003/01/23 16:44:10  risler
00187 * only one instance of InvKinWalkingEngine
00188 * parameter sets can now be switched while walking
00189 * added UNSWFastTurn, combining two parameter sets
00190 *
00191 * Revision 1.6  2002/12/03 13:06:34  dueffert
00192 * cleanup
00193 *
00194 * Revision 1.5  2002/11/26 13:08:05  jhoffman
00195 * no message
00196 *
00197 * Revision 1.4  2002/11/25 14:49:07  jhoffman
00198 * added "breathing" motion
00199 *
00200 * Revision 1.3  2002/09/22 18:40:53  risler
00201 * added new math functions, removed GTMath library
00202 *
00203 * Revision 1.2  2002/09/11 00:06:58  loetzsch
00204 * continued change of module/solution mechanisms
00205 *
00206 * Revision 1.1  2002/09/10 15:36:15  cvsadm
00207 * Created new project GT2003 (M.L.)
00208 * - Cleaned up the /Src/DataTypes directory
00209 * - Removed challenge related source code
00210 * - Removed processing of incoming audio data
00211 * - Renamed AcousticMessage to SoundRequest
00212 *
00213 * Revision 1.4  2002/09/03 16:00:50  juengel
00214 * HeadControlMode follwTail, TailMode stayAsForced.
00215 *
00216 * Revision 1.3  2002/07/23 13:33:42  loetzsch
00217 * new streaming classes
00218 *
00219 * removed many #include statements
00220 *
00221 * Revision 1.2  2002/06/04 16:44:55  risler
00222 * tailRequest added
00223 *
00224 * Revision 1.1.1.1  2002/05/10 12:40:15  cvsadm
00225 * Moved GT2002 Project from ute to tamara.
00226 *
00227 * Revision 1.13  2002/04/29 13:48:24  risler
00228 * added lastWalkType to WalkingEngine execute
00229 *
00230 * Revision 1.12  2002/04/26 13:35:33  risler
00231 * DarmstadtGOWalkingEngine renamed to InvKinWalkingEngine
00232 * added InvKinParameterSets
00233 *
00234 * Revision 1.11  2002/04/25 14:50:36  kallnik
00235 * changed double/float to double
00236 * added several #include GTMath
00237 *
00238 * PLEASE use double
00239 *
00240 * Revision 1.10  2002/04/04 15:14:40  jhoffman
00241 * added motion stabilizer
00242 *
00243 * Revision 1.9  2002/04/04 15:07:59  rentmeister
00244 * Walk with Ball hinzugefügt
00245 *
00246 * Revision 1.8  2002/04/03 16:44:31  jhoffman
00247 * added "stabilizeRobot" to motionControl (which is turned off as a default)
00248 *
00249 * Revision 1.7  2002/02/28 16:28:25  risler
00250 * added GT2001WalkingParameters
00251 *
00252 * Revision 1.6  2002/02/20 16:40:50  risler
00253 * added GetupEngine
00254 *
00255 * Revision 1.5  2002/02/08 17:48:57  risler
00256 * SensorData to MotionControl
00257 *
00258 * Revision 1.4  2002/01/19 12:42:32  risler
00259 * fixed bug with solutionHandler
00260 *
00261 * Revision 1.3  2001/12/10 17:47:06  risler
00262 * change log added
00263 *
00264 */

Generated on Thu Sep 23 19:57:31 2004 for GT2004 by doxygen 1.3.6