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

# Modules/MotionControl/GT2005MotionControl.h

Go to the documentation of this file.

    00001 /**
    00002 * @file GT2005MotionControl.h
    00003 *
    00004 * Definition of class GT2005MotionControl
    00005 */
    00006
    00007 #ifndef __GT2005MotionControl_h_
    00008 #define __GT2005MotionControl_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 GT2005MotionControl
    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 GT2005MotionControl : 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   GT2005MotionControl(ModuleHandler& moduleHandler,
    00040     const MotionControlInterfaces& interfaces);
    00041
    00042   /** Destructor */
    00043   ~GT2005MotionControl();
    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// __GT2005MotionControl_h_