KatanaNativeInterface  $VERSION$
ikBase.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 /******************************************************************************************************************/
00022 #ifndef _IKBASE_H_
00023 #define _IKBASE_H_
00024 /******************************************************************************************************************/
00025 
00026 #include "common/exception.h"
00027 #include "common/dllexport.h"
00028 
00029 #include "KNI/kmlExt.h"
00030 #include "KNI/kmlCommon.h"
00031 
00032 #include "KNI_InvKin/KatanaKinematics.h"
00033 
00034 #include <vector>
00035 #include <memory>
00036 
00037 /******************************************************************************************************************/
00038 
00039 #ifndef TM_ENDLESS
00040 #define TM_ENDLESS -1    //!< timeout symbol for 'endless' waiting
00041 #endif
00042 
00043 
00044 class DLLDIR_IK CikBase : public CKatana {
00045 
00046  private:
00047         std::auto_ptr<KNI::KatanaKinematics> _kinematicsImpl;
00048         bool _kinematicsIsInitialized;
00049         void _initKinematics();
00050 
00051  public:
00052 
00053     CikBase() : _kinematicsIsInitialized(false) {  };
00054     ~CikBase() {}
00055 
00058     void DKApos(double* position);
00059 
00064     void getCoordinates(double& x, double& y, double& z, double& phi, double& theta, double& psi, bool refreshEncoders = true);
00065 
00069     void IKCalculate(double X, 
00070                        double Y, 
00071                        double Z, 
00072                        double Al, 
00073                        double Be, 
00074                        double Ga,
00075                        std::vector<int>::iterator solution_iter);
00076 
00080     void IKCalculate(double X, 
00081                        double Y, 
00082                        double Z, 
00083                        double Al, 
00084                        double Be, 
00085                        double Ga,
00086                        std::vector<int>::iterator solution_iter,
00087                        const std::vector<int>& actualPosition );
00088 
00091     void IKGoto(double X, 
00092                   double Y, 
00093                   double Z, 
00094                   double Al, 
00095                   double Be, 
00096                   double Ga, 
00097                   bool wait = false, 
00098                   int tolerance = 100,
00099                   long timeout = TM_ENDLESS);   
00100 
00103     void moveRobotTo(double x, 
00104                   double y, 
00105                   double z, 
00106                   double phi, 
00107                   double theta, 
00108                   double psi,
00109                   bool waitUntilReached = false, int waitTimeout = TM_ENDLESS);
00110 
00115     void moveRobotTo( std::vector<double> coordinates, bool waitUntilReached = false, int waitTimeout = TM_ENDLESS);
00116 
00117 };
00118 
00119 /******************************************************************************************************************/
00120 #endif //_IKBASE_H_
00121 /******************************************************************************************************************/