$search
00001 /* -------------------------------------------------------------------------------- 00002 # 00003 # libKinematics.h 00004 # Project : Kinematics 00005 # author : jhaller 00006 # 24.04.2008 00007 # 00008 # --------------------------------------------------------------------------------*/ 00009 00010 /* 00011 * Kinematics library. 00012 * 00013 * General usage: kin_setType or (kin_setMDH and than kin_setImmob if needed, 00014 * kin_setEPC, kin_setEncOff, kin_setRotDir, kin_setAngOff and kin_setAngRan), 00015 * then kin_init, then use the conversion and kinematics functions. 00016 */ 00017 00018 #ifndef WIN32 00019 #define _declspec(dllexport) 00020 #endif // ifndef WIN32 00021 00022 #ifdef WIN32 00023 #include <windows.h> 00024 #endif // ifdef WIN32 00025 #include <stdio.h> 00026 #include <vector> 00027 #include <iostream> 00028 #include <string> 00029 #include <cmath> 00030 #include <fstream> 00031 #include <ctime> 00032 00033 #include "kinematics.h" 00034 00035 extern "C"{ 00036 00037 00039 00040 // This structure holds an int array including its length. 00041 typedef struct IntVector 00042 { 00043 int length; 00044 int data[MaxDof]; 00045 } IntVector; 00046 // This structure holds a float array including its length. 00047 typedef struct FloatVector 00048 { 00049 int length; 00050 float data[MaxDof]; 00051 } FloatVector; 00052 00054 00070 _declspec(dllexport) int kin_setType(int type); 00071 00088 _declspec(dllexport) int kin_setMDH(FloatVector* theta, FloatVector* d, 00089 FloatVector* a, FloatVector* alpha, int typeNr = -1); 00090 00101 _declspec(dllexport) int kin_setLinkLen(FloatVector* links); 00102 00112 _declspec(dllexport) int kin_setImmob(int immobile); 00113 00122 _declspec(dllexport) int kin_setEPC(IntVector* epc); 00123 00132 _declspec(dllexport) int kin_setEncOff(IntVector* encOffset); 00133 00144 _declspec(dllexport) int kin_setRotDir(IntVector* rotDir); 00145 00154 _declspec(dllexport) int kin_setAngOff(FloatVector* angleOffset); 00155 00165 _declspec(dllexport) int kin_setAngRan(FloatVector* angleRange); 00166 00175 _declspec(dllexport) int kin_setTcpOff(FloatVector* tcpOffset); 00176 00178 00186 _declspec(dllexport) int kin_getType(); 00187 00194 _declspec(dllexport) int kin_getMaxDOF(); 00195 00202 _declspec(dllexport) int kin_getDOF(); 00203 00210 _declspec(dllexport) int kin_getDOM(); 00211 00221 _declspec(dllexport) int kin_getMDH(FloatVector* theta, FloatVector* d, 00222 FloatVector* a, FloatVector* alpha); 00223 00228 _declspec(dllexport) int kin_getImmob(); 00229 00235 _declspec(dllexport) int kin_getEPC(IntVector* epc); 00236 00242 _declspec(dllexport) int kin_getEncOff(IntVector* encOffset); 00243 00249 _declspec(dllexport) int kin_getRotDir(IntVector* rotDir); 00250 00257 _declspec(dllexport) int kin_getAngOff(FloatVector* angleOffset); 00258 00265 _declspec(dllexport) int kin_getAngRan(FloatVector* angleRange); 00266 00272 _declspec(dllexport) int kin_getTcpOff(FloatVector* tcpOffset); 00273 00279 _declspec(dllexport) int kin_getVersion(IntVector* version); 00280 00282 00291 _declspec(dllexport) int kin_init(); 00292 00294 00301 _declspec(dllexport) int kin_clean(); 00302 00304 00313 _declspec(dllexport) int kin_K4D2mDHAng(FloatVector* angleK4D, FloatVector* angleMDH); 00314 00323 _declspec(dllexport) int kin_mDH2K4DAng(FloatVector* angleMDH, FloatVector* angleK4D); 00324 00333 _declspec(dllexport) int kin_enc2rad(IntVector* enc, FloatVector* angle); 00334 00343 _declspec(dllexport) int kin_rad2enc(FloatVector* angle, IntVector* enc); 00344 00353 _declspec(dllexport) int kin_DK(FloatVector* angle, FloatVector* pose); 00354 00365 _declspec(dllexport) int kin_IK(FloatVector* pose, FloatVector* prev, 00366 FloatVector* angle, int maxBisection = 0); 00367 00368 } // extern c 00369 00370 00371