Kinova API Documentation
KINOVAAPIUSBCOMMANDLAYER_API int SetActuatorPID ( unsigned int  address,
float  P,
float  I,
float  D 
)

This function set the PID of a specific actuator.

Warning:
Do not use this function if you don't know what you are doing!!!
Parameters:
addressthe address of the actuator. The first actuator start at the address 16 actuator #1 = 16, actuator 2 = 17, actuator 3 = 18, ...
PThe proportional part of the controller. (Suggested range [0, 2])
IThe integral part of the controller.
DThe derivative part of the Controller. (Suggested range [0, 0.1])
#include <iostream>
#include <dlfcn.h> //Ubuntu
#include <vector>
#include "KinovaTypes.h"
//Note that under windows, you may/will have to perform other #include

using namespace std;

int main()
{
        int result;

        cout << "SetActuatorPID function example" << endl;

        //Handle for the library's command layer.
        void * commandLayer_handle;

        //Function pointers to the functions we need
        int (*MyInitAPI)();
        int (*MyCloseAPI)();
        int (*MySetActuatorPID)(unsigned int address, int P, int I, int D);

        //We load the library (Under Windows, use the function LoadLibrary)
        commandLayer_handle = dlopen("Kinova.API.USBCommandLayerUbuntu.so",RTLD_NOW|RTLD_GLOBAL);

        //We load the functions from the library (Under Windows, use GetProcAddress)
        MyInitAPI = (int (*)()) dlsym(commandLayer_handle,"InitAPI");
        MyCloseAPI = (int (*)()) dlsym(commandLayer_handle,"CloseAPI");
        MySetActuatorPID = (int (*)(unsigned int, int, int, int )) dlsym(commandLayer_handle,"SetActuatorPID");

        //If the was loaded correctly
        if((MyInitAPI == NULL) || (MyCloseAPI == NULL) || (MySetActuatorPID == NULL) || (MySetActuatorPID == 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;

                //WARNING Don't modify those parameters if you don't know what you are doing.
                unsigned int ActuatorAddress = 16;
                int P = 0.5;
                int I = 0;
                int D = 0;

                cout << "Getting the client configurations the robotic arm." << endl;
                (*MySetActuatorPID)(ActuatorAddress, P, I, D);

                cout << endl << "Calling the method CloseAPI()" << endl;
                result = (*MyCloseAPI)();
                cout << "result of CloseAPI() = " << result << endl;
        }

        return 0;
}
 All Classes Files Functions Variables Enumerations Enumerator Defines