Robotics Library  0.7.0
PlueckerTransform.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_MATH_PLUECKERTRANSFORM_H
28 #define RL_MATH_PLUECKERTRANSFORM_H
29 
30 #include <Eigen/Core>
31 #include <Eigen/Geometry>
32 
33 namespace rl
34 {
35  namespace math
36  {
43  namespace spatial
44  {
45  template<typename Scalar> class ArticulatedBodyInertia;
46  template<typename Scalar> class ForceVector;
47  template<typename Scalar> class MotionVector;
48  template<typename Scalar> class RigidBodyInertia;
49 
53  template<typename Scalar>
55  {
56  public:
57  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
58 
59  typedef Scalar ScalarType;
60 
61  typedef ::Eigen::Matrix<Scalar, 6, 6> MatrixType;
62 
63  typedef ::Eigen::Matrix<Scalar, 3, 3> RotationType;
64 
66 
67  typedef ::Eigen::Transform<Scalar, 3, ::Eigen::Affine> TransformType;
68 
69  typedef ::Eigen::Matrix<Scalar, 3, 1> TranslationType;
70 
72 
74  {
75  }
76 
78  {
79  }
80 
82  {
84  res.rotation() = rotation().transpose();
85  res.translation() = -rotation() * translation();
86  return res;
87  }
88 
90  {
91  MatrixType res;
92  res.template topLeftCorner<3, 3>() = rotation().transpose();
93  res.template topRightCorner<3, 3>() = translation().cross33() * rotation().transpose();
94  res.template bottomLeftCorner<3, 3>().setZero();
95  res.template bottomRightCorner<3, 3>() = rotation().transpose();
96  return res;
97  }
98 
100  {
101  MatrixType res;
102  res.template topLeftCorner<3, 3>() = rotation().transpose();
103  res.template topRightCorner<3, 3>().setZero();
104  res.template bottomLeftCorner<3, 3>() = translation().cross33() * rotation().transpose();
105  res.template bottomRightCorner<3, 3>() = rotation().transpose();
106  return res;
107  }
108 
110  {
111  MatrixType res;
112  res.template topLeftCorner<3, 3>() = rotation();
113  res.template topRightCorner<3, 3>() = -rotation() * translation().cross33();
114  res.template bottomLeftCorner<3, 3>().setZero();
115  res.template bottomRightCorner<3, 3>() = rotation();
116  return res;
117  }
118 
120  {
121  MatrixType res;
122  res.template topLeftCorner<3, 3>() = rotation();
123  res.template topRightCorner<3, 3>().setZero();
124  res.template bottomLeftCorner<3, 3>() = -rotation() * translation().cross33();
125  res.template bottomRightCorner<3, 3>() = rotation();
126  return res;
127  }
128 
129  template<typename OtherScalar>
131 
132  template<typename OtherScalar>
134 
136  {
137  PlueckerTransform res;
138  res.rotation() = rotation() * other.rotation();
139  res.translation() = other.translation() + other.rotation().transpose() * translation();
140  return res;
141  }
142 
143  template<typename OtherScalar>
145 
146  template<typename OtherScalar>
148 
149  template<typename OtherScalar>
151 
152  template<typename OtherScalar>
154 
155  template<typename OtherScalar>
157 
158  template<typename OtherScalar>
160 
162  {
163  return rotationData;
164  }
165 
167  {
168  return rotationData;
169  }
170 
171  void setIdentity()
172  {
173  rotation().setIdentity();
174  translation().setZero();
175  }
176 
178  {
179  TransformType res;
180  res.linear() = rotation();
181  res.translation() = -rotation() * translation();
182  return res;
183  }
184 
186  {
187  return translationData;
188  }
189 
191  {
192  return translationData;
193  }
194 
195  protected:
196 
197  private:
199 
201  };
202  }
203  }
204 }
205 
206 #endif // RL_MATH_PLUECKERTRANSFORM_H
rl::math::spatial::PlueckerTransform::inverseForce
MatrixType inverseForce() const
Definition: PlueckerTransform.h:89
rl::math::spatial::PlueckerTransform::operator*
PlueckerTransform operator*(const PlueckerTransform &other) const
Definition: PlueckerTransform.h:135
rl::math::spatial::PlueckerTransform::ConstRotationType
const RotationType ConstRotationType
Definition: PlueckerTransform.h:65
rl::math::spatial::ArticulatedBodyInertia
Articulated-body inertia.
Definition: ArticulatedBodyInertia.h:47
rl::math::spatial::PlueckerTransform::MatrixType
::Eigen::Matrix< Scalar, 6, 6 > MatrixType
Definition: PlueckerTransform.h:61
rl::math::spatial::RigidBodyInertia
Rigid-body inertia.
Definition: RigidBodyInertia.h:47
rl::math::ArticulatedBodyInertia
spatial::ArticulatedBodyInertia< Real > ArticulatedBodyInertia
Definition: Spatial.h:52
rl::math::spatial::PlueckerTransform::translationData
TranslationType translationData
Definition: PlueckerTransform.h:200
rl::math::spatial::PlueckerTransform::translation
TranslationType & translation()
Definition: PlueckerTransform.h:185
rl::math::spatial::PlueckerTransform::rotationData
RotationType rotationData
Definition: PlueckerTransform.h:198
rl::math::MotionVector
spatial::MotionVector< Real > MotionVector
Definition: Spatial.h:56
rl::math::spatial::PlueckerTransform::~PlueckerTransform
virtual ~PlueckerTransform()
Definition: PlueckerTransform.h:77
rl::math::spatial::PlueckerTransform::ScalarType
Scalar ScalarType
Definition: PlueckerTransform.h:59
rl::math::spatial::PlueckerTransform::inverseMotion
MatrixType inverseMotion() const
Definition: PlueckerTransform.h:99
rl::math::spatial::PlueckerTransform::matrixForce
MatrixType matrixForce() const
Definition: PlueckerTransform.h:109
rl::math::spatial::PlueckerTransform::rotation
RotationType & rotation()
Definition: PlueckerTransform.h:161
rl::math::spatial::PlueckerTransform::TransformType
::Eigen::Transform< Scalar, 3, ::Eigen::Affine > TransformType
Definition: PlueckerTransform.h:67
rl::math::spatial::PlueckerTransform::transform
TransformType transform() const
Definition: PlueckerTransform.h:177
rl::math::spatial::PlueckerTransform::ConstTranslationType
const TranslationType ConstTranslationType
Definition: PlueckerTransform.h:71
rl::math::ForceVector
spatial::ForceVector< Real > ForceVector
Definition: Spatial.h:54
rl::math::RigidBodyInertia
spatial::RigidBodyInertia< Real > RigidBodyInertia
Definition: Spatial.h:60
rl::math::spatial::PlueckerTransform::operator/
ForceVector< OtherScalar > operator/(const ForceVector< OtherScalar > &other) const
Definition: PlueckerTransform.hxx:90
rl::math::spatial::PlueckerTransform::operator*
ForceVector< OtherScalar > operator*(const ForceVector< OtherScalar > &other) const
Definition: PlueckerTransform.hxx:40
rl::math::spatial::PlueckerTransform::RotationType
::Eigen::Matrix< Scalar, 3, 3 > RotationType
Definition: PlueckerTransform.h:63
rl::math::spatial::PlueckerTransform
Plücker transform.
Definition: PlueckerTransform.h:55
rl::math::spatial::ForceVector
Force vector.
Definition: ForceVector.h:46
rl::math::spatial::PlueckerTransform::inverse
PlueckerTransform inverse() const
Definition: PlueckerTransform.h:81
rl::math::spatial::PlueckerTransform::TranslationType
::Eigen::Matrix< Scalar, 3, 1 > TranslationType
Definition: PlueckerTransform.h:69
rl::math::spatial::PlueckerTransform::translation
ConstTranslationType & translation() const
Definition: PlueckerTransform.h:190
rl::math::spatial::MotionVector
Motion vector.
Definition: MotionVector.h:45
rl::math::spatial::PlueckerTransform::rotation
ConstRotationType & rotation() const
Definition: PlueckerTransform.h:166
rl::math::spatial::PlueckerTransform::matrixMotion
MatrixType matrixMotion() const
Definition: PlueckerTransform.h:119
rl::math::spatial::PlueckerTransform::PlueckerTransform
PlueckerTransform()
Definition: PlueckerTransform.h:73
rl::math::spatial::PlueckerTransform::setIdentity
void setIdentity()
Definition: PlueckerTransform.h:171
rl
Robotics Library.
Definition: AnalogInput.cpp:30