00001
00002
00003
00004
00005
00006
00007 #ifndef __SensorData_h_
00008 #define __SensorData_h_
00009
00010 #include "Tools/Streams/InOut.h"
00011 #include "Tools/Streams/Streamable.h"
00012
00013
00014
00015
00016 class SensorData : public Streamable
00017 {
00018 void serialize(In* in, Out* out)
00019 {
00020 STREAM_REGISTER_BEGIN();
00021 STREAM(data[neckTilt]);
00022 STREAM(data[headPan]);
00023 STREAM(data[headTilt]);
00024
00025 STREAM(data[backR]);
00026 STREAM(data[backF]);
00027 STREAM(data[headPsdNear]);
00028 STREAM(data[mouth]);
00029 STREAM(data[chin]);
00030
00031 STREAM(data[legFL1]);
00032 STREAM(data[legFL2]);
00033 STREAM(data[legFL3]);
00034 STREAM(data[pawFL]);
00035
00036 STREAM(data[legHL1]);
00037 STREAM(data[legHL2]);
00038 STREAM(data[legHL3]);
00039 STREAM(data[pawHL]);
00040
00041 STREAM(data[legFR1]);
00042 STREAM(data[legFR2]);
00043 STREAM(data[legFR3]);
00044 STREAM(data[pawFR]);
00045
00046 STREAM(data[legHR1]);
00047 STREAM(data[legHR2]);
00048 STREAM(data[legHR3]);
00049 STREAM(data[pawHR]);
00050
00051 STREAM(data[tailPan]);
00052 STREAM(data[tailTilt]);
00053
00054 STREAM(data[wlan]);
00055 STREAM(data[backM]);
00056 STREAM(data[accelerationX]);
00057 STREAM(data[accelerationY]);
00058 STREAM(data[accelerationZ]);
00059
00060 STREAM(data[head]);
00061 STREAM(data[headPsdFar]);
00062 STREAM(data[bodyPsd]);
00063
00064 STREAM(refValue[neckTilt]);
00065 STREAM(refValue[headPan]);
00066 STREAM(refValue[headTilt]);
00067
00068 STREAM(refValue[backR]);
00069 STREAM(refValue[backF]);
00070 STREAM(refValue[headPsdNear]);
00071 STREAM(refValue[mouth]);
00072 STREAM(refValue[chin]);
00073
00074 STREAM(refValue[legFL1]);
00075 STREAM(refValue[legFL2]);
00076 STREAM(refValue[legFL3]);
00077 STREAM(refValue[pawFL]);
00078
00079 STREAM(refValue[legHL1]);
00080 STREAM(refValue[legHL2]);
00081 STREAM(refValue[legHL3]);
00082 STREAM(refValue[pawHL]);
00083
00084 STREAM(refValue[legFR1]);
00085 STREAM(refValue[legFR2]);
00086 STREAM(refValue[legFR3]);
00087 STREAM(refValue[pawFR]);
00088
00089 STREAM(refValue[legHR1]);
00090 STREAM(refValue[legHR2]);
00091 STREAM(refValue[legHR3]);
00092 STREAM(refValue[pawHR]);
00093
00094 STREAM(refValue[tailPan]);
00095 STREAM(refValue[tailTilt]);
00096
00097 STREAM(refValue[wlan]);
00098 STREAM(refValue[backM]);
00099 STREAM(refValue[accelerationX]);
00100 STREAM(refValue[accelerationY]);
00101 STREAM(refValue[accelerationZ]);
00102
00103 STREAM(refValue[head]);
00104 STREAM(refValue[headPsdFar]);
00105 STREAM(refValue[bodyPsd]);
00106
00107 STREAM(frameNumber);
00108
00109 STREAM_REGISTER_FINISH();
00110 }
00111 public:
00112
00113
00114
00115 SensorData();
00116
00117
00118
00119
00120 ~SensorData();
00121
00122 enum sensors
00123 {
00124
00125 neckTilt,
00126 headPan,
00127 headTilt,
00128
00129
00130 headBack,
00131 headFront,
00132 psd,
00133 mouth,
00134 chin,
00135 legFL1, legFL2, legFL3, pawFL,
00136 legHL1, legHL2, legHL3, pawHL,
00137 legFR1, legFR2, legFR3, pawFR,
00138 legHR1, legHR2, legHR3, pawHR,
00139 tailPan, tailTilt,
00140 thermo,
00141 back,
00142 accelerationX, accelerationY, accelerationZ,
00143 numOfSensor_ERS210,
00144
00145
00146 head = numOfSensor_ERS210,
00147 headPsdFar,
00148 bodyPsd,
00149 numOfSensor_ERS7,
00150
00151
00152 headTilt210 = neckTilt,
00153 headPan210 = headPan,
00154 headRoll210 = headTilt,
00155 headPsdNear = psd,
00156 backF = headFront,
00157 backM = back,
00158 backR = headBack,
00159 wlan = thermo
00160 };
00161
00162
00163 long data[numOfSensor_ERS7];
00164
00165
00166
00167 long refValue[numOfSensor_ERS7];
00168
00169
00170 unsigned long frameNumber;
00171
00172 void init();
00173
00174
00175 static const char* getSensorName(sensors sensor)
00176 {
00177 switch (sensor)
00178 {
00179 case neckTilt: return "neckTilt (headTilt210)";
00180 case headTilt: return "headTilt (headRoll210)";
00181 case headBack: return "head/backRear";
00182 case headFront: return "head/backFront";
00183 case psd: return "headPsd(Near)";
00184 case thermo: return "thermo/wlan";
00185 case back: return "back(Middle)";
00186 default: return getSensorNameERS7(sensor);
00187 }
00188 }
00189
00190
00191 static const char* getSensorNameERS210(sensors sensor)
00192 {
00193 switch (sensor)
00194 {
00195 case headTilt210: return "headTilt210";
00196 case headPan210: return "headPan210";
00197 case headRoll210: return "headRoll210";
00198 case headBack: return "headBack";
00199 case headFront: return "headFront";
00200 case psd: return "psd";
00201 case mouth: return "mouth";
00202 case chin: return "chin";
00203 case legFL1: return "legFL1";
00204 case legFL2: return "legFL2";
00205 case legFL3: return "legFL3";
00206 case pawFL: return "pawFL";
00207 case legHL1: return "legHL1";
00208 case legHL2: return "legHL2";
00209 case legHL3: return "legHL3";
00210 case pawHL: return "pawHL";
00211 case legFR1: return "legFR1";
00212 case legFR2: return "legFR2";
00213 case legFR3: return "legFR3";
00214 case pawFR: return "pawFR";
00215 case legHR1: return "legHR1";
00216 case legHR2: return "legHR2";
00217 case legHR3: return "legHR3";
00218 case pawHR: return "pawHR";
00219 case tailPan: return "tailPan";
00220 case tailTilt: return "tailTilt";
00221 case thermo: return "thermo";
00222 case back: return "back";
00223 case accelerationX: return "accelerationX";
00224 case accelerationY: return "accelerationY";
00225 case accelerationZ: return "accelerationZ";
00226 default: return "unknown sensor";
00227 }
00228 }
00229
00230
00231 static const char* getSensorNameERS7(sensors sensor)
00232 {
00233 switch (sensor)
00234 {
00235 case headPan: return "headPan";
00236 case headTilt: return "headTilt";
00237 case neckTilt: return "neckTilt";
00238 case backR: return "backRear";
00239 case backF: return "backFront";
00240 case headPsdNear: return "headPsdNear";
00241 case wlan: return "wlan";
00242 case backM: return "backMiddle";
00243 case head: return "head";
00244 case headPsdFar: return "headPsdFar";
00245 case bodyPsd: return "bodyPsd";
00246 default: return getSensorNameERS210(sensor);
00247 }
00248 }
00249 };
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267 #endif //__SensorData_h_