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

# Modules/BehaviorControl/CommonXabsl2BasicBehaviors/CommonBasicBehaviors.h

Go to the documentation of this file.

    00001 /**
    00002 * @file CommonBasicBehaviors.h
    00003 *
    00004 * Declaration of basic behaviors defined in common-basic-behaviors.xml.
    00005 *
    00006 * @author Martin Lötzsch
    00007 * @author Uwe Düffert
    00008 * @author Matthias Jüngel
    00009 * @author Max Risler
    00010 */
    00011
    00012 #ifndef __CommonBasicBehaviors_h_
    00013 #define __CommonBasicBehaviors_h_
    00014
    00015 #include "../BehaviorControl.h"
    00016 #include "Tools/Xabsl2/Xabsl2Engine/Xabsl2Engine.h"
    00017 #include "Tools/Actorics/WalkAccelerationRestrictor.h"
    00018
    00019 /**
    00020 * A Basic Behavior for shutdown. This is e.g. usefull after special action pack.
    00021 * @author Uwe Düffert
    00022 */
    00023 class BasicBehaviorShutdown : public Xabsl2BasicBehavior, public BehaviorControlInterfaces
    00024 {
    00025 public:
    00026 /*
    00027 * Constructor.
    00028 * @param errorHandler Is invoked when errors occur
    00029 * @param interfaces The paramters of the BehaviorControl module.
    00030   */
    00031   BasicBehaviorShutdown(const BehaviorControlInterfaces& interfaces,
    00032     Xabsl2ErrorHandler& errorHandler)
    00033     : Xabsl2BasicBehavior("shutdown", errorHandler),
    00034     BehaviorControlInterfaces(interfaces)
    00035   {}
    00036
    00037   /**  Executes the basic behavior. */
    00038   virtual void execute();
    00039 };
    00040
    00041
    00042 /**
    00043 * A Basic Behavior for doing nothing. The motion request is not changed.
    00044 * @author Martin Lötzsch
    00045 */
    00046 class BasicBehaviorDoNothing : public Xabsl2BasicBehavior, public BehaviorControlInterfaces
    00047 {
    00048 public:
    00049 /*
    00050 * Constructor.
    00051 * @param errorHandler Is invoked when errors occur
    00052 * @param interfaces The paramters of the BehaviorControl module.
    00053   */
    00054   BasicBehaviorDoNothing(const BehaviorControlInterfaces& interfaces,
    00055     Xabsl2ErrorHandler& errorHandler)
    00056     : Xabsl2BasicBehavior("do-nothing", errorHandler),
    00057     BehaviorControlInterfaces(interfaces)
    00058   {}
    00059
    00060   /**  Executes the basic behavior. */
    00061   virtual void execute();
    00062 };
    00063
    00064 /**
    00065 * A Basic Behavior for walking
    00066 * @author Matthias Jüngel
    00067 * @author Martin Lötzsch
    00068 * @author Max Risler
    00069 */
    00070 class BasicBehaviorWalk : public Xabsl2BasicBehavior, public BehaviorControlInterfaces
    00071 {
    00072 public:
    00073 /*
    00074 * Constructor.
    00075 * @param errorHandler Is invoked when errors occur
    00076 * @param interfaces The paramters of the BehaviorControl module.
    00077   */
    00078   BasicBehaviorWalk(const BehaviorControlInterfaces& interfaces,
    00079     Xabsl2ErrorHandler& errorHandler)
    00080     : Xabsl2BasicBehavior("walk", errorHandler),
    00081     BehaviorControlInterfaces(interfaces)
    00082   {
    00083     registerParameter("walk.type", type);
    00084     registerParameter("walk.speed-x", speedX);
    00085     registerParameter("walk.speed-y", speedY);
    00086     registerParameter("walk.rotation-speed", rotationSpeed);
    00087   }
    00088
    00089   /**  Executes the basic behavior. */
    00090   virtual void execute();
    00091
    00092 private:
    00093   /** Parameter "walk.type" */
    00094   double type;
    00095
    00096   /** Parameter "walk.speed-x" */
    00097   double speedX;
    00098
    00099   /** Parameter "walk.speed-y" */
    00100   double speedY;
    00101
    00102   /** Parameter "walk.rotation-speed" */
    00103   double rotationSpeed;
    00104 };
    00105
    00106 /**
    00107 * A Basic Behavior for special actions like kicks.
    00108 * @author Matthias Jüngel
    00109 * @author Martin Lötzsch
    00110 * @author Max Risler
    00111 */
    00112 class BasicBehaviorSpecialAction : public Xabsl2BasicBehavior, public BehaviorControlInterfaces
    00113 {
    00114 public:
    00115 /*
    00116 * Constructor.
    00117 * @param errorHandler Is invoked when errors occur
    00118 * @param interfaces The paramters of the BehaviorControl module.
    00119   */
    00120   BasicBehaviorSpecialAction(const BehaviorControlInterfaces& interfaces,
    00121     Xabsl2ErrorHandler& errorHandler)
    00122     : Xabsl2BasicBehavior("special-action", errorHandler),
    00123     BehaviorControlInterfaces(interfaces)
    00124   {
    00125     registerParameter("special-action-id", specialActionID);
    00126   }
    00127
    00128   /**  Executes the basic behavior. */
    00129   virtual void execute();
    00130
    00131 private:
    00132   /** Parameter "special-action-id" */
    00133   double specialActionID;
    00134 };
    00135
    00136
    00137 /**
    00138 * A Basic Behavior for standing around.
    00139 * If the robot previously walked, it is slowed down first.
    00140 * @author Martin Lötzsch
    00141 */
    00142 class BasicBehaviorStand : public Xabsl2BasicBehavior, public BehaviorControlInterfaces
    00143 {
    00144 public:
    00145 /*
    00146 * Constructor.
    00147 * @param errorHandler Is invoked when errors occur
    00148 * @param interfaces The paramters of the BehaviorControl module.
    00149   */
    00150   BasicBehaviorStand(const BehaviorControlInterfaces& interfaces,
    00151     Xabsl2ErrorHandler& errorHandler)
    00152     : Xabsl2BasicBehavior("stand", errorHandler),
    00153     BehaviorControlInterfaces(interfaces),
    00154     accelerationRestrictor(motionRequest)
    00155   {
    00156   }
    00157
    00158   /**  Executes the basic behavior. */
    00159   virtual void execute();
    00160
    00161 private:
    00162   /** Restricts the walk acceleration to maximum values */
    00163   WalkAccelerationRestrictor accelerationRestrictor;
    00164 };
    00165
    00166 /**
    00167 * A Basic Behavior for playing dead robot.
    00168 * @author Michael Spranger
    00169 */
    00170 class BasicBehaviorPlayDead : public Xabsl2BasicBehavior, public BehaviorControlInterfaces
    00171 {
    00172 public:
    00173 /*
    00174 * Constructor.
    00175 * @param errorHandler Is invoked when errors occur
    00176 * @param interfaces The parameters of the BehaviorControl module.
    00177   */
    00178   BasicBehaviorPlayDead(const BehaviorControlInterfaces& interfaces,
    00179     Xabsl2ErrorHandler& errorHandler)
    00180     :Xabsl2BasicBehavior("play-dead", errorHandler),
    00181     BehaviorControlInterfaces(interfaces)
    00182   {}
    00183
    00184   /**  Executes the basic behavior. */
    00185   virtual void execute();
    00186 };
    00187
    00188
    00189
    00190 /**
    00191 * @class CommonBasicBehaviors
    00192 *
    00193 * Creates and registers simple basic behaviors
    00194 */
    00195 class CommonBasicBehaviors : public BehaviorControlInterfaces
    00196 {
    00197 public:
    00198 /**
    00199 * Constructor
    00200   */
    00201   CommonBasicBehaviors(const BehaviorControlInterfaces& interfaces,
    00202     Xabsl2ErrorHandler& errorHandler)
    00203     : BehaviorControlInterfaces(interfaces),
    00204     errorHandler(errorHandler),
    00205     basicBehaviorDoNothing(interfaces,errorHandler),
    00206     basicBehaviorPlayDead(interfaces,errorHandler),
    00207     basicBehaviorShutdown(interfaces,errorHandler),
    00208     basicBehaviorSpecialAction(interfaces,errorHandler),
    00209     basicBehaviorStand(interfaces,errorHandler),
    00210     basicBehaviorWalk(interfaces,errorHandler)
    00211   {}
    00212
    00213   /** Registers basic behaviors at the engine */
    00214   void registerBasicBehaviors(Xabsl2Engine& engine);
    00215
    00216 private:
    00217   /** Is invoked when errors occurs */
    00218   Xabsl2ErrorHandler& errorHandler;
    00219
    00220   //!@name Basic Behaviors
    00221   //!@{
    00222   BasicBehaviorDoNothing  basicBehaviorDoNothing;
    00223   BasicBehaviorPlayDead basicBehaviorPlayDead;
    00224   BasicBehaviorShutdown  basicBehaviorShutdown;
    00225   BasicBehaviorSpecialAction  basicBehaviorSpecialAction;
    00226   BasicBehaviorStand  basicBehaviorStand;
    00227   BasicBehaviorWalk  basicBehaviorWalk;
    00228   //!@}
    00229 };
    00230
    00231 #endif // __CommonBasicBehaviors_h_
    00232