Kinova API Documentation
KINOVAAPIUSBCOMMANDLAYER_API int GetAngularCurrentMotor ( AngularPosition Response)

This function get motor's current of each actuator.

Parameters:
ResponseAn AngularPosition struct containing the values. Units are A.
#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;
        AngularPosition data;

        cout << "GetAngularCurrentMotor 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 (*MyGetAngularCurrentMotor)(AngularPosition &);

        //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");
        MyGetAngularCurrentMotor = (int (*)(AngularPosition &)) dlsym(commandLayer_handle,"GetAngularCurrentMotor");

        //If the was loaded correctly
        if((MyInitAPI == NULL) || (MyCloseAPI == NULL) || (MyGetAngularCurrentMotor == 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;

                result = (*MyGetAngularCurrentMotor)(data);

                cout << "Actuator 1 current : " << data.Actuators.Actuator1 << "A" << endl;
                cout << "Actuator 2 current : " << data.Actuators.Actuator2 << "A" << endl;
                cout << "Actuator 3 current : " << data.Actuators.Actuator3 << "A" << endl;
                cout << "Actuator 4 current : " << data.Actuators.Actuator4 << "A" << endl;
                cout << "Actuator 5 current : " << data.Actuators.Actuator5 << "A" << endl;
                cout << "Actuator 6 current : " << data.Actuators.Actuator6 << "A" << endl;

                cout << "   Finger 1 current: " << data.Fingers.Finger1 << "A" << endl;
                cout << "   Finger 2 current: " << data.Fingers.Finger2 << "A" << endl;
                cout << "   Finger 3 current: " << data.Fingers.Finger3 << "A" << 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