This function returns the current that each actuator consume on the main supply. Unit are A.
#include <iostream>
#include <dlfcn.h>
#include <vector>
#include "KinovaTypes.h"
using namespace std;
int main()
{
int result;
AngularPosition data;
cout << "GetAngularCurrent function example" << endl;
void * commandLayer_handle;
int (*MyInitAPI)();
int (*MyCloseAPI)();
int (*MyGetAngularCurrent)(AngularPosition &);
commandLayer_handle = dlopen("Kinova.API.USBCommandLayerUbuntu.so",RTLD_NOW|RTLD_GLOBAL);
MyInitAPI = (int (*)()) dlsym(commandLayer_handle,"InitAPI");
MyCloseAPI = (int (*)()) dlsym(commandLayer_handle,"CloseAPI");
MyGetAngularCurrent = (int (*)(AngularPosition &)) dlsym(commandLayer_handle,"GetAngularCurrent");
if((MyInitAPI == NULL) || (MyCloseAPI == NULL) || (MyGetAngularCurrent == 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 = (*MyGetAngularCurrent)(data);
cout << " Actuator 1 : " << data.Actuators.Actuator1 << "A" << endl;
cout << " Actuator 2 : " << data.Actuators.Actuator2 << "A" << endl;
cout << " Actuator 3 : " << data.Actuators.Actuator3 << "A" << endl;
cout << " Actuator 4 : " << data.Actuators.Actuator4 << "A" << endl;
cout << " Actuator 5 : " << data.Actuators.Actuator5 << "A" << endl;
cout << " Actuator 6 : " << data.Actuators.Actuator6 << "A" << endl;
cout << "Position Finger 1 : " << data.Fingers.Finger1 << "A" << endl;
cout << "Position Finger 2 : " << data.Fingers.Finger2 << "A" << endl;
cout << "Position Finger 3 : " << data.Fingers.Finger3 << "A" << endl;
cout << endl << "Calling the method CloseAPI()" << endl;
result = (*MyCloseAPI)();
cout << "result of CloseAPI() = " << result << endl;
}
return 0;
}