00001 /** 00002 * @file GT2003MotionNetSpecialActions/MotionNetNode.h 00003 * 00004 * Contains class MotionNetNode 00005 * 00006 * @author Uwe Düffert, Martin Lötzsch, Max Risler 00007 */ 00008 00009 #ifndef __MOTIONNETNODE_H_ 00010 #define __MOTIONNETNODE_H_ 00011 00012 #include "Representations/Motion/MotionRequest.h" 00013 #include "Representations/Motion/JointData.h" 00014 #include "Representations/Motion/PIDData.h" 00015 00016 #define INVAL 10000 00017 #define DEFLT 10000 00018 00019 /** 00020 * Represents a node of the motion net. 00021 * The motion net is organised in an array of nodes (MotionNetNode). 00022 * 00023 * @author Uwe Düffert <dueffert@informatik.hu-berlin.de> 00024 */ 00025 typedef struct MotionNetNode 00026 { 00027 public: 00028 enum NodeType { 00029 //! the current node is a conditional transition 00030 typeConditionalTransition, 00031 //! the current node is a transition 00032 typeTransition, 00033 //! the current node is a motor data vector 00034 typeData, 00035 //! the current node is a pid data vector 00036 typePID 00037 }; 00038 00039 //! Represent a set of values from a data line 00040 short d[24]; 00041 /* 00042 //possible content: 00043 {typeData, d[0]..d[19], interpolationMode, dataRepetitionCounter, execMotionRequest} 00044 {typeConditionalTransition, to_motion, via_label, 20*0, execMotionRequest} 00045 {typeTransition, to_label, 21*0, execMotionRequest} 00046 {typePIDData, joint, p, i, d, 18*0, execMotionRequest} 00047 */ 00048 00049 void toJointData(JointData& jointData, long& dataRepetitionCounter, bool& interpolationMode) 00050 { 00051 //head 00052 jointData.data[JointData::neckTilt] = d[1]*1000; 00053 jointData.data[JointData::headPan] = d[2]*1000; 00054 jointData.data[JointData::headTilt] = d[3]*1000; 00055 //mouth 00056 jointData.data[JointData::mouth] = d[4]*1000; 00057 //tail 00058 jointData.data[JointData::tailPan] = d[5]*1000; 00059 jointData.data[JointData::tailTilt] = d[6]*1000; 00060 //legs 00061 for (int i=0;i<12;i++) 00062 jointData.data[JointData::legFR1 + i] = d[i + 7]*1000; 00063 //ears 00064 jointData.data[JointData::earL] = d[19]*1000; 00065 jointData.data[JointData::earR] = d[20]*1000; 00066 //timing information 00067 interpolationMode = (d[21] == 1); 00068 dataRepetitionCounter = d[22]; 00069 } 00070 00071 void toPIDData(PIDData& pidData) 00072 { 00073 PIDData defaultPid; 00074 short pv = (d[2] == DEFLT) ? defaultPid.p[d[1]] : d[2]; 00075 short iv = (d[3] == DEFLT) ? defaultPid.i[d[1]] : d[3]; 00076 short dv = (d[4] == DEFLT) ? defaultPid.d[d[1]] : d[4]; 00077 pidData.setValues((JointData::JointID)d[1],pv,iv,dv); 00078 } 00079 00080 void toExecutedMotionRequest(MotionRequest& execMR) 00081 { 00082 if (d[23]>=0) 00083 execMR.motionType = MotionRequest::specialAction; 00084 execMR.specialActionRequest.specialActionType = (SpecialActionRequest::SpecialActionID)d[23]; 00085 } 00086 00087 } MotionNetNode; 00088 00089 #endif 00090 00091 /* 00092 * Change log : 00093 * 00094 * $Log: MotionNetNode.h,v $ 00095 * Revision 1.3 2004/06/02 17:18:23 spranger 00096 * MotionRequest cleanup 00097 * 00098 * Revision 1.2 2004/05/27 17:13:37 jhoffman 00099 * - renaming: tilt1 -> neckTilt, pan -> headPan, tilt2 -> headTilt 00100 * - clipping included for setJoints 00101 * - removed some microrad/rad-bugs 00102 * - bodyPosture constructor and "=" operator fixed 00103 * 00104 * Revision 1.1.1.1 2004/05/22 17:21:32 cvsadm 00105 * created new repository GT2004_WM 00106 * 00107 * Revision 1.1 2003/10/06 14:10:12 cvsadm 00108 * Created GT2004 (M.J.) 00109 * 00110 * Revision 1.2 2003/09/26 15:27:49 juengel 00111 * Renamed DataTypes to representations. 00112 * 00113 * Revision 1.1.1.1 2003/07/02 09:40:24 cvsadm 00114 * created new repository for the competitions in Padova from the 00115 * tamara CVS (Tuesday 2:00 pm) 00116 * 00117 * removed unused solutions 00118 * 00119 * Revision 1.2 2003/03/19 09:22:02 dueffert 00120 * executedMotionRequest support added 00121 * 00122 * Revision 1.1 2003/03/10 14:14:08 dueffert 00123 * optimized MotionNet 00124 * 00125 * Revision 1.5 2002/11/27 13:48:50 dueffert 00126 * doxygen docu corrected 00127 * 00128 * Revision 1.4 2002/11/20 18:02:29 risler 00129 * added PID values to GT2001MotionNetSpecialActions 00130 * added playDead motion 00131 * 00132 * Revision 1.3 2002/11/19 17:38:31 dueffert 00133 * doxygen bugs corrected 00134 * 00135 * Revision 1.2 2002/11/19 15:43:03 dueffert 00136 * doxygen comments corrected 00137 * 00138 * Revision 1.1 2002/09/10 15:36:16 cvsadm 00139 * Created new project GT2003 (M.L.) 00140 * - Cleaned up the /Src/DataTypes directory 00141 * - Removed challenge related source code 00142 * - Removed processing of incoming audio data 00143 * - Renamed AcousticMessage to SoundRequest 00144 * 00145 * Revision 1.1.1.1 2002/05/10 12:40:17 cvsadm 00146 * Moved GT2002 Project from ute to tamara. 00147 * 00148 * Revision 1.4 2001/12/12 12:43:33 risler 00149 * removed MotionRequest.specialActionParams and MotionNetNode.pval 00150 * 00151 * Revision 1.3 2001/12/10 17:47:07 risler 00152 * change log added 00153 * 00154 */