Kinova API Documentation
KINOVAAPIUSBCOMMANDLAYER_API int GetActuatorAcceleration ( AngularAcceleration Response)

This function get the acceleration values of each actuator. Units are G.

Parameters:
ResponseAn AngularAcceleration struct containing the values. Units are G.
#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;
        int data;

        cout << "GetActuatorAcceleration 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 (*MyGetActuatorAcceleration)(AngularAcceleration &);

        //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");
        MyGetActuatorAcceleration = (int (*)(AngularAcceleration &)) dlsym(commandLayer_handle,"GetActuatorAcceleration");

        //If the was loaded correctly
        if((MyInitAPI == NULL) || (MyCloseAPI == NULL) || (MyGetActuatorAcceleration == NULL))
        {
                cout << "Unable to initialize the command layer." << endl;
        }
        else
        {
                cout << "The command has been initialized correctly." << endl << endl;

                AngularAcceleration data;
                data.InitStruct();

                cout << "Calling the method InitAPI()" << endl;
                result = (*MyInitAPI)();
                cout << "result of InitAPI() = " << result << endl << endl << endl;

                result = (*MyGetActuatorAcceleration)(data);

                cout << "               X      Y     Z" << endl;
                cout << "Actuator 1 :  " << data.Actuator1_X << "    " << data.Actuator1_Y << "    " << data.Actuator1_Z << endl;
                cout << "Actuator 2 :  " << data.Actuator2_X << "    " << data.Actuator2_Y << "    " << data.Actuator2_Z << endl;
                cout << "Actuator 3 :  " << data.Actuator3_X << "    " << data.Actuator3_Y << "    " << data.Actuator3_Z << endl;
                cout << "Actuator 4 :  " << data.Actuator4_X << "    " << data.Actuator4_Y << "    " << data.Actuator4_Z << endl;
                cout << "Actuator 5 :  " << data.Actuator5_X << "    " << data.Actuator5_Y << "    " << data.Actuator5_Z << endl;
                cout << "Actuator 6 :  " << data.Actuator6_X << "    " << data.Actuator6_Y << "    " << data.Actuator6_Z << endl;

                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