Kinova API Documentation
KINOVAAPIUSBCOMMANDLAYER_API int GetSingularityVector ( SingularityVector Response)

ONLY AVAILABLE WITH FIRMWARE 4.2.9 AND BELOW. This function gets informations about the nearest singularities.

Parameters:
ResponseThe structure containing the informations
#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;
        SingularityVector data;

        cout << "GetSingularityVector 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 (*MySingularityVector)(SingularityVector &);

        //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");
        MySingularityVector = (int (*)(SingularityVector &)) dlsym(commandLayer_handle,"GetSingularityVector");

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

                cout << "Orientation singularity : " << data.OrientationSingularityCount << endl;
                cout << "Orientation singularity's distance : " << data.OrientationSingularityDistance << endl;
                cout << "Translation singularity : " << data.TranslationSingularityCount << endl;
                cout << "Translation singularity's distance : " << data.TranslationSingularityDistance << endl;
                cout << "                Repulsion vector X : " << data.RepulsionVector.X << endl;
                cout << "                Repulsion vector Y : " << data.RepulsionVector.Y << endl;
                cout << "                Repulsion vector Z : " << data.RepulsionVector.Z << endl;
                cout << "Repulsion vector ThetaX : " << data.RepulsionVector.ThetaX << endl;
                cout << "Repulsion vector ThetaY : " << data.RepulsionVector.ThetaY << endl;
                cout << "Repulsion vector ThetaZ : " << data.RepulsionVector.ThetaZ << 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