Robotics Library  0.6.2
PlueckerTransform.hxx
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_HXX_
28 #define _RL_MATH_PLUECKERTRANSFORM_HXX_
29 
30 namespace rl
31 {
32  namespace math
33  {
34  namespace spatial
35  {
36  template< typename Scalar >
37  template< typename OtherScalar >
38  inline
39  ForceVector< OtherScalar >
41  {
43  res.force() = rotation() * other.force();
44  res.moment() = rotation() * (other.moment() - translation().cross(other.force()));
45  return res;
46  }
47 
48  template< typename Scalar >
49  template< typename OtherScalar >
50  inline
53  {
55  res.linear() = rotation() * (other.linear() - translation().cross(other.angular()));
56  res.angular() = rotation() * other.angular();
57  return res;
58  }
59 
60  template< typename Scalar >
61  template< typename OtherScalar >
62  inline
65  {
67  res.cog() = rotation() * (other.cog() - other.mass() * translation());
68  res.inertia() = rotation() * (other.inertia() + translation().cross(other.cog()).cross33() + (other.cog() - other.mass() * translation()).cross(translation()).cross33()) * rotation().transpose();
69  res.mass() = other.mass();
70  return res;
71  }
72 
73  template< typename Scalar >
74  template< typename OtherScalar >
75  inline
78  {
80  res.cog() = rotation() * (other.cog() - translation().cross33() * other.mass()) * rotation().transpose();
81  res.inertia() = rotation() * (other.inertia() - translation().cross33() * other.cog().transpose() + (other.cog() - translation().cross33() * other.mass()) * translation().cross33()) * rotation().transpose();
82  res.mass() = rotation() * other.mass() * rotation().transpose();
83  return res;
84  }
85 
86  template< typename Scalar >
87  template< typename OtherScalar >
88  inline
91  {
93  res.force() = rotation().transpose() * other.force();
94  res.moment() = rotation().transpose() * other.moment() + translation().cross(rotation().transpose() * other.force());
95  return res;
96  }
97 
98  template< typename Scalar >
99  template< typename OtherScalar >
100  inline
103  {
105  res.linear() = rotation().transpose() * other.linear() + translation().cross(rotation().transpose() * other.angular());
106  res.angular() = rotation().transpose() * other.angular();
107  return res;
108  }
109 
110  template< typename Scalar >
111  template< typename OtherScalar >
112  inline
115  {
117  res.cog() = rotation().transpose() * other.cog() + other.mass() * translation();
118  res.inertia() = rotation().transpose() * other.inertia() * rotation() - translation().cross(rotation().transpose() * other.cog()).cross33() - (rotation().transpose() * other.cog() + other.mass() * translation()).cross(translation()).cross33();
119  res.mass() = other.mass();
120  return res;
121  }
122 
123  template< typename Scalar >
124  template< typename OtherScalar >
125  inline
128  {
130  typename ArticulatedBodyInertia< OtherScalar >::CenterOfGravityType cog = rotation().transpose() * other.cog() * rotation();
131  typename ArticulatedBodyInertia< OtherScalar >::MassType mass = rotation().transpose() * other.mass() * rotation();
132  res.cog() = cog + translation().cross33() * mass;
133  res.inertia() = rotation().transpose() * other.inertia() * rotation() + translation().cross33() * cog.transpose() - (cog + translation().cross33() * mass) * translation().cross33();
134  res.mass() = mass;
135  return res;
136  }
137  }
138  }
139 }
140 
141 #endif // _RL_MATH_PLUECKERTRANSFORM_HXX_
cross33
Matrix< Scalar, 3, 3 > cross33() const
Definition: MatrixBaseAddons.h:42
rl::math::spatial::ArticulatedBodyInertia::mass
MassType & mass()
Definition: ArticulatedBodyInertia.h:100
rl::math::spatial::ArticulatedBodyInertia
Definition: ArticulatedBodyInertia.h:44
rl::math::spatial::RigidBodyInertia
Definition: RigidBodyInertia.h:44
rl::math::spatial::ArticulatedBodyInertia::MassType
::Eigen::Matrix< Scalar, 3, 3 > MassType
Definition: ArticulatedBodyInertia.h:60
rl::math::spatial::ArticulatedBodyInertia::inertia
InertiaType & inertia()
Definition: ArticulatedBodyInertia.h:90
rl::math::spatial::MotionVector::linear
LinearType linear()
Definition: MotionVector.h:98
rl::math::spatial::RigidBodyInertia::mass
MassType & mass()
Definition: RigidBodyInertia.h:100
rl::math::spatial::RigidBodyInertia::inertia
InertiaType & inertia()
Definition: RigidBodyInertia.h:90
rl::math::spatial::ArticulatedBodyInertia::cog
CenterOfGravityType & cog()
Definition: ArticulatedBodyInertia.h:80
rl::math::spatial::ForceVector::force
ForceType force()
Definition: ForceVector.h:78
rl::math::spatial::MotionVector::angular
AngularType angular()
Definition: MotionVector.h:74
rl::math::spatial::RigidBodyInertia::cog
CenterOfGravityType & cog()
Definition: RigidBodyInertia.h:80
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::ForceVector
Definition: ForceVector.h:43
rl::math::spatial::MotionVector
Definition: MotionVector.h:42
rl::math::spatial::ForceVector::moment
MomentType moment()
Definition: ForceVector.h:93
rl::math::spatial::ArticulatedBodyInertia::CenterOfGravityType
::Eigen::Matrix< Scalar, 3, 3 > CenterOfGravityType
Definition: ArticulatedBodyInertia.h:52
rl
Definition: Ati.cpp:35