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"
37 #include "KNI/cdlCOMExceptions.h"
38 
39 
40 //--------------------------------------------------------------------------//
42 #define K400_OLD_PROTOCOL_THRESHOLD 1
43 
44 #if !defined (BYTE_DECLARED)
45 #define BYTE_DECLARED
46 typedef unsigned char byte;
47 #endif
48 
49 //--------------------------------------------------------------------------//
50 
51 #define TM_ENDLESS -1
52 
53 //--------------------------------------------------------------------------//
54 
55 class CKatBase; //katana
56 class CMotBase; //motor
57 class CSctBase; //sensor contoller
58 
59 
60 
61 //--------------------------------------------------------------------------//
62 // CKatBase ----------------------------------------------------------------//
63 //--------------------------------------------------------------------------//
64 
67 struct TKatGNL {
68  byte adr;
69  char modelName[255];
70 };
71 
74 struct TKatMFW {
75  byte ver;
76  byte rev;
77 };
78 
81 struct TKatIDS {
82  byte strID[256];
83 };
84 
87 struct TKatCTB {
88  byte cmdtbl[256];
89 };
90 
93 struct TKatCBX {
94  bool inp[2];
95  bool out[2];
96 };
97 
100 struct TKatECH {
101  byte echo;
102 };
103 
113 struct TKatEFF {
114  double arr_segment[4];
115 };
116 
117 
118 
119 //--------------------------------------------------------------------------//
120 
133 
134 protected:
141 
145 
149 
150 public: 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 
172  CKatBase() {}
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 /****************************************************************************/
CKatBase::ids
TKatIDS ids
ID string.
Definition: kmlBase.h:137
TKatIDS
[IDS] identification string
Definition: kmlBase.h:81
dllexport.h
CKatBase::CKatBase
CKatBase()
Definition: kmlBase.h:172
TKatGNL::adr
byte adr
jumper adress
Definition: kmlBase.h:68
CKatBase::eff
TKatEFF eff
end effector
Definition: kmlBase.h:144
TKatCTB
[CTB] command table defined in the firmware
Definition: kmlBase.h:87
CMotBase
Motor class.
Definition: kmlMotBase.h:219
CKatBase::~CKatBase
virtual ~CKatBase()
destructor
Definition: kmlBase.h:175
CKatBase::init
virtual bool init(const TKatGNL _gnl, const TKatMOT _mot, const TKatSCT _sct, const TKatEFF _eff, CCplBase *_protocol)
cplBase.h
kmlSctBase.h
CKatBase::ech
TKatECH ech
echo
Definition: kmlBase.h:140
cdlCOMExceptions.h
CKatBase::mMasterVersion
short mMasterVersion
master version of robot we are communicating with
Definition: kmlBase.h:147
CKatBase::mfw
TKatMFW mfw
master's firmware version/revision
Definition: kmlBase.h:136
TKatEFF::arr_segment
double arr_segment[4]
length of the Katana segments
Definition: kmlBase.h:114
TKatECH
[ECH] echo
Definition: kmlBase.h:100
TKatCBX
[CBX] connector box
Definition: kmlBase.h:93
TKatIDS::strID
byte strID[256]
id string
Definition: kmlBase.h:82
TKatEFF
Inverse Kinematics structure of the endeffektor.
Definition: kmlBase.h:113
CKatBase::setSpeedCollisionLimit
void setSpeedCollisionLimit(long idx, int limit)
set collision speed limits
CKatBase::getProtocol
CCplBase * getProtocol()
get a handle of the protocol, used in CKatana
Definition: kmlBase.h:202
TKatMFW
[MFW] master firmware version/revision number
Definition: kmlBase.h:74
CKatBase::sct
TKatSCT sct
sensor controllers
Definition: kmlBase.h:143
CKatBase::setCrashLimit
void setCrashLimit(long idx, int limit)
set collision limits
CKatBase::checkKatanaType
int checkKatanaType(int type)
checks for a K300 or K400
TKatCBX::out
bool out[2]
output: green & red LED
Definition: kmlBase.h:95
CKatBase::gnl
TKatGNL gnl
katana general
Definition: kmlBase.h:135
CKatBase::cbx
TKatCBX cbx
connector box
Definition: kmlBase.h:139
CKatBase
Base Katana class.
Definition: kmlBase.h:132
TKatMFW::rev
byte rev
revision
Definition: kmlBase.h:76
TKatECH::echo
byte echo
echo answer
Definition: kmlBase.h:101
CKatBase::mMasterRevision
short mMasterRevision
master firmware revision
Definition: kmlBase.h:148
kmlCommon.h
CKatBase::ctb
TKatCTB ctb
cmd table
Definition: kmlBase.h:138
TKatCBX::inp
bool inp[2]
input: green & red LED
Definition: kmlBase.h:94
CSctBase
Sensor Controller class.
Definition: kmlSctBase.h:72
CCplBase
Abstract base class for protocol definiton.
Definition: cplBase.h:47
CKatBase::setPositionCollisionLimit
void setPositionCollisionLimit(long idx, int limit)
set collision position limits
CKatBase::startSplineMovement
void startSplineMovement(bool exactflag, int moreflag=1)
Start a spline movement.
TKatCTB::cmdtbl
byte cmdtbl[256]
command table
Definition: kmlBase.h:88
TKatMOT
[MOT] every motor's attributes
Definition: kmlMotBase.h:40
TKatSCT
[SCT] every sens ctrl's attributes
Definition: kmlSctBase.h:41
TKatGNL
[GNL] general robot attributes
Definition: kmlBase.h:67
CKatBase::protocol
CCplBase * protocol
protocol interface
Definition: kmlBase.h:146
TKatGNL::modelName
char modelName[255]
model name
Definition: kmlBase.h:69
CKatBase::mot
TKatMOT mot
motors
Definition: kmlBase.h:142
CKatBase::getMasterFirmware
void getMasterFirmware(short *fw, short *rev)
Get the master firmware of the robot we are communicating with.
DLLDIR
#define DLLDIR
Definition: dllexport.h:30
byte
unsigned char byte
type specification (8 bit)
Definition: kmlBase.h:46
cdlCOM.h
kmlMotBase.h
TKatMFW::ver
byte ver
version
Definition: kmlBase.h:75
CKatBase::startFourSplinesMovement
void startFourSplinesMovement(bool exactflag)
Start a fourSplines movement.