This function returns informations about the trajectories FIFO stored inside the robotical arm.
#include <iostream>
#include <dlfcn.h>
#include <vector>
#include "KinovaTypes.h"
using namespace std;
int main()
{
int result;
TrajectoryFIFO data;
cout << "GetGlobalTrajectoryInfo function example" << endl;
void * commandLayer_handle;
int (*MyInitAPI)();
int (*MyCloseAPI)();
int (*MyGetGlobalTrajectoryInfo)(TrajectoryFIFO &);
commandLayer_handle = dlopen("Kinova.API.USBCommandLayerUbuntu.so",RTLD_NOW|RTLD_GLOBAL);
MyInitAPI = (int (*)()) dlsym(commandLayer_handle,"InitAPI");
MyCloseAPI = (int (*)()) dlsym(commandLayer_handle,"CloseAPI");
MyGetGlobalTrajectoryInfo = (int (*)(TrajectoryFIFO &)) dlsym(commandLayer_handle,"GetGlobalTrajectoryInfo");
if((MyInitAPI == NULL) || (MyCloseAPI == NULL) || (MyGetGlobalTrajectoryInfo == 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 = (*MyGetGlobalTrajectoryInfo)(data);
cout << "Robot internal trajectory FIFO's max size : " << data.MaxSize << " trajectory points" << endl;
cout << " Actual trajectory point count : " << data.TrajectoryCount << " trajectory points" << endl;
cout << " Usage : " << data.UsedPercentage << "%" << endl;
cout << endl << "Calling the method CloseAPI()" << endl;
result = (*MyCloseAPI)();
cout << "result of CloseAPI() = " << result << endl;
}
return 0;
}