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         explicit 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         explicit 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);
00094         Joint(const std::string& name, const Vector& _origin, const Vector& _axis, const JointType& type, const double& _scale=1, const double& _offset=0,
00095               const double& _inertia=0, const double& _damping=0, const double& _stiffness=0);
00110         Joint(const Vector& _origin, const Vector& _axis, const JointType& type, const double& _scale=1, const double& _offset=0,
00111               const double& _inertia=0, const double& _damping=0, const double& _stiffness=0);
00112 
00121         Frame pose(const double& q)const;
00129         Twist twist(const double& qdot)const;
00130 
00136         Vector JointAxis() const;
00137 
00143         Vector JointOrigin() const;
00150           const std::string& getName()const
00151           {
00152               return name;
00153           }
00159         const JointType& getType() const
00160         {
00161             return type;
00162         };
00163       
00169         const std::string getTypeName() const
00170         {
00171             switch (type) {
00172             case RotAxis:
00173                 return "RotAxis";
00174             case TransAxis:
00175                 return "TransAxis";
00176             case RotX:
00177                 return "RotX";
00178             case RotY:
00179                 return "RotY";
00180             case RotZ:
00181                 return "RotZ";
00182             case TransX:
00183                 return "TransX";
00184             case TransY:
00185                 return "TransY";
00186             case TransZ:
00187                 return "TransZ";
00188             case None:
00189                 return "None";
00190             default:
00191                 return "None";
00192             }
00193         };
00194 
00195         virtual ~Joint();
00196 
00197     private:
00198         std::string name;
00199         Joint::JointType type;
00200         double scale;
00201         double offset;
00202         double inertia;
00203         double damping;
00204         double stiffness;
00205 
00206         // variables for RotAxis joint
00207         Vector axis, origin;
00208         mutable Frame  joint_pose;
00209         mutable double q_previous;
00210 
00211 
00212       
00213       class joint_type_exception: public std::exception{
00214         virtual const char* what() const throw(){
00215           return "Joint Type excption";}
00216       } joint_type_ex;
00217 
00218     };
00219 
00220 } // end of namespace KDL
00221 
00222 #endif


orocos_kdl
Author(s):
autogenerated on Mon Oct 6 2014 03:11:16