XVF2004/06/01

ijERS-7ȊÕ{bg`ɑΉėpӂꂽ֐łB݂AIBO Remote FrameworḱA
ERS-7݂̂̑ΉƂȂ邽߁AŒl݂̂Ԃ֐܂B

CCpcInfo
y@\zRXgN^
y߂lzȂ
y@\zIuWFNgѓϐ̏
y`z

CCpcInfo::CCpcInfo(
                   UINT robot)  // {bg(DESIGN_ERS7)  VAIBO::GetRobotDesign()Ŏ擾


~CCpcInfo
y@\zfXgN^
y߂lzȂ
y@\zIuWFNgѓϐ̌㏈
y`z

CCpcInfo::~CCpcInfo()


GetJointArray
y@\z֐IDz̎擾
y߂lz֐ID
y@\z̃{bgʂRc\֐߂IDƐ擾Bjoint = NULL̂Ƃ͊֐ߎʎqԂB
            zɊi[鐮l̈Ӗ CpcInfo.h  enum JOINTS_ID {} ŕB
            oO; ֐߃XgRoll܂܂܂AERS-7 ɂ Roll ֐߂͂܂B
y`z

int CCpcInfo::GetJointArray(
                                int *joints)  // ֐ߎʎqi[ꏊ


GetSensorArray
y@\zPrimitive Locator ID ƃZT[̑Ήe[u̎擾
y߂lze[ȗ傫(Primitive Locator ID̑傫ɓ)
y@\zPrimitive Locator ID (CpcInfo.h  enum SensorID{} Œ`) 
    ƃZT[̑Ήe[u擾Barray = NULL ̏ꍇ̓f[^̂ݕԂB
    CCpcInfo::GetJointArray(int *joints) Ŏ擾ł֐ߊpx̃Xg
    WM_VAIBO_SENSOR_DATA Ŏ擾łZT[̃Xg̕тقȂ邽߁A
    }bsOe[u擾B
y`z

int CCpcInfo::GetSensorArray(
                                 int *array)  // e[ui[ꏊ

ygpz

class CTestDlg : public CDialog
{
    int     m_sensorArrayNum;       // The number of sensor array
    int     *m_sensorArray;         // Sensor array
    int     m_jointArrayNum;        // The number of sensor array
    int     *m_jointArray;          // Sensor array
    float   *m_angleArray;          // Joint angle array
}

CTestDlg::CTestDlg()
{
    CCpcInfo    cpc(DESIGN_ERS7);

    m_sensorArrayNum = cpc.GetSensorArray(NULL);
    m_sensorArray = (int*)malloc(sizeof(int)*m_sensorArrayNum);
    cpc.GetSensorArray(m_sensorArray);

    int m_jointArrayNum = cpc.GetJointArray(NULL);
    m_jointArray = (int*)malloc(sizeof(int)*m_jointArrayNum);
    cpc.GetJointArray(m_jointArray);

    m_angle = (float*)malloc(sizeof(float)*SENSOR_MAX);
}

ON_REGISTERED_MESSAGE(WM_VAIBO_SENSOR_DATA, OnVAIBOSensorData)

LRESULT CTestDlg::OnVAIBOSensorData( WPARAM wParam, LPARAM recArray )
{
  SensorRec *sensorRecAry = (SensorRec*)recArray
  int numOfData = LOWORD( wParam );
  
  for ( i = 0; i < numOfData; i++ ) {
     int ix = m_sensorArray[sensorRecAry[i].sensorID];
     if ( ix != -1 ) {  // It is information on the joint.
        m_angleArray[ix] = (float)(sensorRecAry[i].value) / 3.141592 * 1000000.0 * 180.0;
     }
  }
  m_aibo3D->RotateJoint( m_jointArray, m_angleArray, SENSOR_MAX, TRUE );
      // m_aibo3D is VAIBO3D class object, it should be constructed before use.
      // See RemoteTest sample to see full set program.
}


GetPrimitiveLocator
y@\zPrimitive Locator ID  Primitive Locator ̎擾
y߂lz1FYLocator  0FYLocatorȂ
y@\zPrimitive Locator ID(CpcInfo.h  enum SensorID{} Œ`)
            ɑΉPrimitive Locator char *szLocator Ɏ擾B
            Primitive Locator Ƃ́A"PRM:/r1/c1-Joint2:11" ̂悤ȕŁA
            OPEN-R SDKł́AAIBÕZT[A֐߂킷B
            Primitive Locator ́AAIBO Remote Framework Ń[U[gp邱Ƃ͂ȂB
            OPEN-R SDK 𗝉ĂlpPrimitive Locator\Ȃǂ
            ړIŗpłB

y`z

int CCpcInfo::GetPrimitiveLocator(
                        int nSensorID,    // Primitive Locator ID(=SensorID)
                        char *szLocator)  // Primitive Locator(128Bytes)

