This function returns information about the actual trajectory point.
#include <iostream>
#include <dlfcn.h>
#include <vector>
#include "KinovaTypes.h"
using namespace std;
int main()
{
int result;
TrajectoryPoint data;
cout << "GetActualTrajectoryInfo function example" << endl;
void * commandLayer_handle;
int (*MyInitAPI)();
int (*MyCloseAPI)();
int (*MyGetActualTrajectoryInfo)(TrajectoryPoint &);
commandLayer_handle = dlopen("Kinova.API.USBCommandLayerUbuntu.so",RTLD_NOW|RTLD_GLOBAL);
MyInitAPI = (int (*)()) dlsym(commandLayer_handle,"InitAPI");
MyCloseAPI = (int (*)()) dlsym(commandLayer_handle,"CloseAPI");
MyGetActualTrajectoryInfo = (int (*)(TrajectoryPoint &)) dlsym(commandLayer_handle,"GetActualTrajectoryInfo");
if((MyInitAPI == NULL) || (MyCloseAPI == NULL) || (MyGetActualTrajectoryInfo == 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 = (*MyGetActualTrajectoryInfo)(data);
cout << " Actuator 1 : " << data.Position.Actuators.Actuator1 << "°" << endl;
cout << " Actuator 2 : " << data.Position.Actuators.Actuator2 << "°" << endl;
cout << " Actuator 3 : " << data.Position.Actuators.Actuator3 << "°" << endl;
cout << " Actuator 4 : " << data.Position.Actuators.Actuator4 << "°" << endl;
cout << " Actuator 5 : " << data.Position.Actuators.Actuator5 << "°" << endl;
cout << " Actuator 6 : " << data.Position.Actuators.Actuator6 << "°" << endl << endl;
cout << " X : " << data.Position.CartesianPosition.X << " m" << endl;
cout << " Y : " << data.Position.CartesianPosition.Y << " m" << endl;
cout << " Z : " << data.Position.CartesianPosition.Z << " m" << endl;
cout << " ThetaX : " << data.Position.CartesianPosition.ThetaX << " RAD" << endl;
cout << " ThetaY : " << data.Position.CartesianPosition.ThetaY << " RAD" << endl;
cout << " ThetaZ : " << data.Position.CartesianPosition.ThetaZ << " RAD" << endl << endl;
cout << "Finger 1 : " << data.Position.Fingers.Finger1 << endl;
cout << "Finger 2 : " << data.Position.Fingers.Finger2 << endl;
cout << "Finger 3 : " << data.Position.Fingers.Finger3 << endl;
cout << " Type : " << (POSITION_TYPE)data.Position.Type << endl;
cout << endl << "Calling the method CloseAPI()" << endl;
result = (*MyCloseAPI)();
cout << "result of CloseAPI() = " << result << endl;
}
return 0;
}