joint.hpp

Go to the documentation of this file.
00001 // Copyright  (C)  2007  Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
00002 
00003 // Version: 1.0
00004 // Author: Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
00005 // Maintainer: Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
00006 // URL: http://www.orocos.org/kdl
00007 
00008 // This library is free software; you can redistribute it and/or
00009 // modify it under the terms of the GNU Lesser General Public
00010 // License as published by the Free Software Foundation; either
00011 // version 2.1 of the License, or (at your option) any later version.
00012 
00013 // This library is distributed in the hope that it will be useful,
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016 // Lesser General Public License for more details.
00017 
00018 // You should have received a copy of the GNU Lesser General Public
00019 // License along with this library; if not, write to the Free Software
00020 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00021 
00022 #ifndef KDL_JOINT_HPP
00023 #define KDL_JOINT_HPP
00024 
00025 #include "frames.hpp"
00026 #include <string>
00027 #include <exception>
00028 
00029 
00030 namespace KDL {
00031 
00045     class Joint {
00046     public:
00047         typedef enum { RotAxis,RotX,RotY,RotZ,TransAxis,TransX,TransY,TransZ,None} JointType;
00062          Joint(const std::string& name, const JointType& type=None,const double& scale=1,const double& offset=0,
00063               const double& inertia=0,const double& damping=0,const double& stiffness=0);
00077          Joint(const JointType& type=None,const double& scale=1,const double& offset=0,
00078                const double& inertia=0,const double& damping=0,const double& stiffness=0);
00095         Joint(const std::string& name, const Vector& _origin, const Vector& _axis, const JointType& type, const double& _scale=1, const double& _offset=0,
00096               const double& _inertia=0, const double& _damping=0, const double& _stiffness=0);
00112         Joint(const Vector& _origin, const Vector& _axis, const JointType& type, const double& _scale=1, const double& _offset=0,
00113               const double& _inertia=0, const double& _damping=0, const double& _stiffness=0);
00114 
00123         Frame pose(const double& q)const;
00131         Twist twist(const double& qdot)const;
00132 
00138         Vector JointAxis() const;
00139 
00145         Vector JointOrigin() const;
00152           const std::string& getName()const
00153           {
00154               return name;
00155           }
00161         const JointType& getType() const
00162         {
00163             return type;
00164         };
00165       
00171         const std::string getTypeName() const
00172         {
00173             switch (type) {
00174             case RotAxis:
00175                 return "RotAxis";
00176             case TransAxis:
00177                 return "TransAxis";
00178             case RotX:
00179                 return "RotX";
00180             case RotY:
00181                 return "RotY";
00182             case RotZ:
00183                 return "RotZ";
00184             case TransX:
00185                 return "TransX";
00186             case TransY:
00187                 return "TransY";
00188             case TransZ:
00189                 return "TransZ";
00190             case None:
00191                 return "None";
00192             default:
00193                 return "None";
00194             }
00195         };
00196 
00197         virtual ~Joint();
00198 
00199     private:
00200         std::string name;
00201         Joint::JointType type;
00202         double scale;
00203         double offset;
00204         double inertia;
00205         double damping;
00206         double stiffness;
00207 
00208         // varibles for RotAxis joint
00209         Vector axis, origin;
00210         mutable Frame  joint_pose;
00211         mutable double q_previous;
00212 
00213 
00214       
00215       class joint_type_exception: public std::exception{
00216         virtual const char* what() const throw(){
00217           return "Joint Type excption";}
00218       } joint_type_ex;
00219 
00220     };
00221 
00222 } // end of namespace KDL
00223 
00224 #endif

Generated on Wed Nov 23 19:00:20 2011 for FreeCAD by  doxygen 1.6.1