Kinova API Documentation
KINOVAAPIUSBCOMMANDLAYER_API int SendBasicTrajectory ( TrajectoryPoint  trajectory)

This function sends trajectory point(Without limitation) that will be added in the robotical arm's FIFO.

Parameters:
trajectoryThe trajectory point that you need to send to the robotical arm.
#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 << "SendBasicTrajectory 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 (*MySendBasicTrajectory)(TrajectoryPoint command);
        int (*MyStartControlAPI)();

        //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");
        MySendBasicTrajectory = (int (*)(TrajectoryPoint)) dlsym(commandLayer_handle,"SendBasicTrajectory");
        MyStartControlAPI = (int (*)()) dlsym(commandLayer_handle,"StartControlAPI");

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

                cout << "We take control of the robotic arm." << endl;
                result = (*MyStartControlAPI)();

                //We prepare the virtual joystick command that will be sent to the robotic arm.
                TrajectoryPoint trajectoryPoint;

                trajectoryPoint.InitStruct();

                trajectoryPoint.Position.HandMode = HAND_NOMOVEMENT;
                trajectoryPoint.Position.Type = CARTESIAN_POSITION;

                trajectoryPoint.Position.CartesianPosition.X = 0.214f;
                trajectoryPoint.Position.CartesianPosition.Y = -0.465f;
                trajectoryPoint.Position.CartesianPosition.Z = 0.497f;

                //We set the orientation part of the position (unit is RAD)
                trajectoryPoint.Position.CartesianPosition.ThetaX = 1.56f;
                trajectoryPoint.Position.CartesianPosition.ThetaY = 0.81f;
                trajectoryPoint.Position.CartesianPosition.ThetaZ = 0.04f;

                (*MySendBasicTrajectory)(trajectoryPoint);

                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