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 NeutralAgent_h_DEFINED 00013 #define NeutralAgent_h_DEFINED 00014 00015 #include <MoNetData.h> 00016 #include "MoNetAgent.h" 00017 00018 enum NeutralAgentState { 00019 NAS_IDLE, 00020 NAS_ADJUSTING_DIFF_JOINT_VALUE, 00021 NAS_MOVING_TO_BROADBASE, 00022 NAS_MOVING_TO_SLEEPING 00023 }; 00024 00025 class NeutralAgent : public MoNetAgent { 00026 public: 00027 NeutralAgent(); 00028 virtual ~NeutralAgent() {} 00029 00030 virtual bool AreYou(MoNetAgentID agent); 00031 virtual void Init(ODA* oda); 00032 virtual void NotifyCommand(const MoNetAgentCommand& command, 00033 MoNetAgentResult* result); 00034 virtual void ReadyEffector(const MoNetAgentCommand& command, 00035 MoNetAgentResult* result); 00036 virtual void SetJointGain(); 00037 00038 private: 00039 static const word TILT_PGAIN = 0x000a; 00040 static const word TILT_IGAIN = 0x0008; 00041 static const word TILT_DGAIN = 0x000c; 00042 00043 static const word PAN_PGAIN = 0x000d; 00044 static const word PAN_IGAIN = 0x0008; 00045 static const word PAN_DGAIN = 0x000b; 00046 00047 static const word ROLL_PGAIN = 0x000a; 00048 static const word ROLL_IGAIN = 0x0008; 00049 static const word ROLL_DGAIN = 0x000c; 00050 00051 static const word J1_PGAIN = 0x0016; 00052 static const word J1_IGAIN = 0x0004; 00053 static const word J1_DGAIN = 0x0008; 00054 00055 static const word J2_PGAIN = 0x0014; 00056 static const word J2_IGAIN = 0x0004; 00057 static const word J2_DGAIN = 0x0006; 00058 00059 static const word J3_PGAIN = 0x0023; 00060 static const word J3_IGAIN = 0x0004; 00061 static const word J3_DGAIN = 0x0005; 00062 00063 static const word PSHIFT = 0x000e; 00064 static const word ISHIFT = 0x0002; 00065 static const word DSHIFT = 0x000f; 00066 00067 static const int BROADBASE_MAX_COUNTER = 192; // 32ms * 192 = 6144ms 00068 static const int SLEEPING_MAX_COUNTER = 192; // 32ms * 192 = 6144ms 00069 00070 MoNetStatus AdjustDiffJointValue(OVRSyncKey syncKey); 00071 MoNetStatus MoveToBroadBase(); 00072 MoNetStatus MoveToSleeping(); 00073 00074 void SetJointValue(RCRegion* rgn, int idx, double start, double end); 00075 00076 NeutralAgentState neutralAgentState; 00077 }; 00078 00079 #endif // NeutralAgent_h_DEFINED