This function set the Cartesian inertia and damping value.
#include <iostream>
#include <dlfcn.h>
#include <vector>
#include "KinovaTypes.h"
using namespace std;
int main()
{
int result;
cout << "SetCartesianForceMinMax function example" << endl;
void * commandLayer_handle;
int (*MyInitAPI)();
int (*MyCloseAPI)();
int (*MySetCartesianForceMinMax)(CartesianInfo, CartesianInfo);
commandLayer_handle = dlopen("Kinova.API.USBCommandLayerUbuntu.so",RTLD_NOW|RTLD_GLOBAL);
MyInitAPI = (int (*)()) dlsym(commandLayer_handle,"InitAPI");
MyCloseAPI = (int (*)()) dlsym(commandLayer_handle,"CloseAPI");
MySetCartesianForceMinMax = (int (*)(CartesianInfo, CartesianInfo)) dlsym(commandLayer_handle,"SetCartesianForceMinMax");
if((MyInitAPI == NULL) || (MyCloseAPI == NULL) || (MySetCartesianForceMinMax == 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;
CartesianInfo commandMin;
CartesianInfo commandMax;
commandMin.InitStruct();
commandMax.InitStruct();
commandMin.X = 1.0f;
commandMin.Y = 1.0f;
commandMin.Z = 1.0f;
commandMin.ThetaX = 0.1f;
commandMin.ThetaY = 0.1f;
commandMin.ThetaZ = 0.1f;
commandMax.X = 200.0f;
commandMax.Y = 200.0f;
commandMax.Z = 200.0f;
commandMax.ThetaX = 200.0f;
commandMax.ThetaY = 200.0f;
commandMax.ThetaZ = 200.0f;
result = (*MySetCartesianForceMinMax)(commandMin, commandMax);
cout << "Cartesian force min and max has been set." << endl;
cout << endl << "Calling the method CloseAPI()" << endl;
result = (*MyCloseAPI)();
cout << "result of CloseAPI() = " << result << endl;
}
return 0;
}