Last Updated : 2004/06/01

Note : Some functions support different robot design variations.
  AIBO Remote Framework only supports AIBO ERS-7, so these functions return a constant value.

+ CCpcInfo
[Function] Constructor
[Return]void
[Description] Initialize internal objects and variables.
[Usage] 

CCpcInfo::CCpcInfo(
                   UINT robot)  // Robot Design (DESIGN_ERS7) VAIBO::GetRobotDesign()


+ ~CCpcInfo
[Function] Destructor
[Return] void
[Description] Destruct internal objects and variables.
[Usage] 

CCpcInfo::~CCpcInfo()


+ GetJointArray
[Function] Get joint ID array
[Return] Number of joints 
[Description] Get a joint ID array to display the 3D model object.  If joints == NULL, only the number of joints is returned.
  The definition of these ID numbers are in CpcInfo.h, enum JOINTS_ID {}
  *known bug: joint list has a roll ID, but ERS-7 doesn't have a roll joint.
[Usage] 

int CCpcInfo::GetJointArray(
                                int *joints)  // Buffer to store ID list


+ GetSensorArray
[Function] Get a list of Primitive Locator IDs and sensor information mapping table
[Return] Number of items in the list. ( = Number of Primitive Locator IDs)
[Description] Get a mapping table of Primitive Locator IDs (defined as enum SensorID{} in CpcInfo.h) and 
         a sensor information table. If array == NULL, only the number of items is returned.
         The order of the joint angle list from CCpcInfo::GetJointArray(int *joints) and
         the order of the sensor information list from WM_VAIBO_SENSOR_DATA are different.
         You can get a table mapping between these orders using GetSensorArray().
[Usage] 

int CCpcInfo::GetSensorArray(
                                 int *array)  // buffer to store table

[Example]

class CTestDlg : public CDialog
{
    int     m_sensorArrayNum;       // The number of items in the sensorArray
    int     *m_sensorArray;         // raw Sensor array
    int     m_jointArrayNum;        // The number of items in the jointArray
    int     *m_jointArray;          // raw Sensor array
    float   *m_angleArray;          // Joint angle array after calculation
}

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 ) {  // This means it is joint information
        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 a VAIBO3D class object, so it should be constructed before use.
      // See the RemoteTest sample to see the full program.
}


+ GetPrimitiveLocator
[Function] Get Primitive Locator from Primitive Locator ID 
[Return] 1E Locator is available    0: Locator not found
[Description] Stores a Primitive Locator (string) bound to a given Primitive Locator ID 
    (defined as enum SensorID{} in CpcInfo.h), into char *szLocator.  
    Primitive Locator is a string like "PRM:/r1/c1-Joint2:11" which is used
        in the OPEN-R SDK to specify AIBO's sensors and joints.
        AIBO Remote Framework users will not use Primitive Locator.
        This function is useful for users familiar with the OPEN-R SDK to show a
        particular Primitive Locator.
[Usage] 

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


