00001 /** 00002 * @file GT2003MotionNetSpecialActions.h 00003 * 00004 * This file contains a class for GT2003 motion net special actions. 00005 * @author Uwe Düffert, Max Risler 00006 */ 00007 00008 #ifndef __GT2003MotionNetSpecialActions_h_ 00009 #define __GT2003MotionNetSpecialActions_h_ 00010 00011 #include "../SpecialActions.h" 00012 #include "MotionNetData.h" 00013 00014 /** 00015 * This module executes special actions by using the GT2003 00016 * motion net compiler 00017 */ 00018 class GT2003MotionNetSpecialActions : public SpecialActions 00019 { 00020 public: 00021 /* 00022 * Constructor. 00023 * @param interfaces The paramters of the SpecialActions module. 00024 */ 00025 GT2003MotionNetSpecialActions(SpecialActionsInterfaces& interfaces); 00026 00027 /** Executes the special action */ 00028 virtual bool executeParameterized(SpecialActionRequest specialActionRequest, JointData& jointData); 00029 00030 /* 00031 * Determines wether or not a Specialaction can be executed in current phase of Walking cycle 00032 * @param specialActionID SpecialActionID for Specialaction that information for is needed 00033 * @return wether the Specialaction can be executed in current Walkingcycle 00034 */ 00035 virtual bool specialActionIsExecutableInWalkingCycle(int specialActionID, double walkCycle); 00036 00037 /** 00038 * Called from a MessageQueue to distribute messages. 00039 * @param message The message that can be read. 00040 * @return true if the message was read (handled). 00041 */ 00042 virtual bool handleMessage(InMessage& message); 00043 00044 protected: 00045 /** Get motion net motion index from motion type and special action id */ 00046 int getMotionIndex(MotionRequest::MotionID motionType, SpecialActionRequest::SpecialActionID specialActionType); 00047 00048 /** Get motion net motion index from a MotionRequest */ 00049 int getMotionIndex(const SpecialActionRequest& request); 00050 00051 /** Get next motion node from motion net */ 00052 bool getNextData(const SpecialActionRequest& specialActionRequest); 00053 00054 /** Calculates the next joint data vector by interpolating if necessary */ 00055 void calculateJointData(JointData& jointData); 00056 00057 /** The motion data array */ 00058 MotionNetData motionNetData; 00059 00060 /** Current motion net node */ 00061 short currentNode; 00062 00063 //! Current joint data 00064 JointData currentData; 00065 //! Last data for interpolation 00066 JointData lastData; 00067 00068 //! Last data was set 00069 bool lastDataValid; 00070 //! True if values should be interpolated 00071 bool interpolationMode; 00072 00073 //! Length of current data line in cycles 00074 long dataRepetitionLength; 00075 //! Cycle counter for current data line 00076 long dataRepetitionCounter; 00077 00078 /** Odometry table entry 00079 * Contains type of odometry and odometry pose 00080 */ 00081 class OdometryEntry { 00082 public: 00083 /** Enum for odometry types 00084 * none: No odometry, means no movement 00085 * once: Odometry pose is used once the motion is executed 00086 * homegeneous: Odometry pose describes speed and is used each tick 00087 */ 00088 enum OdometryType { 00089 none, 00090 once, 00091 homogeneous 00092 }; 00093 00094 OdometryType type; 00095 OdometryData o; 00096 OdometryEntry() : type(none) {}; 00097 }; 00098 00099 /** Odometry data table 00100 * Contains one entry for each motion 00101 * describing robot movement per tick. 00102 */ 00103 OdometryEntry odometryTable[SpecialActionRequest::numOfSpecialAction + 1]; 00104 00105 /** Head states for each special action */ 00106 MotionInfo motionInfoTable[SpecialActionRequest::numOfSpecialAction + 1]; 00107 00108 /** A table for the executed motion requests */ 00109 MotionRequest executedMotionRequestTable[SpecialActionRequest::numOfSpecialAction + 1]; 00110 00111 /** Odometry of current motion */ 00112 OdometryEntry currentOdometry; 00113 00114 /** Read odometry table from file */ 00115 void readOdometryTable(); 00116 00117 /** type of last executed special action */ 00118 SpecialActionRequest::SpecialActionID lastSpecialActionType; 00119 }; 00120 00121 #endif// __GT2003MotionNetSpecialActions_h_ 00122 00123 /* 00124 * Change log : 00125 * 00126 * $Log: GT2003MotionNetSpecialActions.h,v $ 00127 * Revision 1.5 2004/06/14 15:04:40 spranger 00128 * changed interface of executeParametrized 00129 * (this is not final, the specialActionRequest will be put into the interface) 00130 * 00131 * Revision 1.4 2004/06/02 17:18:23 spranger 00132 * MotionRequest cleanup 00133 * 00134 * Revision 1.3 2004/05/27 19:00:31 loetzsch 00135 * bug fix 00136 * 00137 * Revision 1.2 2004/05/26 17:21:47 dueffert 00138 * better data types used 00139 * 00140 * Revision 1.1.1.1 2004/05/22 17:21:31 cvsadm 00141 * created new repository GT2004_WM 00142 * 00143 * Revision 1.2 2003/12/16 19:01:18 loetzsch 00144 * The motion net is not compiled into a C++ file but parsed at run time. 00145 * 00146 * Revision 1.1 2003/10/06 14:10:12 cvsadm 00147 * Created GT2004 (M.J.) 00148 * 00149 * Revision 1.1.1.1 2003/07/02 09:40:24 cvsadm 00150 * created new repository for the competitions in Padova from the 00151 * tamara CVS (Tuesday 2:00 pm) 00152 * 00153 * removed unused solutions 00154 * 00155 * Revision 1.2 2003/06/21 14:55:06 risler 00156 * odometry only once per special action 00157 * 00158 * Revision 1.1 2003/03/10 14:14:08 dueffert 00159 * optimized MotionNet 00160 * 00161 * Revision 1.3 2003/03/06 12:06:50 dueffert 00162 * execute with parameters renamed to avoid inheritance warnings 00163 * 00164 * Revision 1.2 2002/09/17 23:55:22 loetzsch 00165 * - unraveled several datatypes 00166 * - changed the WATCH macro 00167 * - completed the process restructuring 00168 * 00169 * Revision 1.1 2002/09/10 15:36:16 cvsadm 00170 * Created new project GT2003 (M.L.) 00171 * - Cleaned up the /Src/DataTypes directory 00172 * - Removed challenge related source code 00173 * - Removed processing of incoming audio data 00174 * - Renamed AcousticMessage to SoundRequest 00175 * 00176 * Revision 1.2 2002/08/22 14:41:04 risler 00177 * added some doxygen comments 00178 * 00179 * Revision 1.1.1.1 2002/05/10 12:40:16 cvsadm 00180 * Moved GT2002 Project from ute to tamara. 00181 * 00182 * Revision 1.6 2002/05/05 15:14:23 risler 00183 * changed stand implementation 00184 * 00185 * Revision 1.5 2002/03/27 15:54:28 risler 00186 * added neckHeight and stableMotion in motion modules 00187 * 00188 * Revision 1.4 2001/12/18 14:02:06 risler 00189 * different odometry types in GT2001MotionNetSpecialActions 00190 * 00191 * Revision 1.3 2001/12/13 18:49:25 risler 00192 * added odometry updates in GT2001MotionNetSpecialActions 00193 * 00194 * Revision 1.2 2001/12/10 17:47:07 risler 00195 * change log added 00196 * 00197 */