kni_wrapper.h
Go to the documentation of this file.
1 /********************************************************************************
2  * kni_wrapper.h -
3  * A wrapper for the kni library so that the C++ library
4  * can be accessed by C based environments (MatLab, LabView ...)
5  * Copyright (C) Neuronics AG
6  * Philipp Keller, Tino Perucchi, 2008
7 ********************************************************************************/
8 
9 /* define EXPORT_FCNS before including this file in source files that build the library*/
10 
11 #ifndef _KNI_WRAPPER_H_
12 #define _KNI_WRAPPER_H_
13 
14 #ifdef EXPORT_FCNS
15  /********************************************************************************/
16  #include "kniBase.h"
17  #include "common/exception.h"
18  #include <vector>
19  /********************************************************************************/
20  #ifdef WIN32
21  /*define a macro for marking functions for dllexport*/
22  #define DLLEXPORT __declspec(dllexport)
23  #else
24  #define DLLEXPORT
25  #endif
26 #else
27  #ifdef WIN32
28  #define DLLEXPORT __declspec(dllimport)
29  #else
30  #define DLLEXPORT
31  #endif
32 #endif
33 
34 const double PI = 3.14159265358979323846;
35 //additional error codes
36 enum{
37  ERR_NONE = 0,
39 };
40 
41 /********************************************************************************/
42 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
49  struct TPos{
51  double X, Y, Z;
53  double phi, theta, psi;
54  };
58  PTP = 1,
60  LINEAR = 2
61  };
63  struct TMovement{
69  int velocity;
72  };
74  struct TCurrentMot{
75  int idx;
76  bool running;
77  bool dir;
78  };
79 
83  DLLEXPORT int allMotorsOff();
84 
87  DLLEXPORT int allMotorsOn();
88 
91  DLLEXPORT int calibrate(int axis);
92 
95 
101  DLLEXPORT int closeGripper();
102 
106  DLLEXPORT int deleteMovementFromStack(char* name, int index);
107 
109  DLLEXPORT int deleteMovementStack(char* name);
110 
116  DLLEXPORT int executeConnectedMovement(struct TMovement *movement, struct TPos *startPos,
117  bool first, bool last);
118 
121  DLLEXPORT int executeMovement(struct TMovement *movement);
122 
125 
127  // length of value array at least 12, will be '\0' terminated
128  DLLEXPORT int getAxisFirmwareVersion(int axis, char value[]);
129 
136  DLLEXPORT int getDrive(int axis, int &value);
137 
144  DLLEXPORT int getEncoder(int axis, int &value);
145 
148 
150  DLLEXPORT int getPosition(struct TPos *pos);
151 
155  DLLEXPORT int getVelocity(int axis, int &value);
156 
158  // length of value array at least 8, will be '\0' terminated
159  DLLEXPORT int getVersion(char value[]);
160 
162  DLLEXPORT int initKatana(char* configFile, char* ipaddress);
163 
169  DLLEXPORT int IO_readInput(int inputNr, int &value);
170 
171  //I/O Interface
175  DLLEXPORT int IO_setOutput(char output, int value);
176 
178  // and returns it in the value argument given by reference
180  DLLEXPORT int ModBusTCP_readWord(int address, int &value);
181 
184  DLLEXPORT int ModBusTCP_writeWord(int address, int value);
185 
192  DLLEXPORT int motorOff(int axis);
193 
200  DLLEXPORT int motorOn(int axis);
201 
209  DLLEXPORT int moveMot(int axis, int enc, int speed, int accel);
210 
219  DLLEXPORT int moveMotAndWait(int axis, int targetpos, int tolerance);
220 
222  DLLEXPORT int moveToPos(struct TPos *pos, int velocity, int acceleration);
223 
232  DLLEXPORT int moveToPosEnc(int enc1, int enc2, int enc3, int enc4, int enc5, int enc6, int velocity, int acceleration, int tolerance, bool _wait);
233 
235  DLLEXPORT int moveToPosLin(struct TPos *targetPos, int velocity, int acceleration);
236 
242  DLLEXPORT int openGripper();
243 
248  DLLEXPORT int ping(int axis);
249 
253  DLLEXPORT int pushMovementToStack(struct TMovement *movement, char* name);
254 
258  DLLEXPORT int runThroughMovementStack(char* name, int loops);
259 
260  //Linear Movement
268  DLLEXPORT int sendSplineToMotor(int axis, int targetpos, int duration, int p0, int p1, int p2, int p3);
269 
277  DLLEXPORT int setCollisionDetection(int axis, bool state);
278 
284  DLLEXPORT int setCollisionParameters(int axis, int position, int velocity);
285 
292  DLLEXPORT int setControllerParameters(int axis, int ki, int kspeed, int kpos);
293 
300  DLLEXPORT int setGripper(bool hasGripper);
301 
308  DLLEXPORT int setMaxAccel(int axis, int acceleration);
309 
317  DLLEXPORT int setMaxVelocity(int axis, int vel);
318 
321  DLLEXPORT int setPositionCollisionLimit(int axis, int limit);
322 
325  DLLEXPORT int setVelocityCollisionLimit(int axis, int limit);
326 
330  DLLEXPORT int setForceLimit(int axis, int limit);
331 
333  DLLEXPORT int getForce(int axis);
334 
337  DLLEXPORT int getCurrentControllerType(int axis);
338 
341  DLLEXPORT int startSplineMovement(int contd, int exactflag);
342 
344  DLLEXPORT int unblock();
345 
355  DLLEXPORT int waitForMot(int axis, int targetpos, int tolerance);
356 
357 //********************************************************************************/
358 
359 #ifdef __cplusplus
360 }
361 #endif
362 
363 
364 #endif //_KNI_WRAPPER_H_
365 
double phi
the orientation of the TCP
Definition: kni_wrapper.h:53
int acceleration
DLLEXPORT int moveMotAndWait(int axis, int targetpos, int tolerance)
DLLEXPORT int getDrive(int axis, int &value)
DLLEXPORT int moveToPosEnc(int enc1, int enc2, int enc3, int enc4, int enc5, int enc6, int velocity, int acceleration, int tolerance, bool _wait)
DLLEXPORT int clearMoveBuffers()
clears the movebuffers
DLLEXPORT int IO_readInput(int inputNr, int &value)
DLLEXPORT int setPositionCollisionLimit(int axis, int limit)
Point-to-point movement.
Definition: kni_wrapper.h:58
DLLEXPORT int setVelocityCollisionLimit(int axis, int limit)
ETransition transition
the transition to this position, PTP or LINEAR
Definition: kni_wrapper.h:67
DLLEXPORT int closeGripper()
TPos pos
The position, see above struct TPos.
Definition: kni_wrapper.h:65
DLLEXPORT int setMaxAccel(int axis, int acceleration)
DLLEXPORT int deleteMovementStack(char *name)
deletes a movemnt stack
DLLEXPORT int motorOff(int axis)
#define DLLEXPORT
Definition: kni_wrapper.h:30
DLLEXPORT int getForce(int axis)
set the current force
DLLEXPORT int getCurrentControllerType(int axis)
DLLEXPORT int executeConnectedMovement(struct TMovement *movement, struct TPos *startPos, bool first, bool last)
DLLEXPORT int moveMot(int axis, int enc, int speed, int accel)
Definition: kni_wrapper.cpp:77
extern C because we want to access these interfaces from anywhere:
Definition: kni_wrapper.h:49
double Z
Definition: kni_wrapper.h:51
DLLEXPORT int getPosition(struct TPos *pos)
gets a position
int velocity
The velocitiy for this particular movement.
Definition: kni_wrapper.h:69
DLLEXPORT int getVersion(char value[])
gets the controlboard firmware version and returns it in the value argument
DLLEXPORT int allMotorsOn()
DLLEXPORT int setForceLimit(int axis, int limit)
DLLEXPORT int motorOn(int axis)
DLLEXPORT int setControllerParameters(int axis, int ki, int kspeed, int kpos)
linear movement
Definition: kni_wrapper.h:60
ETransition
the transition types for a movement
Definition: kni_wrapper.h:56
DLLEXPORT int IO_setOutput(char output, int value)
DLLEXPORT int executeMovement(struct TMovement *movement)
DLLEXPORT int moveToPosLin(struct TPos *targetPos, int velocity, int acceleration)
moves in LM
DLLEXPORT int calibrate(int axis)
Definition: kni_wrapper.cpp:63
DLLEXPORT int deleteMovementFromStack(char *name, int index)
int acceleration
the acceleration for this particular movement
Definition: kni_wrapper.h:71
structure for the currently active axis
Definition: control.cpp:45
DLLEXPORT int pushMovementToStack(struct TMovement *movement, char *name)
double X
The position in cartesian space.
Definition: kni_wrapper.h:51
DLLEXPORT int getAxisFirmwareVersion(int axis, char value[])
gets the axis firmware version and returns it in the value argument
DLLEXPORT int runThroughMovementStack(char *name, int loops)
DLLEXPORT int setMaxVelocity(int axis, int vel)
int enc[10]
DLLEXPORT int ModBusTCP_readWord(int address, int &value)
reads a value from the register &#39;address&#39; (if not connected, connect to the IP in katana...
const double PI
Definition: kni_wrapper.h:34
DLLEXPORT int moveToPos(struct TPos *pos, int velocity, int acceleration)
moves in IK
DLLEXPORT int openGripper()
DLLEXPORT int setCollisionDetection(int axis, bool state)
DLLEXPORT int getNumberOfMotors()
returns the number of motors configured
double psi
Definition: kni_wrapper.h:53
structure for the
Definition: kni_wrapper.h:63
DLLEXPORT int startSplineMovement(int contd, int exactflag)
DLLEXPORT int getEncoder(int axis, int &value)
int velocity
DLLEXPORT int setCollisionParameters(int axis, int position, int velocity)
double Y
Definition: kni_wrapper.h:51
DLLEXPORT int initKatana(char *configFile, char *ipaddress)
This initializes the Katana (communication etc)
Definition: kni_wrapper.cpp:39
DLLEXPORT int flushMoveBuffers()
flush all the movebuffers
DLLEXPORT int ping(int axis)
DLLEXPORT int ModBusTCP_writeWord(int address, int value)
DLLEXPORT int setGripper(bool hasGripper)
DLLEXPORT int sendSplineToMotor(int axis, int targetpos, int duration, int p0, int p1, int p2, int p3)
DLLEXPORT int allMotorsOff()
DLLEXPORT int getVelocity(int axis, int &value)
DLLEXPORT int unblock()
unblocks the robot after collision/instantstop
double theta
Definition: kni_wrapper.h:53
DLLEXPORT int waitForMot(int axis, int targetpos, int tolerance)
Definition: kni_wrapper.cpp:92


kni
Author(s): Martin Günther
autogenerated on Fri Jan 3 2020 04:01:16