00001 /*************************************************************************** 00002 * Copyright (C) 2006 by Tiziano Mueller * 00003 * tiziano.mueller@neuronics.ch * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00019 ***************************************************************************/ 00020 #ifndef KATANAKINEMATICS_H 00021 #define KATANAKINEMATICS_H 00022 00023 #include "common/dllexport.h" 00024 #include "common/exception.h" 00025 00026 #include <vector> 00027 00028 00029 namespace KNI { 00030 00035 00036 00039 class NoSolutionException : public Exception { 00040 public: 00041 NoSolutionException() throw(): 00042 Exception("No solution found", -60) {} 00043 00044 }; 00045 00049 00053 struct DLLDIR_IK KinematicParameters { 00054 double angleOffset; 00055 double angleStop; 00056 int epc; 00057 int encOffset; 00058 int rotDir; 00059 }; 00060 00063 class DLLDIR_IK KatanaKinematics { 00064 public: 00065 virtual ~KatanaKinematics() {} 00066 00067 typedef std::vector<KinematicParameters> parameter_container; 00068 00071 typedef std::vector<double> angles; 00074 typedef std::vector<double> coordinates; 00077 typedef std::vector<double> metrics; 00080 typedef std::vector<int> encoders; 00081 00085 virtual void init(metrics const& length, parameter_container const& parameters) = 0; 00086 00092 virtual void DK(coordinates& solution, encoders const& current_encoders) const = 0; 00093 00102 virtual void IK(encoders::iterator solution, coordinates const& pose, encoders const& cur_angles) const = 0; 00103 00104 }; 00105 00106 } 00107 00108 #endif 00109