00001 /** 00002 * @file Xabsl2BehaviorControl.cpp 00003 * 00004 * Implementation of class Xabsl2BehaviorControl. 00005 * 00006 * @author Uwe Düffert 00007 * @author Jan Hoffmann 00008 * @author Matthias Jüngel 00009 * @author Martin Lötzsch 00010 */ 00011 00012 #include "Xabsl2BehaviorControl.h" 00013 #include "Platform/GTAssert.h" 00014 00015 Xabsl2BehaviorControl::Xabsl2BehaviorControl 00016 (const BehaviorControlInterfaces& interfaces, 00017 SolutionRequest::xabsl2EngineID id 00018 ) : 00019 BehaviorControl(interfaces), 00020 GTXabsl2EngineExecutor(id,SolutionRequest::behaviorControl,robotPose.frameNumber) 00021 { 00022 } 00023 00024 void Xabsl2BehaviorControl::executeIfEngineCouldNotBeCreated() 00025 { 00026 motionRequest.motionType = MotionRequest::specialAction; 00027 motionRequest.specialActionRequest.specialActionType = SpecialActionRequest::demoScratchHead; 00028 } 00029 00030 void Xabsl2BehaviorControl::printGeneratedMainActionToString(char* buf) 00031 { 00032 motionRequest.printOut(buf); 00033 } 00034 00035 bool Xabsl2BehaviorControl::handleMessage(InMessage& message) 00036 { 00037 return GTXabsl2EngineExecutor::handleMessage(message); 00038 } 00039 00040 Xabsl2BehaviorControlAgentInterface::Xabsl2BehaviorControlAgentInterface 00041 (const char* name, 00042 Xabsl2BehaviorControl* behaviorControl, 00043 const BehaviorControlInterfaces& interfaces 00044 ) : 00045 BehaviorControl(interfaces), Xabsl2NamedItem(name), behaviorControl(behaviorControl) 00046 { 00047 ASSERT(behaviorControl != 0); 00048 } 00049 00050 Xabsl2BehaviorControlAgentInterface::~Xabsl2BehaviorControlAgentInterface() 00051 { 00052 if (behaviorControl != 0) delete behaviorControl; 00053 } 00054 00055 void Xabsl2BehaviorControlAgentInterface::execute() 00056 { 00057 ASSERT(behaviorControl != 0); 00058 behaviorControl->setSelectedAgent(n); 00059 behaviorControl->execute(); 00060 } 00061 00062 bool Xabsl2BehaviorControlAgentInterface::handleMessage(InMessage& message) 00063 { 00064 ASSERT(behaviorControl != 0); 00065 return behaviorControl->handleMessage(message); 00066 } 00067 00068 /* 00069 * Change log : 00070 * 00071 * $Log: Xabsl2BehaviorControl.cpp,v $ 00072 * Revision 1.7 2004/06/02 17:18:24 spranger 00073 * MotionRequest cleanup 00074 * 00075 * Revision 1.6 2004/05/27 18:42:49 loetzsch 00076 * prints the motion request instead of executedMotionRequest as main action 00077 * 00078 * Revision 1.5 2004/05/27 13:36:49 goehring 00079 * bugfix 00080 * 00081 * Revision 1.4 2004/05/27 13:10:11 goehring 00082 * some specialActions removed 00083 * 00084 * Revision 1.3 2004/05/26 18:56:41 loetzsch 00085 * clean up in the behavior control interfaces 00086 * 00087 * Revision 1.2 2004/05/23 18:58:20 spranger 00088 * added framenumber to HeadControl interface, GTXabsl2EngineExecutor and following 00089 * 00090 * Revision 1.1.1.1 2004/05/22 17:15:30 cvsadm 00091 * created new repository GT2004_WM 00092 * 00093 * Revision 1.11 2004/05/17 18:35:22 loetzsch 00094 * continued support for multiple Xabsl engines in different modules 00095 * 00096 * Revision 1.10 2004/05/14 11:37:08 loetzsch 00097 * support for multiple xabsl2engines in different modules 00098 * preliminary GT2004HeadControl (does not work at all) 00099 * 00100 * Revision 1.9 2004/03/08 00:58:52 roefer 00101 * Interfaces should be const 00102 * 00103 * Revision 1.8 2004/01/21 14:31:58 loetzsch 00104 * Module Selectors create only the selected solution. 00105 * When the solution changes, the old solution is erased and the new 00106 * one ist created using createSolution(..) 00107 * 00108 * Revision 1.7 2003/12/16 18:54:06 loetzsch 00109 * the message "created a new engine ......" is only displayed when no errors occured 00110 * 00111 * Revision 1.6 2003/10/26 22:49:34 loetzsch 00112 * created ATH2004BehaviorControl from GT2003BehaviorControl 00113 * - strongly simplified option graph 00114 * - moved some symbols from GT2003 to CommonXabsl2Symbols 00115 * - moved some basic behaviors from GT2003 to CommonXabsl2BasicBehaviors 00116 * 00117 * cloned ATH2004 three times (BB2004, DDD2004, MSH2004) 00118 * 00119 * Revision 1.5 2003/10/08 11:50:09 loetzsch 00120 * made the Xabsl2Engine really platform independent 00121 * (removed inclusion of Platform/SystemCall.h) 00122 * A time function is given to the engine by parameter. 00123 * 00124 * Revision 1.4 2003/09/30 10:51:13 dueffert 00125 * typos fixed 00126 * 00127 * Revision 1.3 2003/09/20 16:34:13 loetzsch 00128 * renamed "following-option-..." to "subsequent-option-.." and 00129 * "following-basic-behavior-.." to "subsequent-basic-behavior-.." 00130 * for consistency with publications 00131 * 00132 * Revision 1.2 2003/09/16 13:27:20 loetzsch 00133 * changed all occurrences of "option tree" to "option graph" 00134 * 00135 * Revision 1.1 2003/07/21 19:18:05 loetzsch 00136 * - Xabsl2 AND and OR operators now can contain more than 2 operands 00137 * - speed improvements and cleanup 00138 * 00139 * Revision 1.1.1.1 2003/07/02 09:40:23 cvsadm 00140 * created new repository for the competitions in Padova from the 00141 * tamara CVS (Tuesday 2:00 pm) 00142 * 00143 * removed unused solutions 00144 * 00145 * Revision 1.31 2003/06/20 15:32:32 dueffert 00146 * getting from down from wall by rolling added 00147 * 00148 * Revision 1.30 2003/05/25 22:36:32 loetzsch 00149 * only when an output symbol was set during the execution of the graph, 00150 * coresponding function is invoked or the coresponding variable is changed. 00151 * 00152 * Revision 1.29 2003/03/31 17:42:03 risler 00153 * no message 00154 * 00155 * Revision 1.28 2003/03/06 11:45:30 dueffert 00156 * re-order warning removed 00157 * 00158 * Revision 1.27 2003/03/03 11:56:48 dueffert 00159 * getup if crashed improved 00160 * 00161 * Revision 1.26 2003/03/03 10:45:15 dueffert 00162 * getup if crashed added 00163 * 00164 * Revision 1.25 2003/02/27 15:23:58 juengel 00165 * Debug messages are only sent, if the debug key sendXabsl2DebugMessages is active. 00166 * 00167 * Revision 1.24 2003/02/01 14:41:10 risler 00168 * missing input source was not detected correctly 00169 * 00170 * Revision 1.23 2003/01/29 11:53:47 loetzsch 00171 * Added setting of changed output symbols in handleMessage 00172 * 00173 * Revision 1.22 2003/01/29 10:36:07 juengel 00174 * Xabsl2Dialog sends the selected option/basic behavior, the parameters, 00175 * and the output symbols to be changed. 00176 * 00177 * Revision 1.21 2003/01/28 18:07:47 loetzsch 00178 * no message 00179 * 00180 * Revision 1.20 2003/01/28 17:38:22 loetzsch 00181 * executeRootOption is called for debug mode executeRootOption. 00182 * 00183 * Revision 1.19 2003/01/22 18:09:23 loetzsch 00184 * continued implementation of sending of intermediate code from xabsl2 dialog 00185 * to a xabsl2 behavior control 00186 * 00187 * Revision 1.18 2003/01/21 21:02:09 loetzsch 00188 * xabsl2 intermediate code now can be handled by Xabsl2BehaviorControl 00189 * 00190 * Revision 1.17 2003/01/21 20:36:14 loetzsch 00191 * xabsl2 intermediate code now can be handled by Xabsl2BehaviorControl 00192 * 00193 * Revision 1.16 2003/01/20 08:14:16 loetzsch 00194 * added xabsl2BehaviorControlID to the solutionRequest to distinct between the 00195 * different Xabsl2BehaviorControls 00196 * 00197 * Revision 1.15 2003/01/19 13:04:51 loetzsch 00198 * xabsl2 agents now can be changed by using the Module and SolutionRequest 00199 * mechanism 00200 * 00201 * Revision 1.14 2003/01/18 21:46:11 loetzsch 00202 * fixed a bug in sendDebugMessage 00203 * 00204 * Revision 1.13 2003/01/15 14:53:50 juengel 00205 * Watched enumerated input symbols and watched output symbols are sent. 00206 * 00207 * Revision 1.12 2003/01/13 22:39:38 loetzsch 00208 * implemented the execution of the engine. 00209 * 00210 * Revision 1.11 2003/01/13 18:28:01 juengel 00211 * Option parameters are sent. 00212 * 00213 * Revision 1.10 2003/01/13 10:31:43 juengel 00214 * XabslDebugMessage extended. Xabsl2Dialog shows option activation path. 00215 * 00216 * Revision 1.9 2003/01/12 14:54:05 loetzsch 00217 * continued creation of option tree: Xabsl2Statement and derivates added 00218 * 00219 * Revision 1.8 2003/01/11 21:58:11 roefer 00220 * Unused variables removed 00221 * 00222 * Revision 1.7 2003/01/11 18:38:38 juengel 00223 * Xabsl2ehavior sends Xabsl2DebugMessages now. 00224 * 00225 * Revision 1.6 2003/01/11 14:41:42 loetzsch 00226 * continued creation of the option tree 00227 * 00228 * Revision 1.5 2003/01/11 13:29:55 juengel 00229 * Xabsl2Dialog sends Xabsl2DebugRequest now. 00230 * 00231 * Revision 1.4 2003/01/09 17:28:33 loetzsch 00232 * introduced Xabsl2Agent, continued Xabsl2Option 00233 * 00234 * Revision 1.3 2003/01/09 10:01:20 loetzsch 00235 * added interfaces to the Xabsl2 Dialog in the RobotControl application 00236 * 00237 * Revision 1.2 2003/01/08 15:22:34 loetzsch 00238 * - started implementation of the option tree 00239 * - started the reading of the intermediate code 00240 * 00241 * Revision 1.1 2002/12/18 11:02:02 loetzsch 00242 * - moved common parts of Humboldt2003BehaviorControl to new base class Xabsl2BehaviorControl 00243 * - Xabsl2BehaviorControl shall become the base class for all BehaviorControl solutions based on the Xabsl2Engine 00244 * 00245 */ 00246