00001 /** 00002 * @file Xabsl2BehaviorControl.h 00003 * 00004 * Implementation of class Xabsl2BehaviorControl. 00005 * 00006 * @author Matthias Jüngel 00007 * @author Martin Lötzsch 00008 */ 00009 00010 #ifndef __Xabsl2BehaviorControl_h_ 00011 #define __Xabsl2BehaviorControl_h_ 00012 00013 #include "BehaviorControl.h" 00014 #include "Tools/Xabsl2/GT/GTXabsl2EngineExecutor.h" 00015 00016 00017 /** 00018 * @class Xabsl2BehaviorControl 00019 * 00020 * Base class for all BehaviorControl solutions that use a Xabsl2Engine 00021 * 00022 * @author Matthias Jüngel 00023 * @author Martin Lötzsch 00024 */ 00025 class Xabsl2BehaviorControl : public BehaviorControl, public GTXabsl2EngineExecutor 00026 { 00027 public: 00028 /** 00029 * Constructor. 00030 * @param interfaces The paramters of the BehaviorControl module. 00031 * @param id The id of the Xabsl2Engine. 00032 */ 00033 Xabsl2BehaviorControl(const BehaviorControlInterfaces& interfaces, 00034 SolutionRequest::xabsl2EngineID id); 00035 00036 /** destructor */ 00037 ~Xabsl2BehaviorControl() {}; 00038 00039 /** 00040 * Is called for every incoming debug message. 00041 * @param message An interface to read the message from the queue 00042 * @return if the messag was read 00043 */ 00044 virtual bool handleMessage(InMessage& message); 00045 00046 protected: 00047 00048 /** Is called if the engine could not be created */ 00049 virtual void executeIfEngineCouldNotBeCreated(); 00050 00051 /** 00052 * Prints the main action that was generated by the execution of the engine to a string 00053 * @param buf the string where to print the action 00054 */ 00055 virtual void printGeneratedMainActionToString(char* buf); 00056 00057 }; 00058 00059 /** 00060 * Allows to register the same Xabsl2BehaviorControl instance more than once 00061 * at a ModuleHandler to be able to switch between different agents using the 00062 * GT Module mechanism. 00063 */ 00064 class Xabsl2BehaviorControlAgentInterface : public BehaviorControl, public Xabsl2NamedItem 00065 { 00066 public: 00067 /** 00068 * Constructor 00069 * @param name The name of the agent 00070 * @param behaviorControl A newly created Xabsl2BehaviorControl can contains the agent. 00071 * @param interfaces The paramters of the BehaviorControl module. 00072 */ 00073 Xabsl2BehaviorControlAgentInterface(const char* name, 00074 Xabsl2BehaviorControl* behaviorControl, 00075 const BehaviorControlInterfaces& interfaces); 00076 00077 /** Destructor. Deletes the Xabsl2BehaviorControl */ 00078 ~Xabsl2BehaviorControlAgentInterface(); 00079 00080 /** Executes the agent */ 00081 virtual void execute(); 00082 00083 /** 00084 * Is called for every incoming debug message. 00085 * @param message An interface to read the message from the queue 00086 * @return if the messag was read 00087 */ 00088 virtual bool handleMessage(InMessage& message); 00089 00090 private: 00091 /** A pointer to the Xabsl2BehaviorControl can contains the agent. */ 00092 Xabsl2BehaviorControl* behaviorControl; 00093 }; 00094 00095 #endif// __Xabsl2BehaviorControl_h_ 00096 00097 /* 00098 * Change log : 00099 * 00100 * $Log: Xabsl2BehaviorControl.h,v $ 00101 * Revision 1.1.1.1 2004/05/22 17:15:31 cvsadm 00102 * created new repository GT2004_WM 00103 * 00104 * Revision 1.7 2004/05/14 11:37:08 loetzsch 00105 * support for multiple xabsl2engines in different modules 00106 * preliminary GT2004HeadControl (does not work at all) 00107 * 00108 * Revision 1.6 2004/03/08 00:58:53 roefer 00109 * Interfaces should be const 00110 * 00111 * Revision 1.5 2004/01/21 14:31:58 loetzsch 00112 * Module Selectors create only the selected solution. 00113 * When the solution changes, the old solution is erased and the new 00114 * one ist created using createSolution(..) 00115 * 00116 * Revision 1.4 2003/11/17 15:14:49 dueffert 00117 * doxygen docu corrected 00118 * 00119 * Revision 1.3 2003/10/26 22:49:34 loetzsch 00120 * created ATH2004BehaviorControl from GT2003BehaviorControl 00121 * - strongly simplified option graph 00122 * - moved some symbols from GT2003 to CommonXabsl2Symbols 00123 * - moved some basic behaviors from GT2003 to CommonXabsl2BasicBehaviors 00124 * 00125 * cloned ATH2004 three times (BB2004, DDD2004, MSH2004) 00126 * 00127 * Revision 1.2 2003/09/30 10:51:13 dueffert 00128 * typos fixed 00129 * 00130 * Revision 1.1 2003/07/21 19:18:05 loetzsch 00131 * - Xabsl2 AND and OR operators now can contain more than 2 operands 00132 * - speed improvements and cleanup 00133 * 00134 * Revision 1.1.1.1 2003/07/02 09:40:23 cvsadm 00135 * created new repository for the competitions in Padova from the 00136 * tamara CVS (Tuesday 2:00 pm) 00137 * 00138 * removed unused solutions 00139 * 00140 * Revision 1.9 2003/01/28 18:07:47 loetzsch 00141 * no message 00142 * 00143 * Revision 1.8 2003/01/22 18:09:23 loetzsch 00144 * continued implementation of sending of intermediate code from xabsl2 dialog 00145 * to a xabsl2 behavior control 00146 * 00147 * Revision 1.7 2003/01/21 20:36:14 loetzsch 00148 * xabsl2 intermediate code now can be handled by Xabsl2BehaviorControl 00149 * 00150 * Revision 1.6 2003/01/20 08:14:16 loetzsch 00151 * added xabsl2BehaviorControlID to the solutionRequest to distinct between the 00152 * different Xabsl2BehaviorControls 00153 * 00154 * Revision 1.5 2003/01/19 13:04:51 loetzsch 00155 * xabsl2 agents now can be changed by using the Module and SolutionRequest 00156 * mechanism 00157 * 00158 * Revision 1.4 2003/01/12 14:54:04 loetzsch 00159 * continued creation of option tree: Xabsl2Statement and derivates added 00160 * 00161 * Revision 1.3 2003/01/09 10:01:20 loetzsch 00162 * added interfaces to the Xabsl2 Dialog in the RobotControl application 00163 * 00164 * Revision 1.2 2003/01/08 15:22:33 loetzsch 00165 * - started implementation of the option tree 00166 * - started the reading of the intermediate code 00167 * 00168 * Revision 1.1 2002/12/18 11:02:02 loetzsch 00169 * - moved common parts of Humboldt2003BehaviorControl to new base class Xabsl2BehaviorControl 00170 * - Xabsl2BehaviorControl shall become the base class for all BehaviorControl solutions based on the Xabsl2Engine 00171 * 00172 */