MoNetAgentManager.h

Go to the documentation of this file.
00001 //
00002 // Copyright 2002,2004 Sony Corporation 
00003 //
00004 // Permission to use, copy, modify, and redistribute this software for
00005 // non-commercial use is hereby granted.
00006 //
00007 // This software is provided "as is" without warranty of any kind,
00008 // either expressed or implied, including but not limited to the
00009 // implied warranties of fitness for a particular purpose.
00010 //
00011 
00012 #ifndef MoNetAgentManager_h_DEFINED
00013 #define MoNetAgentManager_h_DEFINED
00014 
00015 #include <list>
00016 using namespace std;
00017 
00018 #include <OPENR/OSubject.h>
00019 #include <OPENR/OObserver.h>
00020 #include <MoNetData.h>
00021 #include <ODA.h>
00022 
00023 const int HEAD_TILT  =  0; // DRX-900  (ERS-210/220)
00024 const int HEAD_TILT1 =  0; // DRX-1000 (ERS-7)
00025 const int HEAD_PAN   =  1;
00026 const int HEAD_ROLL  =  2; // DRX-900  (ERS-210/220)
00027 const int HEAD_TILT2 =  2; // DRX-1000 (ERS-7)
00028 const int RFLEG_J1   =  3;
00029 const int RFLEG_J2   =  4;
00030 const int RFLEG_J3   =  5;
00031 const int LFLEG_J1   =  6;
00032 const int LFLEG_J2   =  7;
00033 const int LFLEG_J3   =  8;
00034 const int RRLEG_J1   =  9;
00035 const int RRLEG_J2   = 10;
00036 const int RRLEG_J3   = 11;
00037 const int LRLEG_J1   = 12;
00038 const int LRLEG_J2   = 13;
00039 const int LRLEG_J3   = 14;
00040 const int TAIL_TILT  = 15;
00041 const int TAIL_PAN   = 16;
00042 const int MOUTH      = 17;
00043 const int LEFT_EAR   = 18;
00044 const int RIGHT_EAR  = 19;
00045 
00046 const int DRX900_NUM_JOINTS = 15;
00047 static const char* const DRX900_JOINT_LOCATOR[] = {
00048     "PRM:/r1/c1-Joint2:j1",             // HEAD TILT
00049     "PRM:/r1/c1/c2-Joint2:j2",          // HEAD PAN
00050     "PRM:/r1/c1/c2/c3-Joint2:j3",       // HEAD ROLL
00051     "PRM:/r4/c1-Joint2:j1",             // RFLEG J1 (Right Front Leg)
00052     "PRM:/r4/c1/c2-Joint2:j2",          // RFLEG J2
00053     "PRM:/r4/c1/c2/c3-Joint2:j3",       // RFLEG J3
00054     "PRM:/r2/c1-Joint2:j1",             // LFLEG J1 (Left Front Leg)
00055     "PRM:/r2/c1/c2-Joint2:j2",          // LFLEG J2
00056     "PRM:/r2/c1/c2/c3-Joint2:j3",       // LFLEG J3
00057     "PRM:/r5/c1-Joint2:j1",             // RRLEG J1 (Right Rear Leg)
00058     "PRM:/r5/c1/c2-Joint2:j2",          // RRLEG J2
00059     "PRM:/r5/c1/c2/c3-Joint2:j3",       // RRLEG J3
00060     "PRM:/r3/c1-Joint2:j1",             // LRLEG J1 (Left Rear Leg)
00061     "PRM:/r3/c1/c2-Joint2:j2",          // LRLEG J2
00062     "PRM:/r3/c1/c2/c3-Joint2:j3",       // LRLEG J3
00063 };
00064 
00065 const int DRX1000_NUM_JOINT2 = 18;
00066 const int DRX1000_NUM_JOINT4 =  2;
00067 const int DRX1000_NUM_JOINTS = DRX1000_NUM_JOINT2 + DRX1000_NUM_JOINT4;
00068 static const char* const DRX1000_JOINT_LOCATOR[] = {
00069     "PRM:/r1/c1-Joint2:11",          // TILT1
00070     "PRM:/r1/c1/c2-Joint2:12",       // PAN
00071     "PRM:/r1/c1/c2/c3-Joint2:13",    // TILT2
00072     "PRM:/r4/c1-Joint2:41",          // RFLEG J1 (Right Front Leg)
00073     "PRM:/r4/c1/c2-Joint2:42",       // RFLEG J2
00074     "PRM:/r4/c1/c2/c3-Joint2:43",    // RFLEG J3
00075     "PRM:/r2/c1-Joint2:21",          // LFLEG J1 (Left Front Leg)
00076     "PRM:/r2/c1/c2-Joint2:22",       // LFLEG J2
00077     "PRM:/r2/c1/c2/c3-Joint2:23",    // LFLEG J3
00078     "PRM:/r5/c1-Joint2:51",          // RRLEG J1 (Right Rear Leg)
00079     "PRM:/r5/c1/c2-Joint2:52",       // RRLEG J2
00080     "PRM:/r5/c1/c2/c3-Joint2:53",    // RRLEG J3
00081     "PRM:/r3/c1-Joint2:31",          // LRLEG J1 (Left Rear Leg)
00082     "PRM:/r3/c1/c2-Joint2:32",       // LRLEG J2
00083     "PRM:/r3/c1/c2/c3-Joint2:33",    // LRLEG J3
00084     "PRM:/r6/c1-Joint2:61",          // TAIL TILT
00085     "PRM:/r6/c2-Joint2:62",          // TAIL PAN
00086     "PRM:/r1/c1/c2/c3/c4-Joint2:14", // MOUTH
00087     "PRM:/r1/c1/c2/c3/e5-Joint4:15", // LEFT EAR
00088     "PRM:/r1/c1/c2/c3/e6-Joint4:16"  // RIGHT EAR
00089 };
00090 
00091 const int MAX_NUM_JOINTS = DRX1000_NUM_JOINTS;
00092 const int NUM_FRAMES     = 4;
00093 
00094 class MoNetAgent;
00095 
00096 class MoNetAgentManager {
00097 public:
00098     MoNetAgentManager();
00099     ~MoNetAgentManager() {}
00100 
00101     void InitDRX900();
00102     void InitDRX1000();
00103     void Start(OSubject* effector);
00104 
00105     void RegisterMoNetAgent(MoNetAgent* m);
00106 
00107     void NotifyCommand(const ONotifyEvent& event, MoNetAgentResult* result);
00108     void ReadyEffector(const OReadyEvent& event,  MoNetAgentResult* result);
00109 
00110     OPrimitiveID PrimitiveID(int idx) { return primitiveID[idx]; }
00111     OSubject*    Effector()           { return effectorSubject;  }
00112     RCRegion*    FindFreeCommandRegion();
00113 
00114 private:
00115     void OpenPrimitivesDRX900();
00116     void NewCommandVectorDataDRX900();
00117 
00118     void OpenPrimitivesDRX1000();
00119     void NewCommandVectorDataDRX1000();
00120 
00121     void LoadMotionODA();
00122 
00123     static const size_t NUM_COMMAND_VECTOR =  4;
00124 
00125     MoNetAgent*          prevMoNetAgent;
00126     MoNetAgent*          activeMoNetAgent;
00127     MoNetAgentCommand    activeAgentCommand;
00128     list<MoNetAgent*>    moNetAgentList;
00129 
00130     OSubject*    effectorSubject;
00131     OPrimitiveID primitiveID[MAX_NUM_JOINTS];
00132 
00133     RCRegion*    commandRegions[NUM_COMMAND_VECTOR];
00134 
00135     ODesignDataID  motionDataID;
00136     ODA            motionODA;
00137 };
00138 
00139 #endif // MoNetAgentManager_h_DEFINED

Generated on Sun Dec 2 23:04:29 2007 for openSDK by  doxygen 1.3.9.1