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

# Modules/SpecialActions/SpecialActions.h

Go to the documentation of this file.

    00001 /**
    00002 * @file SpecialActions.h
    00003 *
    00004 * This file contains a generic class for SpecialActions.
    00005 */
    00006
    00007 #ifndef __SpecialActions_h_
    00008 #define __SpecialActions_h_
    00009
    00010 #include "Tools/Module/Module.h"
    00011
    00012 #include "Representations/Motion/JointData.h"
    00013 #include "Representations/Motion/PIDData.h"
    00014 #include "Representations/Motion/OdometryData.h"
    00015 #include "Representations/Motion/MotionInfo.h"
    00016
    00017 /**
    00018 * @class SpecialActionsInterfaces
    00019 *
    00020 * Interfaces of the SpecialAction module.
    00021 */
    00022 class SpecialActionsInterfaces
    00023 {
    00024 public:
    00025   /** Constructor */
    00026   SpecialActionsInterfaces(
    00027     const MotionRequest& motionRequest,
    00028     MotionRequest::MotionID& lastMotionType,
    00029     PIDData& pidData,
    00030     OdometryData& odometryData,
    00031     MotionInfo& motionInfo)
    00032     : motionRequest(motionRequest),
    00033     lastMotionType(lastMotionType),
    00034     lastWalkType(lastWalkType),
    00035     pidData(pidData),
    00036     odometryData(odometryData),
    00037     motionInfo(motionInfo)
    00038   {}
    00039
    00040 protected:
    00041   /** The current motion request */
    00042   const MotionRequest& motionRequest;
    00043
    00044   /** The motion type of the previous frame */
    00045   MotionRequest::MotionID& lastMotionType;
    00046
    00047   /** The walk type of the previous frame */
    00048   WalkRequest::WalkType& lastWalkType;
    00049
    00050   /** The current PID servo gains */
    00051   PIDData& pidData;
    00052
    00053   /** Has to be incremented by the walking engine */
    00054   OdometryData& odometryData;
    00055
    00056   /** The neck height and the body tilt to be estimated by the walking engine */
    00057   MotionInfo& motionInfo;
    00058 };
    00059
    00060 /**
    00061 * A generic class for SpecialActions.
    00062 *
    00063 * It generates JointData and OdometryData according to current MotionRequest
    00064 * executing special actions.
    00065 */
    00066 class SpecialActions : public Module, public SpecialActionsInterfaces
    00067 {
    00068 public:
    00069 /*
    00070 * Constructor.
    00071 * @param interfaces The paramters of the SpecialActions module.
    00072   */
    00073   SpecialActions(const SpecialActionsInterfaces& interfaces)
    00074     : SpecialActionsInterfaces(interfaces)
    00075   {}
    00076
    00077   /**
    00078   * Executes the requested special action
    00079   * @param specialActionRequest The special action to be executed
    00080   * @param jointData stores calculated frame
    00081   * @return true if next set should be calculated by SpecialActions
    00082   *         false if change to other module can occur
    00083   */
    00084   virtual bool executeParameterized(SpecialActionRequest specialActionRequest, JointData& jointData) = 0;
    00085
    00086   /*
    00087    *  Determines wether or not a Specialaction can be executed in current phase of Walking cycle
    00088    *  @param specialActionID SpecialActionID for Specialaction that information for is needed
    00089    *  @return wether the Specialaction can be executed in current Walkingcycle
    00090    */
    00091   virtual bool specialActionIsExecutableInWalkingCycle(int specialActionID, double walkCycle)=0;
    00092
    00093   /** Destructor */
    00094   virtual ~SpecialActions() {}
    00095
    00096 private:
    00097   /** That function is not used but has to be implemented */
    00098   virtual void execute() {};
    00099 };
    00100
    00101 #endif //__SpecialActions_h_