joint.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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
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 }
00223
00224 #endif