kmlBase.h
Go to the documentation of this file.
00001 /*
00002  *   Katana Native Interface - A C++ interface to the robot arm Katana.
00003  *   Copyright (C) 2005 Neuronics AG
00004  *   Check out the AUTHORS file for detailed contact information.
00005  *
00006  *   This program is free software; you can redistribute it and/or modify
00007  *   it under the terms of the GNU General Public License as published by
00008  *   the Free Software Foundation; either version 2 of the License, or
00009  *   (at your option) any later version.
00010  *
00011  *   This program is distributed in the hope that it will be useful,
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *   GNU General Public License for more details.
00015  *
00016  *   You should have received a copy of the GNU General Public License
00017  *   along with this program; if not, write to the Free Software
00018  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  */
00020 
00021 
00025 //--------------------------------------------------------------------------//
00026 #ifndef _KMLBASE_H_
00027 #define _KMLBASE_H_
00028 //--------------------------------------------------------------------------//
00029 #include "common/dllexport.h"
00030 
00031 #include "KNI/cplBase.h"
00032 #include "KNI/kmlCommon.h"
00033 #include "KNI/kmlMotBase.h"
00034 #include "KNI/kmlSctBase.h"
00035 
00036 #include "KNI/cdlCOM.h"
00037 #include "KNI/cdlCOMExceptions.h"
00038 
00039 
00040 //--------------------------------------------------------------------------//
00042 #define K400_OLD_PROTOCOL_THRESHOLD 3
00043 
00044 #if !defined (BYTE_DECLARED)
00045 #define BYTE_DECLARED
00046 typedef unsigned char byte;     
00047 #endif
00048 
00049 //--------------------------------------------------------------------------//
00050 
00051 #define TM_ENDLESS -1   //!< timeout symbol for 'endless' waiting
00052 
00053 //--------------------------------------------------------------------------//
00054 
00055 class CKatBase; //katana
00056 class CMotBase; //motor
00057 class CSctBase; //sensor contoller
00058 
00059 
00060 
00061 //--------------------------------------------------------------------------//
00062 // CKatBase ----------------------------------------------------------------//
00063 //--------------------------------------------------------------------------//
00064 
00067 struct  TKatGNL {
00068         byte            adr;                    
00069         char            modelName[255]; 
00070 };
00071 
00074 struct  TKatMFW {
00075         byte            ver;                    
00076         byte            rev;                    
00077 };
00078 
00081 struct  TKatIDS {
00082         byte            strID[256];             
00083 };
00084 
00087 struct  TKatCTB {
00088         byte            cmdtbl[256];    
00089 };
00090 
00093 struct TKatCBX {
00094         bool inp[2];                            
00095         bool out[2];                            
00096 };
00097 
00100 struct  TKatECH {
00101         byte            echo;                   
00102 };
00103 
00113 struct TKatEFF {
00114         double          arr_segment[4];         
00115 };
00116 
00117 
00118 
00119 //--------------------------------------------------------------------------//
00120 
00132 class  DLLDIR CKatBase {
00133 
00134 protected:
00135         TKatGNL gnl;    
00136         TKatMFW mfw;    
00137         TKatIDS ids;    
00138         TKatCTB ctb;    
00139         TKatCBX cbx;    
00140         TKatECH ech;    
00141 
00142         TKatMOT mot;    
00143         TKatSCT sct;    
00144         TKatEFF eff;    
00145 
00146         CCplBase* protocol;     
00147         short mMasterVersion;   
00148         short mMasterRevision;  
00149 
00150 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; }
00163         const TKatMOT* GetMOT() { return &mot; }        const TKatSCT* GetSCT() { return &sct; }        TKatEFF* GetEFF() { return &eff; }
00170 
00171         
00172         CKatBase() {}
00175         virtual ~CKatBase() {}
00176 
00177         virtual bool init(
00178                 const TKatGNL _gnl,             
00179                 const TKatMOT _mot,             
00180                 const TKatSCT _sct,             
00181                 const TKatEFF _eff,             
00182                 CCplBase* _protocol             
00183                 );
00184         void    recvMFW();      void    recvIDS();      void    recvCTB();      void    recvGMS();      void    waitFor(TMotStsFlg status, int waitTimeout, bool gripper);      void    recvECH();      void    recvMPS();
00200         CCplBase* getProtocol(){return protocol;}
00202         int checkKatanaType(int type);
00203 
00208         void getMasterFirmware(short* fw, short* rev);
00209         void enableCrashLimits();       void disableCrashLimits();      void unBlock();
00220         void setCrashLimit(long idx, int limit);
00223         void setPositionCollisionLimit(long idx, int limit);
00226         void setSpeedCollisionLimit(long idx, int limit);
00227 
00231     void startSplineMovement(int exactflag, int moreflag = 1);
00232 
00237     void setAndStartPolyMovement(std::vector<short> polynomial, int exactflag, int moreflag);
00238     
00240         int readDigitalIO();
00241     
00243         int flushMoveBuffers();
00244 };
00245 
00246 
00247 
00248 
00249 
00250 /****************************************************************************/
00251 #endif //_KMLBASE_H_
00252 /****************************************************************************/


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