joint.hpp 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. // Copyright (C) 2007 Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
  2. // Version: 1.0
  3. // Author: Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
  4. // Maintainer: Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
  5. // URL: http://www.orocos.org/kdl
  6. // This library is free software; you can redistribute it and/or
  7. // modify it under the terms of the GNU Lesser General Public
  8. // License as published by the Free Software Foundation; either
  9. // version 2.1 of the License, or (at your option) any later version.
  10. // This library is distributed in the hope that it will be useful,
  11. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. // Lesser General Public License for more details.
  14. // You should have received a copy of the GNU Lesser General Public
  15. // License along with this library; if not, write to the Free Software
  16. // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  17. #ifndef KDL_JOINT_HPP
  18. #define KDL_JOINT_HPP
  19. #include "frames.hpp"
  20. #include <string>
  21. namespace KDL {
  22. /**
  23. * \brief This class encapsulates a simple joint, that is with one
  24. * parameterized degree of freedom and with scalar dynamic properties.
  25. *
  26. * A simple joint is described by the following properties :
  27. * - scale: ratio between motion input and motion output
  28. * - offset: between the "physical" and the "logical" zero position.
  29. * - type: revolute or translational, along one of the basic frame axes
  30. * - inertia, stiffness and damping: scalars representing the physical
  31. * effects along/about the joint axis only.
  32. *
  33. * @ingroup KinematicFamily
  34. */
  35. class Joint {
  36. public:
  37. typedef enum { RotX,RotY,RotZ,TransX,TransY,TransZ,Sphere,Swing,None} JointType;
  38. /**
  39. * Constructor of a joint.
  40. *
  41. * @param type type of the joint, default: Joint::None
  42. * @param scale scale between joint input and actual geometric
  43. * movement, default: 1
  44. * @param offset offset between joint input and actual
  45. * geometric input, default: 0
  46. * @param inertia 1D inertia along the joint axis, default: 0
  47. * @param damping 1D damping along the joint axis, default: 0
  48. * @param stiffness 1D stiffness along the joint axis,
  49. * default: 0
  50. */
  51. Joint(const JointType& type=None,const double& scale=1,const double& offset=0,
  52. const double& inertia=0,const double& damping=0,const double& stiffness=0);
  53. Joint(const Joint& in);
  54. Joint& operator=(const Joint& arg);
  55. /**
  56. * Request the 6D-pose between the beginning and the end of
  57. * the joint at joint position q
  58. *
  59. * @param q the 1D joint position
  60. *
  61. * @return the resulting 6D-pose
  62. */
  63. Frame pose(const double* q)const;
  64. /**
  65. * Request the resulting 6D-velocity with a joint velocity qdot
  66. *
  67. * @param qdot the 1D joint velocity
  68. *
  69. * @return the resulting 6D-velocity
  70. */
  71. Twist twist(const double& qdot, int dof=0)const;
  72. /**
  73. * Request the type of the joint.
  74. *
  75. * @return const reference to the type
  76. */
  77. const JointType& getType() const
  78. {
  79. return type;
  80. };
  81. /**
  82. * Request the stringified type of the joint.
  83. *
  84. * @return const string
  85. */
  86. const std::string getTypeName() const
  87. {
  88. switch (type) {
  89. case RotX:
  90. return "RotX";
  91. case RotY:
  92. return "RotY";
  93. case RotZ:
  94. return "RotZ";
  95. case TransX:
  96. return "TransX";
  97. case TransY:
  98. return "TransY";
  99. case TransZ:
  100. return "TransZ";
  101. case Sphere:
  102. return "Sphere";
  103. case Swing:
  104. return "Swing";
  105. case None:
  106. return "None";
  107. default:
  108. return "None";
  109. }
  110. };
  111. unsigned int getNDof() const;
  112. virtual ~Joint();
  113. private:
  114. Joint::JointType type;
  115. double scale;
  116. double offset;
  117. double inertia;
  118. double damping;
  119. double stiffness;
  120. };
  121. } // end of namespace KDL
  122. #endif