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

Modules/BehaviorControl/GT2004BehaviorControl/GT2004BasicBehaviors/GT2004PotentialFieldBasicBehaviors.h

Go to the documentation of this file.
00001 /** 
00002 * @file GT2004PotentialFieldBasicBehaviors.h
00003 *
00004 * Declaration of basic behaviors defined in potential-field-basic-behaviors.xml.
00005 *
00006 * @author <a href="mailto:timlaue@tzi.de">Tim Laue</a>
00007 */
00008 
00009 #ifndef __GT2004PotentialFieldBasicBehaviors_h_
00010 #define __GT2004PotentialFieldBasicBehaviors_h_
00011 
00012 #include "Tools/Xabsl2/Xabsl2Engine/Xabsl2Engine.h"
00013 #include "Tools/PotentialFields/GTStandardConverter.h"
00014 #include "Modules/BehaviorControl/BehaviorControl.h"
00015 #include "Tools/Xabsl2/Xabsl2Engine/Xabsl2BasicBehavior.h"
00016 
00017 
00018 /**
00019 * An abstract base class for all potential field based basic behaviors
00020 *
00021 * @author Tim Laue
00022 */
00023 class GT2004PotentialFieldBasicBehavior : public Xabsl2BasicBehavior, 
00024                                           public BehaviorControlInterfaces
00025 {
00026 public:
00027 /*
00028 * Constructor.
00029 * @param errorHandler Is invoked when errors occur
00030 * @param interfaces The paramters of the BehaviorControl module.
00031   */
00032   GT2004PotentialFieldBasicBehavior(const BehaviorControlInterfaces& interfaces,
00033     Xabsl2ErrorHandler& errorHandler, const char* behaviorName, const char* pfcFileName):
00034             Xabsl2BasicBehavior(behaviorName, errorHandler),
00035             BehaviorControlInterfaces(interfaces)
00036   {
00037     potentialfields.load(pfcFileName);
00038   };
00039     
00040   /**  Executes the basic behavior. */
00041   virtual void execute() = 0;
00042 
00043 protected:
00044   /** An instance of the potential field architecture*/
00045   GTStandardConverter potentialfields;
00046   /** A standard instance of a result structure*/
00047   PotentialfieldResult result;
00048 };
00049 
00050 
00051 class GT2004PotentialFieldBasicBehaviorGoToPose : public GT2004PotentialFieldBasicBehavior
00052 {
00053 public:
00054   /*
00055 * Constructor.
00056 * @param errorHandler Is invoked when errors occur
00057 * @param interfaces The paramters of the BehaviorControl module.
00058   */
00059   GT2004PotentialFieldBasicBehaviorGoToPose(const BehaviorControlInterfaces& interfaces,
00060                                             Xabsl2ErrorHandler& errorHandler);
00061     
00062   /**  Executes the basic behavior. */
00063   virtual void execute();
00064 
00065 private:
00066   /** Parameter potential-field-go-to-pose.x*/
00067   double x;
00068   /** Parameter potential-field-go-to-pose.y*/
00069   double y;
00070   /** Parameter potential-field-go-to-pose.destination-angle*/
00071   double destinationAngle;
00072   /** Parameter potential-field-go-to-pose.max-speed*/
00073   double maxSpeed;
00074 };
00075 
00076 
00077 class GT2004PotentialFieldBasicBehaviorSupport : public GT2004PotentialFieldBasicBehavior
00078 {
00079 public:
00080   /*
00081 * Constructor.
00082 * @param errorHandler Is invoked when errors occur
00083 * @param interfaces The paramters of the BehaviorControl module.
00084   */
00085   GT2004PotentialFieldBasicBehaviorSupport(const BehaviorControlInterfaces& interfaces,
00086                                            Xabsl2ErrorHandler& errorHandler);
00087     
00088   /**  Executes the basic behavior. */
00089   virtual void execute();
00090 
00091 private:
00092   /** Parameter potential-field-support.x*/
00093   double x;
00094   /** Parameter potential-field-support.y*/
00095   double y;
00096   /** Parameter potential-field-support.max-speed*/
00097   double maxSpeed;
00098 };
00099 
00100 
00101 class GT2004PotentialFieldBasicBehaviorOffensiveSupport : public GT2004PotentialFieldBasicBehavior
00102 {
00103 public:
00104   /*
00105 * Constructor.
00106 * @param errorHandler Is invoked when errors occur
00107 * @param interfaces The paramters of the BehaviorControl module.
00108   */
00109   GT2004PotentialFieldBasicBehaviorOffensiveSupport(const BehaviorControlInterfaces& interfaces,
00110                                                     Xabsl2ErrorHandler& errorHandler);
00111     
00112   /**  Executes the basic behavior. */
00113   virtual void execute();
00114 
00115 private:
00116   /** Parameter potential-field-offensive-support.x*/
00117   double x;
00118   /** Parameter potential-field-offensive-support.y*/
00119   double y;
00120   /** Parameter potential-field-offensive-support.max-speed*/
00121   double maxSpeed;
00122 };
00123 
00124 
00125 /**
00126 * @class PotentialFieldBasicBehaviors
00127 *
00128 * Creates and registers potential field basic behaviors
00129 */
00130 class GT2004PotentialFieldBasicBehaviors : public BehaviorControlInterfaces
00131 {
00132 public:
00133   /**
00134   * Constructor
00135   */
00136   GT2004PotentialFieldBasicBehaviors(BehaviorControlInterfaces& interfaces,
00137     Xabsl2ErrorHandler& errorHandler):
00138   BehaviorControlInterfaces(interfaces),
00139   errorHandler(errorHandler),
00140   potentialFieldGoToPose(interfaces, errorHandler),
00141   potentialFieldSupport(interfaces, errorHandler),
00142   potentialFieldOffensiveSupport(interfaces, errorHandler)
00143   {}
00144 
00145   /** Registers basic behaviors at the engine */
00146   void registerBasicBehaviors(Xabsl2Engine& engine);
00147 
00148   /** updates some variables */
00149   void update();
00150 
00151 private:
00152   /** Is invoked when errors occurs */
00153   Xabsl2ErrorHandler& errorHandler;
00154 
00155   //!@name Basic Behaviors
00156   //!@{
00157   GT2004PotentialFieldBasicBehaviorGoToPose potentialFieldGoToPose;
00158   GT2004PotentialFieldBasicBehaviorSupport potentialFieldSupport;
00159   GT2004PotentialFieldBasicBehaviorOffensiveSupport potentialFieldOffensiveSupport;
00160   //!@}
00161 };
00162 
00163 #endif // __GT2004PotentialFieldBasicBehaviors_h_
00164 
00165 
00166 /*
00167 * $Log: GT2004PotentialFieldBasicBehaviors.h,v $
00168 * Revision 1.3  2004/06/17 16:18:38  tim
00169 * added potential field support behaviors
00170 *
00171 * Revision 1.2  2004/06/16 15:09:58  tim
00172 * added potential field support behavior
00173 *
00174 * Revision 1.1  2004/05/25 12:59:39  tim
00175 * added potential-field-go-to-pose
00176 *
00177 */

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