kni_wrapper.h
Go to the documentation of this file.
00001 /********************************************************************************
00002  * kni_wrapper.h - 
00003  * A wrapper for the kni library so that the C++ library 
00004  * can be accessed by C based environments (MatLab, LabView ...)
00005  * Copyright (C) Neuronics AG
00006  * Philipp Keller, Tino Perucchi, 2008
00007 ********************************************************************************/
00008 
00009 /* define EXPORT_FCNS before including this file in source files that build the library*/
00010 
00011 #ifndef _KNI_WRAPPER_H_
00012 #define _KNI_WRAPPER_H_
00013 
00014 #ifdef EXPORT_FCNS
00015         /********************************************************************************/
00016         #include "kniBase.h"
00017         #include "common/exception.h"
00018         #include <vector>
00019         /********************************************************************************/
00020         #ifdef WIN32
00021                 /*define a macro for marking functions for dllexport*/
00022                 #define DLLEXPORT __declspec(dllexport)
00023         #else
00024                 #define DLLEXPORT 
00025         #endif
00026 #else
00027         #ifdef WIN32
00028                 #define DLLEXPORT __declspec(dllimport)
00029         #else
00030                 #define DLLEXPORT
00031         #endif
00032 #endif
00033 
00034 const double PI = 3.14159265358979323846;
00035 //additional error codes
00036 enum{ 
00037         ERR_NONE = 0,
00038         ERR_SUCCESS = 1
00039 };
00040 
00041 /********************************************************************************/
00042 
00044 #ifdef __cplusplus
00045 extern "C" {
00046 #endif
00047 
00049         struct TPos{
00051                 double X, Y, Z;
00053                 double phi, theta, psi;
00054         };
00056         enum ETransition{
00058                 PTP = 1,
00060                 LINEAR = 2
00061         };
00063         struct TMovement{
00065                 TPos pos;
00067                 ETransition transition;
00069                 int velocity;
00071                 int acceleration;
00072         };
00074         struct TCurrentMot{
00075                 int idx;
00076                 bool running;
00077                 bool dir;
00078         };
00079 
00083         DLLEXPORT int  allMotorsOff();
00084         
00087         DLLEXPORT int  allMotorsOn();
00088 
00091         DLLEXPORT int  calibrate(int axis);
00092         
00094         DLLEXPORT int  clearMoveBuffers();
00095         
00101         DLLEXPORT int  closeGripper();  
00102         
00106         DLLEXPORT int  deleteMovementFromStack(char* name, int index);  
00107         
00109         DLLEXPORT int  deleteMovementStack(char* name); 
00110         
00116         DLLEXPORT int executeConnectedMovement(struct TMovement *movement, struct TPos *startPos,
00117                         bool first, bool last);
00118         
00121         DLLEXPORT int  executeMovement(struct TMovement *movement);
00122         
00124         DLLEXPORT int flushMoveBuffers();
00125         
00127         // length of value array at least 12, will be '\0' terminated
00128         DLLEXPORT int  getAxisFirmwareVersion(int axis, char value[]);  
00129         
00136         DLLEXPORT int  getDrive(int axis, int &value);  
00137         
00144         DLLEXPORT int  getEncoder(int axis, int &value);
00145 
00147         DLLEXPORT int  getNumberOfMotors();
00148 
00150         DLLEXPORT int  getPosition(struct TPos *pos);
00151 
00155         DLLEXPORT int  getVelocity(int axis, int &value);
00156 
00158         // length of value array at least 8, will be '\0' terminated
00159         DLLEXPORT int  getVersion(char value[]);
00160         
00162         DLLEXPORT int  initKatana(char* configFile, char* ipaddress);
00163         
00169         DLLEXPORT int  IO_readInput(int inputNr, int &value);
00170 
00171         //I/O Interface
00175         DLLEXPORT int  IO_setOutput(char output, int value);
00176 
00178         // and returns it in the value argument given by reference
00180         DLLEXPORT int  ModBusTCP_readWord(int address, int &value);
00181         
00184         DLLEXPORT int  ModBusTCP_writeWord(int address, int value);
00185 
00192         DLLEXPORT int  motorOff(int axis);
00193         
00200         DLLEXPORT int  motorOn(int axis);
00201         
00209         DLLEXPORT int  moveMot(int axis, int enc, int speed, int accel);
00210         
00219         DLLEXPORT int  moveMotAndWait(int axis, int targetpos, int tolerance);
00220         
00222         DLLEXPORT int  moveToPos(struct TPos *pos, int velocity, int acceleration);
00223         
00232         DLLEXPORT int  moveToPosEnc(int enc1, int enc2, int enc3, int enc4, int enc5, int enc6, int velocity, int acceleration, int tolerance, bool _wait);
00233         
00235         DLLEXPORT int  moveToPosLin(struct TPos *targetPos, int velocity, int acceleration);
00236         
00242         DLLEXPORT int  openGripper();
00243 
00248         DLLEXPORT int  ping(int axis);
00249 
00253         DLLEXPORT int  pushMovementToStack(struct TMovement *movement, char* name);
00254 
00258         DLLEXPORT int  runThroughMovementStack(char* name, int loops);
00259 
00260         //Linear Movement
00268         DLLEXPORT int  sendSplineToMotor(int axis, int targetpos, int duration, int p0, int p1, int p2, int p3);
00269         
00277         DLLEXPORT int  setCollisionDetection(int axis, bool state);
00278         
00284         DLLEXPORT int  setCollisionParameters(int axis, int position, int velocity);
00285         
00292         DLLEXPORT int  setControllerParameters(int axis, int ki, int kspeed, int kpos);
00293         
00300         DLLEXPORT int  setGripper(bool hasGripper);     
00301 
00308         DLLEXPORT int  setMaxAccel(int axis, int acceleration);
00309         
00317         DLLEXPORT int  setMaxVelocity(int axis, int vel);
00318         
00321         DLLEXPORT int  setPositionCollisionLimit(int axis, int limit);
00322         
00325         DLLEXPORT int  setVelocityCollisionLimit(int axis, int limit); 
00326         
00330         DLLEXPORT int  setForceLimit(int axis, int limit); 
00331         
00333         DLLEXPORT int  getForce(int axis); 
00334         
00337         DLLEXPORT int  getCurrentControllerType(int axis); 
00338         
00341         DLLEXPORT int  startSplineMovement(int contd, int exactflag);
00342 
00344         DLLEXPORT int  unblock();
00345 
00355         DLLEXPORT int  waitForMot(int axis, int targetpos, int tolerance);
00356                 
00357 //********************************************************************************/
00358 
00359 #ifdef __cplusplus
00360 }
00361 #endif
00362 
00363 
00364 #endif //_KNI_WRAPPER_H_
00365 


kni
Author(s): Neuronics AG (see AUTHORS.txt); ROS wrapper by Martin Günther
autogenerated on Mon Oct 6 2014 10:45:33