00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef SensorObserver7_h_DEFINED
00013 #define SensorObserver7_h_DEFINED
00014
00015 #include <OPENR/OObject.h>
00016 #include <OPENR/OSubject.h>
00017 #include <OPENR/OObserver.h>
00018 #include "def.h"
00019
00020 const int NUM_ERS7_SENSORS = 34;
00021
00022 const int ACC_Y = 0;
00023 const int ACC_X = 1;
00024 const int ACC_Z = 2;
00025 const int BODY_PSD = 3;
00026 const int WLAN_SW = 4;
00027 const int BACK_SW_R = 5;
00028 const int BACK_SW_M = 6;
00029 const int BACK_SW_F = 7;
00030 const int HEAD_SENSOR = 8;
00031 const int CHIN_SW = 9;
00032 const int HEAD_PSD_NEAR = 10;
00033 const int HEAD_PSD_FAR = 11;
00034 const int HEAD_TILT1 = 12;
00035 const int HEAD_PAN = 13;
00036 const int HEAD_TILT2 = 14;
00037 const int MOUTH = 15;
00038 const int RFLEG_J1 = 16;
00039 const int RFLEG_J2 = 17;
00040 const int RFLEG_J3 = 18;
00041 const int RFLEG_SW = 19;
00042 const int LFLEG_J1 = 20;
00043 const int LFLEG_J2 = 21;
00044 const int LFLEG_J3 = 22;
00045 const int LFLEG_SW = 23;
00046 const int RRLEG_J1 = 24;
00047 const int RRLEG_J2 = 25;
00048 const int RRLEG_J3 = 26;
00049 const int RRLEG_SW = 27;
00050 const int LRLEG_J1 = 28;
00051 const int LRLEG_J2 = 29;
00052 const int LRLEG_J3 = 30;
00053 const int LRLEG_SW = 31;
00054 const int TAIL_TILT = 32;
00055 const int TAIL_PAN = 33;
00056
00057 static const char* const ERS7_SENSOR_LOCATOR[] = {
00058
00059 "PRM:/a1-Sensor:a1",
00060 "PRM:/a2-Sensor:a2",
00061 "PRM:/a3-Sensor:a3",
00062 "PRM:/p1-Sensor:p1",
00063 "PRM:/b1-Sensor:b1",
00064 "PRM:/t2-Sensor:t2",
00065 "PRM:/t3-Sensor:t3",
00066 "PRM:/t4-Sensor:t4",
00067
00068
00069 "PRM:/r1/c1/c2/c3/t1-Sensor:t1",
00070 "PRM:/r1/c1/c2/c3/c4/s5-Sensor:s5",
00071 "PRM:/r1/c1/c2/c3/p1-Sensor:p1",
00072 "PRM:/r1/c1/c2/c3/p2-Sensor:p2",
00073 "PRM:/r1/c1-Joint2:11",
00074 "PRM:/r1/c1/c2-Joint2:12",
00075 "PRM:/r1/c1/c2/c3-Joint2:13",
00076 "PRM:/r1/c1/c2/c3/c4-Joint2:14",
00077
00078
00079 "PRM:/r4/c1-Joint2:41",
00080 "PRM:/r4/c1/c2-Joint2:42",
00081 "PRM:/r4/c1/c2/c3-Joint2:43",
00082 "PRM:/r4/c1/c2/c3/c4-Sensor:44",
00083
00084
00085 "PRM:/r2/c1-Joint2:21",
00086 "PRM:/r2/c1/c2-Joint2:22",
00087 "PRM:/r2/c1/c2/c3-Joint2:23",
00088 "PRM:/r2/c1/c2/c3/c4-Sensor:24",
00089
00090
00091 "PRM:/r5/c1-Joint2:51",
00092 "PRM:/r5/c1/c2-Joint2:52",
00093 "PRM:/r5/c1/c2/c3-Joint2:53",
00094 "PRM:/r5/c1/c2/c3/c4-Sensor:54",
00095
00096
00097 "PRM:/r3/c1-Joint2:31",
00098 "PRM:/r3/c1/c2-Joint2:32",
00099 "PRM:/r3/c1/c2/c3-Joint2:33",
00100 "PRM:/r3/c1/c2/c3/c4-Sensor:34",
00101
00102
00103 "PRM:/r6/c1-Joint2:61",
00104 "PRM:/r6/c2-Joint2:62"
00105 };
00106
00107 class SensorObserver7 : public OObject {
00108 public:
00109 SensorObserver7();
00110 virtual ~SensorObserver7() {}
00111
00112 OSubject* subject[numOfSubject];
00113 OObserver* observer[numOfObserver];
00114
00115 virtual OStatus DoInit (const OSystemEvent& event);
00116 virtual OStatus DoStart (const OSystemEvent& event);
00117 virtual OStatus DoStop (const OSystemEvent& event);
00118 virtual OStatus DoDestroy(const OSystemEvent& event);
00119
00120 void NotifyERS7(const ONotifyEvent& event);
00121
00122 private:
00123 void InitERS7SensorIndex(OSensorFrameVectorData* sensorVec);
00124 void PrintERS7Sensor(OSensorFrameVectorData* sensorVec);
00125 void PrintSensorValue(OSensorFrameVectorData* sensorVec, int index);
00126 void PrintJointValue(OSensorFrameVectorData* sensorVec, int index);
00127 void PrintSeparator();
00128 void WaitReturnKey();
00129
00130 bool initSensorIndex;
00131 int ers7idx[NUM_ERS7_SENSORS];
00132 };
00133
00134 #endif // SensorObserver7_h_DEFINED