KatanaNativeInterface $VERSION$
kmlBase.h
Go to the documentation of this file.
1/*
2 * Katana Native Interface - A C++ interface to the robot arm Katana.
3 * Copyright (C) 2005 Neuronics AG
4 * Check out the AUTHORS file for detailed contact information.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21
25//--------------------------------------------------------------------------//
26#ifndef _KMLBASE_H_
27#define _KMLBASE_H_
28//--------------------------------------------------------------------------//
29#include "common/dllexport.h"
30
31#include "KNI/cplBase.h"
32#include "KNI/kmlCommon.h"
33#include "KNI/kmlMotBase.h"
34#include "KNI/kmlSctBase.h"
35
36#include "KNI/cdlCOM.h"
38
39
40//--------------------------------------------------------------------------//
42#define K400_OLD_PROTOCOL_THRESHOLD 1
43
44#if !defined (BYTE_DECLARED)
45#define BYTE_DECLARED
46typedef unsigned char byte;
47#endif
48
49//--------------------------------------------------------------------------//
50
51#define TM_ENDLESS -1
52
53//--------------------------------------------------------------------------//
54
55class CKatBase; //katana
56class CMotBase; //motor
57class CSctBase; //sensor contoller
58
59
60
61//--------------------------------------------------------------------------//
62// CKatBase ----------------------------------------------------------------//
63//--------------------------------------------------------------------------//
64
67struct TKatGNL {
68 byte adr;
69 char modelName[255];
70};
71
74struct TKatMFW {
75 byte ver;
76 byte rev;
77};
78
81struct TKatIDS {
82 byte strID[256];
83};
84
87struct TKatCTB {
88 byte cmdtbl[256];
89};
90
93struct TKatCBX {
94 bool inp[2];
95 bool out[2];
96};
97
100struct TKatECH {
101 byte echo;
102};
103
113struct TKatEFF {
114 double arr_segment[4];
115};
116
117
118
119//--------------------------------------------------------------------------//
120
133
134protected:
141
145
149
150public: const TKatGNL* GetGNL() { return &gnl; } const TKatMFW* GetMFW() { return &mfw; } const TKatIDS* GetIDS() { return &ids; } const TKatCTB* GetCTB() { return &ctb; } const TKatCBX* GetCBX() { return &cbx; } const TKatECH* GetECH() { return &ech; }
163 const TKatMOT* GetMOT() { return &mot; } const TKatSCT* GetSCT() { return &sct; } TKatEFF* GetEFF() { return &eff; }
170
171
175 virtual ~CKatBase() {}
176
177 virtual bool init(
178 const TKatGNL _gnl,
179 const TKatMOT _mot,
180 const TKatSCT _sct,
181 const TKatEFF _eff,
182 CCplBase* _protocol
183 );
184 void recvMFW(); void recvIDS(); void recvCTB(); void recvGMS(); void recvCBX(); void recvECH(); void recvNMP(); void recvMPS();
202 CCplBase* getProtocol(){return protocol;}
204 int checkKatanaType(int type);
205 void sendCBX(const TKatCBX* _cbx);
208 void sendTPSP();
213
218 void getMasterFirmware(short* fw, short* rev);
219 void enableCrashLimits(); void disableCrashLimits(); void unBlock();
230 void setCrashLimit(long idx, int limit);
233 void setPositionCollisionLimit(long idx, int limit);
236 void setSpeedCollisionLimit(long idx, int limit);
237
241 void startSplineMovement(bool exactflag, int moreflag = 1);
242
245 void startFourSplinesMovement(bool exactflag);
246 void sendSLMP(byte* p);
249 void sendSLM(bool exactflag);
252
253};
254
255
256
257
258
259/****************************************************************************/
260#endif //_KMLBASE_H_
261/****************************************************************************/
Abstract base class for protocol definiton.
Definition: cplBase.h:47
Base Katana class.
Definition: kmlBase.h:132
TKatMFW mfw
master's firmware version/revision
Definition: kmlBase.h:136
TKatCBX cbx
connector box
Definition: kmlBase.h:139
void setCrashLimit(long idx, int limit)
set collision limits
TKatSCT sct
sensor controllers
Definition: kmlBase.h:143
void setPositionCollisionLimit(long idx, int limit)
set collision position limits
void startFourSplinesMovement(bool exactflag)
Start a fourSplines movement.
CCplBase * getProtocol()
get a handle of the protocol, used in CKatana
Definition: kmlBase.h:202
virtual bool init(const TKatGNL _gnl, const TKatMOT _mot, const TKatSCT _sct, const TKatEFF _eff, CCplBase *_protocol)
short mMasterVersion
master version of robot we are communicating with
Definition: kmlBase.h:147
TKatECH ech
echo
Definition: kmlBase.h:140
TKatMOT mot
motors
Definition: kmlBase.h:142
TKatCTB ctb
cmd table
Definition: kmlBase.h:138
CKatBase()
Definition: kmlBase.h:172
TKatIDS ids
ID string.
Definition: kmlBase.h:137
TKatGNL gnl
katana general
Definition: kmlBase.h:135
void startSplineMovement(bool exactflag, int moreflag=1)
Start a spline movement.
virtual ~CKatBase()
destructor
Definition: kmlBase.h:175
short mMasterRevision
master firmware revision
Definition: kmlBase.h:148
void setSpeedCollisionLimit(long idx, int limit)
set collision speed limits
int checkKatanaType(int type)
checks for a K300 or K400
TKatEFF eff
end effector
Definition: kmlBase.h:144
CCplBase * protocol
protocol interface
Definition: kmlBase.h:146
void getMasterFirmware(short *fw, short *rev)
Get the master firmware of the robot we are communicating with.
Motor class.
Definition: kmlMotBase.h:219
Sensor Controller class.
Definition: kmlSctBase.h:72
#define DLLDIR
Definition: dllexport.h:30
unsigned char byte
type specification (8 bit)
Definition: kmlBase.h:46
[CBX] connector box
Definition: kmlBase.h:93
bool out[2]
output: green & red LED
Definition: kmlBase.h:95
bool inp[2]
input: green & red LED
Definition: kmlBase.h:94
[CTB] command table defined in the firmware
Definition: kmlBase.h:87
byte cmdtbl[256]
command table
Definition: kmlBase.h:88
[ECH] echo
Definition: kmlBase.h:100
byte echo
echo answer
Definition: kmlBase.h:101
Inverse Kinematics structure of the endeffektor.
Definition: kmlBase.h:113
double arr_segment[4]
length of the Katana segments
Definition: kmlBase.h:114
[GNL] general robot attributes
Definition: kmlBase.h:67
byte adr
jumper adress
Definition: kmlBase.h:68
char modelName[255]
model name
Definition: kmlBase.h:69
[IDS] identification string
Definition: kmlBase.h:81
byte strID[256]
id string
Definition: kmlBase.h:82
[MFW] master firmware version/revision number
Definition: kmlBase.h:74
byte rev
revision
Definition: kmlBase.h:76
byte ver
version
Definition: kmlBase.h:75
[MOT] every motor's attributes
Definition: kmlMotBase.h:40
[SCT] every sens ctrl's attributes
Definition: kmlSctBase.h:41