This function sets a PID filter value on a specific actuator. Mainly used for calibration.
#include <iostream>
#include <dlfcn.h>
#include <vector>
#include "KinovaTypes.h"
using namespace std;
int main()
{
int result;
cout << "SetActuatorPIDFilter function example" << endl;
void * commandLayer_handle;
int (*MyInitAPI)();
int (*MyCloseAPI)();
int (*MySetActuatorPIDFilter)(int ActuatorAdress, float filterP, float filterI, float filterD);
commandLayer_handle = dlopen("Kinova.API.USBCommandLayerUbuntu.so",RTLD_NOW|RTLD_GLOBAL);
MyInitAPI = (int (*)()) dlsym(commandLayer_handle,"InitAPI");
MyCloseAPI = (int (*)()) dlsym(commandLayer_handle,"CloseAPI");
MySetActuatorPIDFilter = (int (*)(int, float, float, float)) dlsym(commandLayer_handle,"SetActuatorPIDFilter");
if((MyInitAPI == NULL) || (MyCloseAPI == NULL) || (MySetActuatorPIDFilter == 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 = (*MySetActuatorPIDFilter)(16, 200.0f, 200.0f, 200.0f);
cout << "A specific filter has been set on the first actuator(address)" << endl;
cout << endl << "Calling the method CloseAPI()" << endl;
result = (*MyCloseAPI)();
cout << "result of CloseAPI() = " << result << endl;
}
return 0;
}