orocos_kdl
joint.hpp
Go to the documentation of this file.
1 // Copyright (C) 2007 Ruben Smits <ruben dot smits at intermodalics dot eu>
2 
3 // Version: 1.0
4 // Author: Ruben Smits <ruben dot smits at intermodalics dot eu>
5 // Maintainer: Ruben Smits <ruben dot smits at intermodalics dot eu>
6 // URL: http://www.orocos.org/kdl
7 
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Lesser General Public
10 // License as published by the Free Software Foundation; either
11 // version 2.1 of the License, or (at your option) any later version.
12 
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 
22 #ifndef KDL_JOINT_HPP
23 #define KDL_JOINT_HPP
24 
25 #include "frames.hpp"
26 #include <string>
27 #include <exception>
28 
29 
30 namespace KDL {
31 
45  class Joint {
46  public:
62  explicit Joint(const std::string& name, const JointType& type=Fixed,const double& scale=1,const double& offset=0,
63  const double& inertia=0,const double& damping=0,const double& stiffness=0);
77  explicit Joint(const JointType& type=Fixed,const double& scale=1,const double& offset=0,
78  const double& inertia=0,const double& damping=0,const double& stiffness=0);
94  Joint(const std::string& name, const Vector& _origin, const Vector& _axis, const JointType& type, const double& _scale=1, const double& _offset=0,
95  const double& _inertia=0, const double& _damping=0, const double& _stiffness=0);
110  Joint(const Vector& _origin, const Vector& _axis, const JointType& type, const double& _scale=1, const double& _offset=0,
111  const double& _inertia=0, const double& _damping=0, const double& _stiffness=0);
112 
121  Frame pose(const double& q)const;
129  Twist twist(const double& qdot)const;
130 
136  Vector JointAxis() const;
137 
143  Vector JointOrigin() const;
150  const std::string& getName()const
151  {
152  return name;
153  }
159  const JointType& getType() const
160  {
161  return type;
162  };
163 
169  const std::string getTypeName() const
170  {
171  switch (type) {
172  case RotAxis:
173  return "RotAxis";
174  case TransAxis:
175  return "TransAxis";
176  case RotX:
177  return "RotX";
178  case RotY:
179  return "RotY";
180  case RotZ:
181  return "RotZ";
182  case TransX:
183  return "TransX";
184  case TransY:
185  return "TransY";
186  case TransZ:
187  return "TransZ";
188  case Fixed:
189  return "Fixed";
190  default:
191  return "Fixed";
192  }
193  };
194 
200  const double& getScale() const
201  {
202  return scale;
203  }
204 
210  const double& getOffset() const
211  {
212  return offset;
213  }
214 
220  const double& getInertia() const
221  {
222  return inertia;
223  };
224 
230  const double& getDamping() const
231  {
232  return damping;
233  };
234 
240  const double& getStiffness() const
241  {
242  return stiffness;
243  };
244 
250  const Vector& getAxis() const
251  {
252  return axis;
253  }
254 
260  const Vector& getOrigin() const
261  {
262  return origin;
263  }
264 
265  virtual ~Joint();
266 
267  private:
270  double scale;
271  double offset;
272  double inertia;
273  double damping;
274  double stiffness;
275 
276  // variables for RotAxis joint
278  mutable Frame joint_pose; // Deprecated, but keeping for ABI compatibility
279  mutable double q_previous; // Deprecated, but keeping for ABI compatibility
280 
282  virtual const char* what() const throw(){
283  return "Joint Type excption";}
284  } joint_type_ex;
285 
286  };
287 
288 } // end of namespace KDL
289 
290 #endif
frames.hpp
KDL::Joint::RotZ
@ RotZ
Definition: joint.hpp:47
std::string
exception
KDL::Joint::getStiffness
const double & getStiffness() const
Definition: joint.hpp:240
KDL::Joint::getOrigin
const Vector & getOrigin() const
Definition: joint.hpp:260
KDL::Joint::RotY
@ RotY
Definition: joint.hpp:47
KDL::Joint::stiffness
double stiffness
Definition: joint.hpp:274
KDL::Joint::joint_type_ex
KDL::Joint::joint_type_exception joint_type_ex
KDL::Joint::damping
double damping
Definition: joint.hpp:273
KDL::Joint::getOffset
const double & getOffset() const
Definition: joint.hpp:210
KDL::Joint::TransZ
@ TransZ
Definition: joint.hpp:47
KDL::Joint::name
std::string name
Definition: joint.hpp:268
KDL::Joint::twist
Twist twist(const double &qdot) const
Definition: joint.cpp:93
KDL::Joint::getAxis
const Vector & getAxis() const
Definition: joint.hpp:250
KDL::Joint::Joint
Joint(const std::string &name, const JointType &type=Fixed, const double &scale=1, const double &offset=0, const double &inertia=0, const double &damping=0, const double &stiffness=0)
Definition: joint.cpp:27
KDL::Joint::JointOrigin
Vector JointOrigin() const
Definition: joint.cpp:144
KDL::Joint::Fixed
@ Fixed
Definition: joint.hpp:47
KDL
Definition: kukaLWR_DHnew.cpp:25
KDL::Joint::getName
const std::string & getName() const
Definition: joint.hpp:150
KDL::Joint::pose
Frame pose(const double &q) const
Definition: joint.cpp:68
KDL::Joint::inertia
double inertia
Definition: joint.hpp:272
KDL::Vector
A concrete implementation of a 3 dimensional vector class.
Definition: frames.hpp:162
KDL::Joint::TransAxis
@ TransAxis
Definition: joint.hpp:47
KDL::Twist
represents both translational and rotational velocities.
Definition: frames.hpp:723
KDL::Joint::scale
double scale
Definition: joint.hpp:270
KDL::Joint::getDamping
const double & getDamping() const
Definition: joint.hpp:230
KDL::Joint::joint_type_exception::what
virtual const char * what() const
Definition: joint.hpp:282
KDL::Joint::RotX
@ RotX
Definition: joint.hpp:47
KDL::Frame
represents a frame transformation in 3D space (rotation + translation)
Definition: frames.hpp:572
KDL::Joint::~Joint
virtual ~Joint()
Definition: joint.cpp:64
KDL::Joint::getInertia
const double & getInertia() const
Definition: joint.hpp:220
KDL::Joint::TransX
@ TransX
Definition: joint.hpp:47
KDL::Joint::None
@ None
Definition: joint.hpp:47
KDL::Joint::q_previous
double q_previous
Definition: joint.hpp:279
KDL::Joint::RotAxis
@ RotAxis
Definition: joint.hpp:47
KDL::Joint::offset
double offset
Definition: joint.hpp:271
KDL::Joint::getScale
const double & getScale() const
Definition: joint.hpp:200
KDL::Joint::JointType
JointType
Definition: joint.hpp:47
KDL::Joint::TransY
@ TransY
Definition: joint.hpp:47
KDL::Joint::getType
const JointType & getType() const
Definition: joint.hpp:159
KDL::Joint::joint_pose
Frame joint_pose
Definition: joint.hpp:278
KDL::Joint::joint_type_exception
Definition: joint.hpp:281
KDL::Joint
This class encapsulates a simple joint, that is with one parameterized degree of freedom and with sca...
Definition: joint.hpp:45
KDL::Joint::origin
Vector origin
Definition: joint.hpp:277
KDL::Joint::getTypeName
const std::string getTypeName() const
Definition: joint.hpp:169
KDL::Joint::axis
Vector axis
Definition: joint.hpp:277
KDL::Joint::type
Joint::JointType type
Definition: joint.hpp:269
KDL::Joint::JointAxis
Vector JointAxis() const
Definition: joint.cpp:118
string