motion-base.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2015-2020 CNRS INRIA
3 // Copyright (c) 2015-2016 Wandercraft, 86 rue de Paris 91400 Orsay, France.
4 //
5 
6 #ifndef __pinocchio_spatial_motion_base_hpp__
7 #define __pinocchio_spatial_motion_base_hpp__
8 
9 namespace pinocchio
10 {
11 
12  template<class Derived>
13  class MotionBase : NumericalBase<Derived>
14  {
15  public:
16  MOTION_TYPEDEF_TPL(Derived);
17 
18  Derived & derived()
19  {
20  return *static_cast<Derived *>(this);
21  }
22  const Derived & derived() const
23  {
24  return *static_cast<const Derived *>(this);
25  }
26 
27  Derived & const_cast_derived() const
28  {
29  return *const_cast<Derived *>(&derived());
30  }
31 
32  ConstAngularType angular() const
33  {
34  return derived().angular_impl();
35  }
36  ConstLinearType linear() const
37  {
38  return derived().linear_impl();
39  }
40  AngularType angular()
41  {
42  return derived().angular_impl();
43  }
44  LinearType linear()
45  {
46  return derived().linear_impl();
47  }
48 
49  template<typename V3Like>
50  void angular(const Eigen::MatrixBase<V3Like> & w)
51  {
52  derived().angular_impl(w.derived());
53  }
54 
55  template<typename V3Like>
56  void linear(const Eigen::MatrixBase<V3Like> & v)
57  {
58  derived().linear_impl(v.derived());
59  }
60 
61  operator PlainReturnType() const
62  {
63  return derived().plain();
64  }
65  PlainReturnType plain() const
66  {
67  return derived().plain();
68  }
69 
70  ToVectorConstReturnType toVector() const
71  {
72  return derived().toVector_impl();
73  }
74  ToVectorReturnType toVector()
75  {
76  return derived().toVector_impl();
77  }
78  operator Vector6() const
79  {
80  return toVector();
81  }
82 
83  ActionMatrixType toActionMatrix() const
84  {
85  return derived().toActionMatrix_impl();
86  }
87  ActionMatrixType toDualActionMatrix() const
88  {
89  return derived().toDualActionMatrix_impl();
90  }
91  operator Matrix6() const
92  {
93  return toActionMatrix();
94  }
95 
109  HomogeneousMatrixType toHomogeneousMatrix() const
110  {
111  return derived().toHomogeneousMatrix_impl();
112  }
113 
114  void setZero()
115  {
116  derived().setZero();
117  }
118 
119  template<typename M2>
120  bool operator==(const MotionBase<M2> & other) const
121  {
122  return derived().isEqual_impl(other.derived());
123  }
124 
125  template<typename M2>
126  bool operator!=(const MotionBase<M2> & other) const
127  {
128  return !(derived() == other.derived());
129  }
130 
131  Derived operator-() const
132  {
133  return derived().__opposite__();
134  }
135  Derived operator+(const MotionBase<Derived> & v) const
136  {
137  return derived().__plus__(v.derived());
138  }
139  Derived operator-(const MotionBase<Derived> & v) const
140  {
141  return derived().__minus__(v.derived());
142  }
143  Derived & operator+=(const MotionBase<Derived> & v)
144  {
145  return derived().__pequ__(v.derived());
146  }
147  Derived & operator-=(const MotionBase<Derived> & v)
148  {
149  return derived().__mequ__(v.derived());
150  }
151 
152  template<typename OtherScalar>
154  operator*(const OtherScalar & alpha) const
155  {
156  return derived().__mult__(alpha);
157  }
158 
159  template<typename OtherScalar>
160  Derived operator/(const OtherScalar & alpha) const
161  {
162  return derived().__div__(alpha);
163  }
164 
165  template<typename OtherSpatialType>
167  cross(const OtherSpatialType & d) const
168  {
169  return derived().cross_impl(d);
170  }
171 
172  bool isApprox(
173  const Derived & other,
174  const Scalar & prec = Eigen::NumTraits<Scalar>::dummy_precision()) const
175  {
176  return derived().isApprox_impl(other, prec);
177  }
178 
179  bool isZero(const Scalar & prec = Eigen::NumTraits<Scalar>::dummy_precision()) const
180  {
181  return derived().isZero_impl(prec);
182  }
183 
184  template<typename S2, int O2>
186  {
187  return derived().se3Action_impl(m);
188  }
189 
190  template<typename S2, int O2>
192  {
193  return derived().se3ActionInverse_impl(m);
194  }
195 
196  template<typename ForceDerived>
198  {
199  return derived().dot(f.derived());
200  }
201 
202  void disp(std::ostream & os) const
203  {
204  derived().disp_impl(os);
205  }
206  friend std::ostream & operator<<(std::ostream & os, const MotionBase<Derived> & v)
207  {
208  v.disp(os);
209  return os;
210  }
211 
212  }; // class MotionBase
213 
214  template<typename MotionDerived>
215  typename internal::RHSScalarMultiplication<
216  MotionDerived,
217  typename MotionDerived::Scalar>::ReturnType
219  {
220  return motion * alpha;
221  }
222 
223 } // namespace pinocchio
224 
225 #endif // ifndef __pinocchio_spatial_motion_base_hpp__
pinocchio::MotionBase::se3Action
SE3GroupAction< Derived >::ReturnType se3Action(const SE3Tpl< S2, O2 > &m) const
Definition: motion-base.hpp:185
pinocchio::MotionBase::operator+=
Derived & operator+=(const MotionBase< Derived > &v)
Definition: motion-base.hpp:143
pinocchio::MotionBase::operator!=
bool operator!=(const MotionBase< M2 > &other) const
Definition: motion-base.hpp:126
test-cpp2pybind11.m
m
Definition: test-cpp2pybind11.py:25
pinocchio::MotionBase::const_cast_derived
Derived & const_cast_derived() const
Definition: motion-base.hpp:27
pinocchio::MotionBase::operator-=
Derived & operator-=(const MotionBase< Derived > &v)
Definition: motion-base.hpp:147
pinocchio::MotionBase::toActionMatrix
ActionMatrixType toActionMatrix() const
Definition: motion-base.hpp:83
pinocchio::SE3Tpl
Definition: context/casadi.hpp:29
pinocchio::SE3GroupAction::ReturnType
D ReturnType
Definition: spatial/se3.hpp:41
pinocchio::MotionBase::angular
ConstAngularType angular() const
Definition: motion-base.hpp:32
pinocchio::MotionBase::derived
Derived & derived()
Definition: motion-base.hpp:18
pinocchio::python::Scalar
context::Scalar Scalar
Definition: admm-solver.cpp:29
pinocchio::MotionBase::setZero
void setZero()
Definition: motion-base.hpp:114
pinocchio::MotionBase::plain
PlainReturnType plain() const
Definition: motion-base.hpp:65
pinocchio::MotionBase::linear
ConstLinearType linear() const
Definition: motion-base.hpp:36
pinocchio::internal::RHSScalarMultiplication::ReturnType
Type ReturnType
Definition: spatial/fwd.hpp:21
pinocchio::MotionBase::isApprox
bool isApprox(const Derived &other, const Scalar &prec=Eigen::NumTraits< Scalar >::dummy_precision()) const
Definition: motion-base.hpp:172
pinocchio::MotionBase::isZero
bool isZero(const Scalar &prec=Eigen::NumTraits< Scalar >::dummy_precision()) const
Definition: motion-base.hpp:179
pinocchio::MotionBase::disp
void disp(std::ostream &os) const
Definition: motion-base.hpp:202
pinocchio::operator*
TridiagonalSymmetricMatrixApplyOnTheLeftReturnType< LhsMatrixType, TridiagonalSymmetricMatrixTpl< S, O > > operator*(const Eigen::MatrixBase< LhsMatrixType > &lhs, const TridiagonalSymmetricMatrixTpl< S, O > &rhs)
Definition: math/tridiagonal-matrix.hpp:319
autodiff-rnea.f
f
Definition: autodiff-rnea.py:24
pinocchio::MotionBase
Definition: spatial/fwd.hpp:42
pinocchio::MotionBase::operator==
bool operator==(const MotionBase< M2 > &other) const
Definition: motion-base.hpp:120
pinocchio::motion
MotionTpl< Scalar, Options > motion(const JointDataTpl< Scalar, Options, JointCollectionTpl > &jdata)
Visit a JointDataTpl through JointMotionVisitor to get the joint internal motion as a dense motion.
pinocchio::MotionBase::operator/
Derived operator/(const OtherScalar &alpha) const
Definition: motion-base.hpp:160
pinocchio::MotionBase::cross
MotionAlgebraAction< OtherSpatialType, Derived >::ReturnType cross(const OtherSpatialType &d) const
Definition: motion-base.hpp:167
pinocchio::MotionAlgebraAction::ReturnType
D ReturnType
Definition: spatial/motion.hpp:47
reachable-workspace-with-collisions.alpha
float alpha
Definition: reachable-workspace-with-collisions.py:162
pinocchio::MotionBase::dot
Scalar dot(const ForceDense< ForceDerived > &f) const
Definition: motion-base.hpp:197
ur5x4.w
w
Definition: ur5x4.py:50
pinocchio::MotionBase::toVector
ToVectorConstReturnType toVector() const
Definition: motion-base.hpp:70
pinocchio::MotionBase::operator<<
friend std::ostream & operator<<(std::ostream &os, const MotionBase< Derived > &v)
Definition: motion-base.hpp:206
pinocchio::MotionBase::MOTION_TYPEDEF_TPL
MOTION_TYPEDEF_TPL(Derived)
pinocchio::MotionBase::operator*
internal::RHSScalarMultiplication< Derived, OtherScalar >::ReturnType operator*(const OtherScalar &alpha) const
Definition: motion-base.hpp:154
pinocchio::v
JointCollectionTpl const Eigen::MatrixBase< ConfigVectorType > const Eigen::MatrixBase< TangentVectorType > & v
Definition: joint-configuration.hpp:1084
pinocchio::MotionBase::se3ActionInverse
SE3GroupAction< Derived >::ReturnType se3ActionInverse(const SE3Tpl< S2, O2 > &m) const
Definition: motion-base.hpp:191
pinocchio::ForceDense
Definition: context/casadi.hpp:34
pinocchio::MotionBase::operator-
Derived operator-() const
Definition: motion-base.hpp:131
pinocchio::MotionBase::operator-
Derived operator-(const MotionBase< Derived > &v) const
Definition: motion-base.hpp:139
pinocchio::MotionBase::operator+
Derived operator+(const MotionBase< Derived > &v) const
Definition: motion-base.hpp:135
pinocchio::MotionBase::toVector
ToVectorReturnType toVector()
Definition: motion-base.hpp:74
pinocchio::MotionBase::toDualActionMatrix
ActionMatrixType toDualActionMatrix() const
Definition: motion-base.hpp:87
d
FCL_REAL d
pinocchio::MotionBase::toHomogeneousMatrix
HomogeneousMatrixType toHomogeneousMatrix() const
The homogeneous representation of the motion vector .
Definition: motion-base.hpp:109
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:27


pinocchio
Author(s):
autogenerated on Mon Dec 16 2024 03:41:04