Robotics Library  0.7.0
Puma.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2009, Markus Rickert
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are met:
7 //
8 // * Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright notice,
11 // this list of conditions and the following disclaimer in the documentation
12 // and/or other materials provided with the distribution.
13 //
14 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
18 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 // POSSIBILITY OF SUCH DAMAGE.
25 //
26 
27 #ifndef RL_KIN_PUMA_H
28 #define RL_KIN_PUMA_H
29 
30 #include "Kinematics.h"
31 
32 namespace rl
33 {
34  namespace kin
35  {
39  class Puma : public Kinematics
40  {
41  public:
42  enum Arm
43  {
44  ARM_LEFT = -1,
45  ARM_RIGHT = 1
46  };
47 
48  enum Elbow
49  {
51  ELBOW_BELOW = -1
52  };
53 
54  enum Wrist
55  {
57  WRIST_NONFLIP = -1
58  };
59 
60  Puma();
61 
62  virtual ~Puma();
63 
64  virtual Kinematics* clone() const;
65 
66  Arm getArm() const;
67 
68  Elbow getElbow() const;
69 
70  Wrist getWrist() const;
71 
72  bool inversePosition(
74  ::rl::math::Vector& q,
75  const ::std::size_t& leaf = 0,
76  const ::rl::math::Real& delta = ::std::numeric_limits< ::rl::math::Real>::infinity(),
77  const ::rl::math::Real& epsilon = 1.0e-3f,
78  const ::std::size_t& iterations = 1000
79  );
80 
81  bool isSingular() const;
82 
84 
85  void setArm(const Arm& arm);
86 
87  void setElbow(const Elbow& elbow);
88 
89  void setWrist(const Wrist& wrist);
90 
91  protected:
92 
93  private:
94  template<typename T> T atan2(const T& y, const T& x) const
95  {
96  T a = ::std::atan2(y, x);
97  return (::std::abs(a) <= 1.0e-6f) ? 0.0f : a;
98  }
99 
100  template<typename T> T cos(const T& x) const
101  {
102  T c = ::std::cos(x);
103  return (::std::abs(c) <= 1.0e-6f) ? 0.0f : c;
104  }
105 
106  template<typename T> T sin(const T& x) const
107  {
108  T s = ::std::sin(x);
109  return (::std::abs(s) <= 1.0e-6f) ? 0.0f : s;
110  }
111 
113 
115 
117  };
118  }
119 }
120 
121 #endif // RL_KIN_PUMA_H
122 
rl::kin::Puma::arm
Arm arm
Definition: Puma.h:112
rl::kin::Puma::Elbow
Elbow
Definition: Puma.h:49
rl::math::Transform
::Eigen::Transform< Real, 3, ::Eigen::Affine > Transform
Rigid transformation in 3D.
Definition: Transform.h:46
rl::kin::Puma::ARM_LEFT
@ ARM_LEFT
Definition: Puma.h:44
rl::kin::Puma::ARM_RIGHT
@ ARM_RIGHT
Definition: Puma.h:45
rl::math::Vector
::Eigen::Matrix< Real, ::Eigen::Dynamic, 1 > Vector
Definition: Vector.h:42
rl::kin::Puma::Arm
Arm
Definition: Puma.h:43
rl::kin::Puma::getElbow
Elbow getElbow() const
Definition: Puma.cpp:64
rl::kin::Puma::getWrist
Wrist getWrist() const
Definition: Puma.cpp:70
rl::kin::Puma::parameters
void parameters(const ::rl::math::Vector &q, Arm &arm, Elbow &elbow, Wrist &wrist) const
Definition: Puma.cpp:290
rl::kin::Puma::Wrist
Wrist
Definition: Puma.h:55
rl::kin::Puma::clone
virtual Kinematics * clone() const
Definition: Puma.cpp:52
rl::kin::Puma::WRIST_FLIP
@ WRIST_FLIP
Definition: Puma.h:56
rl::kin::Puma::ELBOW_ABOVE
@ ELBOW_ABOVE
Definition: Puma.h:50
rl::kin::Puma::wrist
Wrist wrist
Definition: Puma.h:116
rl::kin::Puma::elbow
Elbow elbow
Definition: Puma.h:114
rl::kin::Puma::atan2
T atan2(const T &y, const T &x) const
Definition: Puma.h:94
rl::kin::Puma::inversePosition
bool inversePosition(const ::rl::math::Transform &x, ::rl::math::Vector &q, const ::std::size_t &leaf=0, const ::rl::math::Real &delta=::std::numeric_limits< ::rl::math::Real >::infinity(), const ::rl::math::Real &epsilon=1.0e-3f, const ::std::size_t &iterations=1000)
Calculate inverse position kinematics.
Definition: Puma.cpp:76
rl::kin::Puma::getArm
Arm getArm() const
Definition: Puma.cpp:58
rl::kin::Puma::setElbow
void setElbow(const Elbow &elbow)
Definition: Puma.cpp:365
rl::kin::Puma::cos
T cos(const T &x) const
Definition: Puma.h:100
rl::kin::Puma::ELBOW_BELOW
@ ELBOW_BELOW
Definition: Puma.h:51
rl::kin::Puma::setWrist
void setWrist(const Wrist &wrist)
Definition: Puma.cpp:371
rl::kin::Puma::WRIST_NONFLIP
@ WRIST_NONFLIP
Definition: Puma.h:57
rl::kin::Puma
TRR base and TRT wrist.
Definition: Puma.h:40
rl::kin::Puma::isSingular
bool isSingular() const
Check if current configuration is singular.
Definition: Puma.cpp:284
rl::kin::Kinematics
Definition: Kinematics.h:52
rl::math::Real
double Real
Definition: Real.h:42
rl::kin::Puma::setArm
void setArm(const Arm &arm)
Definition: Puma.cpp:359
rl::kin::Puma::sin
T sin(const T &x) const
Definition: Puma.h:106
rl::kin::Puma::~Puma
virtual ~Puma()
Definition: Puma.cpp:47
Kinematics.h
rl::kin::Puma::Puma
Puma()
Definition: Puma.cpp:39
rl
Robotics Library.
Definition: AnalogInput.cpp:30