Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009 #include <jaco_driver/jaco_api.h>
00010 #include <vector>
00011
00012
00013 namespace jaco
00014 {
00015
00016 void* checkApiInit(void * usbLib, const char* name)
00017 {
00018 void * function_pointer = dlsym(usbLib, name);
00019 assert(function_pointer != NULL);
00020 return function_pointer;
00021 }
00022
00023
00024 JacoAPI::JacoAPI(void)
00025 {
00026 void *usbLib = dlopen(JACO_USB_LIBRARY, RTLD_NOW | RTLD_GLOBAL);
00027 if (usbLib == NULL)
00028 {
00029 ROS_WARN("%s", dlerror());
00030 }
00031
00032 initAPI = (int (*)())checkApiInit(usbLib, "InitAPI");
00033
00034 closeAPI = (int (*)())checkApiInit(usbLib, "CloseAPI");
00035
00036 getAPIVersion = (int (*)(std::vector<int> &))checkApiInit(usbLib, "GetAPIVersion");
00037
00038 getDevices = (int (*)(std::vector<KinovaDevice> &, int &))checkApiInit(usbLib, "GetDevices");
00039
00040 setActiveDevice = (int (*)(KinovaDevice))checkApiInit(usbLib, "SetActiveDevice");
00041
00042 getCodeVersion = (int (*)(std::vector<int> &))checkApiInit(usbLib, "GetCodeVersion");
00043
00044 getGeneralInformations = (int (*)(GeneralInformations &))checkApiInit(usbLib, "GetGeneralInformations");
00045
00046 getCartesianPosition = (int (*)(CartesianPosition &))checkApiInit(usbLib, "GetCartesianPosition");
00047
00048 getAngularPosition = (int (*)(AngularPosition &))checkApiInit(usbLib, "GetAngularPosition");
00049
00050 getCartesianForce = (int (*)(CartesianPosition &))checkApiInit(usbLib, "GetCartesianForce");
00051
00052 getAngularForce = (int (*)(AngularPosition &))checkApiInit(usbLib, "GetAngularForce");
00053
00054 getAngularCurrent = (int (*)(AngularPosition &))checkApiInit(usbLib, "GetAngularCurrent");
00055
00056 getActualTrajectoryInfo = (int (*)(TrajectoryPoint &))checkApiInit(usbLib, "GetActualTrajectoryInfo");
00057
00058 getGlobalTrajectoryInfo = (int (*)(TrajectoryFIFO &))checkApiInit(usbLib, "GetGlobalTrajectoryInfo");
00059
00060 getSensorsInfo = (int (*)(SensorsInfo &))checkApiInit(usbLib, "GetSensorsInfo");
00061
00062 setAngularControl = (int (*)())checkApiInit(usbLib, "SetAngularControl");
00063
00064 setCartesianControl = (int (*)())checkApiInit(usbLib, "SetCartesianControl");
00065
00066 startControlAPI = (int (*)())checkApiInit(usbLib, "StartControlAPI");
00067
00068 stopControlAPI = (int (*)())checkApiInit(usbLib, "StopControlAPI");
00069
00070 moveHome = (int (*)())checkApiInit(usbLib, "MoveHome");
00071
00072 initFingers = (int (*)())checkApiInit(usbLib, "InitFingers");
00073
00074 restoreFactoryDefault = (int (*)())checkApiInit(usbLib, "RestoreFactoryDefault");
00075
00076 sendJoystickCommand = (int (*)(JoystickCommand))checkApiInit(usbLib, "SendJoystickCommand");
00077
00078 sendAdvanceTrajectory = (int (*)(TrajectoryPoint))checkApiInit(usbLib, "SendAdvanceTrajectory");
00079
00080 sendBasicTrajectory = (int (*)(TrajectoryPoint))checkApiInit(usbLib, "SendBasicTrajectory");
00081
00082 getControlType = (int (*)(int &)) checkApiInit(usbLib, "GetControlType");
00083
00084 getQuickStatus = (int (*)(QuickStatus &))checkApiInit(usbLib, "GetQuickStatus");
00085
00086 getClientConfigurations = (int (*)(ClientConfigurations &))checkApiInit(usbLib, "GetClientConfigurations");
00087
00088 setClientConfigurations = (int (*)( ClientConfigurations))checkApiInit(usbLib, "SetClientConfigurations");
00089
00090 eraseAllTrajectories = (int (*)())checkApiInit(usbLib, "EraseAllTrajectories");
00091
00092 getPositionCurrentActuators = (int (*)(std::vector<float> &))checkApiInit(usbLib, "GetPositionCurrentActuators");
00093
00094 setActuatorPID = (int (*)(unsigned int, float, float, float))checkApiInit(usbLib, "SetActuatorPID");
00095 }
00096
00097 }