Kinova API Documentation
KINOVAAPIUSBCOMMANDLAYER_API int GetSensorsInfo ( SensorsInfo Response)

This function returns information about the robotical arm's sensors. (Voltage, Total current, Temperature, acceleration)

Parameters:
ResponseThe structure containing the sensor's informations
#include <iostream>
#include <dlfcn.h> //Ubuntu
#include <vector>
#include "KinovaTypes.h"
//Note that under windows, you may/will have to perform other #include

using namespace std;

int main()
{
        int result;
        SensorsInfo data;

        cout << "GetSensorsInfo function example" << endl;

        //Handle for the library's command layer.
        void * commandLayer_handle;

        //Function pointers to the functions we need
        int (*MyInitAPI)();
        int (*MyCloseAPI)();
        int (*MyGetSensorsInfo)(SensorsInfo &);

        //We load the library (Under Windows, use the function LoadLibrary)
        commandLayer_handle = dlopen("Kinova.API.USBCommandLayerUbuntu.so",RTLD_NOW|RTLD_GLOBAL);

        //We load the functions from the library (Under Windows, use GetProcAddress)
        MyInitAPI = (int (*)()) dlsym(commandLayer_handle,"InitAPI");
        MyCloseAPI = (int (*)()) dlsym(commandLayer_handle,"CloseAPI");
        MyGetSensorsInfo = (int (*)(SensorsInfo &)) dlsym(commandLayer_handle,"GetSensorsInfo");

        //If the was loaded correctly
        if((MyInitAPI == NULL) || (MyCloseAPI == NULL) || (MyGetSensorsInfo == NULL))
        {
                cout << "Unable to initialize the command layer." << endl;
        }
        else
        {
                cout << "The command has been initialized correctly." << endl << endl;

                cout << "Calling the method InitAPI()" << endl;
                result = (*MyInitAPI)();
                cout << "result of InitAPI() = " << result << endl << endl;

                result = (*MyGetSensorsInfo)(data);

                cout << "Acceleration captor X : " << data.AccelerationX << " m / s^2" << endl;
                cout << "Acceleration captor Y : " << data.AccelerationY << " m / s^2" << endl;
                cout << "Acceleration captor Z : " << data.AccelerationZ << " m / s^2" << endl;
                cout << "Actuator 1's temperature : " << data.ActuatorTemp1 << " C°" << endl;
                cout << "Actuator 2's temperature : " << data.ActuatorTemp2 << " C°" << endl;
                cout << "Actuator 3's temperature : " << data.ActuatorTemp3 << " C°" << endl;
                cout << "Actuator 4's temperature : " << data.ActuatorTemp4 << " C°" << endl;
                cout << "Actuator 5's temperature : " << data.ActuatorTemp5 << " C°" << endl;
                cout << "Actuator 6's temperature : " << data.ActuatorTemp6 << " C°" << endl;
                cout << "Finger 1's temperature : " << data.FingerTemp1 << " C°" << endl;
                cout << "Finger 2's temperature : " << data.FingerTemp2 << " C°" << endl;
                cout << "Finger 3's temperature : " << data.FingerTemp3 << " C°" << endl;
                cout << "Current on the main supply : " << data.Current << " A" << endl;
                cout << "Main supply voltage : " << data.Voltage << " V°" << endl << endl;


                cout << endl << "Calling the method CloseAPI()" << endl;
                result = (*MyCloseAPI)();
                cout << "result of CloseAPI() = " << result << endl;
        }

        return 0;
}
 All Classes Files Functions Variables Enumerations Enumerator Defines