force-base.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2015-2020 CNRS INRIA
3 // Copyright (c) 2016 Wandercraft, 86 rue de Paris 91400 Orsay, France.
4 //
5 
6 #ifndef __pinocchio_spatial_force_base_hpp__
7 #define __pinocchio_spatial_force_base_hpp__
8 
9 namespace pinocchio
10 {
22  template<class Derived>
23  class ForceBase : NumericalBase<Derived>
24  {
25  public:
26  FORCE_TYPEDEF_TPL(Derived);
27 
28  Derived & derived()
29  {
30  return *static_cast<Derived *>(this);
31  }
32  const Derived & derived() const
33  {
34  return *static_cast<const Derived *>(this);
35  }
36 
37  Derived & const_cast_derived() const
38  {
39  return *const_cast<Derived *>(&derived());
40  }
41 
47  ConstAngularType angular() const
48  {
49  return derived().angular_impl();
50  }
51 
57  ConstLinearType linear() const
58  {
59  return derived().linear_impl();
60  }
61 
63  AngularType angular()
64  {
65  return derived().angular_impl();
66  }
67 
69  LinearType linear()
70  {
71  return derived().linear_impl();
72  }
73 
81  template<typename V3Like>
82  void angular(const Eigen::MatrixBase<V3Like> & n)
83  {
84  derived().angular_impl(n.derived());
85  }
86 
94  template<typename V3Like>
95  void linear(const Eigen::MatrixBase<V3Like> & f)
96  {
97  derived().linear_impl(f.derived());
98  }
99 
108  ToVectorConstReturnType toVector() const
109  {
110  return derived().toVector_impl();
111  }
112 
114  ToVectorReturnType toVector()
115  {
116  return derived().toVector_impl();
117  }
118 
119  /*
120  * @brief C-style cast operator
121  * \copydoc ForceBase::toVector
122  */
123  operator Vector6() const
124  {
125  return toVector();
126  }
127 
132  template<typename F2>
133  bool operator==(const ForceBase<F2> & other) const
134  {
135  return derived().isEqual_impl(other.derived());
136  }
137 
140  template<typename F2>
141  bool operator!=(const ForceBase<F2> & other) const
142  {
143  return !(derived() == other.derived());
144  }
145 
148  bool isApprox(
149  const Derived & other,
150  const Scalar & prec = Eigen::NumTraits<Scalar>::dummy_precision()) const
151  {
152  return derived().isApprox_impl(other, prec);
153  }
154 
158  bool isZero(const Scalar & prec = Eigen::NumTraits<Scalar>::dummy_precision()) const
159  {
160  return derived().isZero_impl(prec);
161  }
162 
166  Derived & operator=(const ForceBase<Derived> & other)
167  {
168  return derived().setFrom(other.derived());
169  }
170 
175  Derived & operator+=(const ForceBase<Derived> & phi)
176  {
177  return derived().__pequ__(phi.derived());
178  }
179 
184  Derived & operator-=(const ForceBase<Derived> & phi)
185  {
186  return derived().__mequ__(phi.derived());
187  }
188 
191  Derived operator+(const ForceBase<Derived> & phi) const
192  {
193  return derived().__plus__(phi.derived());
194  }
195 
198  template<typename OtherScalar>
199  ForcePlain operator*(const OtherScalar & alpha) const
200  {
201  return derived().__mult__(alpha);
202  }
203 
206  template<typename OtherScalar>
207  ForcePlain operator/(const OtherScalar & alpha) const
208  {
209  return derived().__div__(alpha);
210  }
211 
214  Derived operator-() const
215  {
216  return derived().__opposite__();
217  }
218 
221  Derived operator-(const ForceBase<Derived> & phi) const
222  {
223  return derived().__minus__(phi.derived());
224  }
225 
228  template<typename MotionDerived>
230  {
231  return derived().dot(m.derived());
232  }
233 
246  template<typename S2, int O2>
248  {
249  return derived().se3Action_impl(m);
250  }
251 
264  template<typename S2, int O2>
266  {
267  return derived().se3ActionInverse_impl(m);
268  }
269 
270  template<typename M1>
273  {
274  return derived().motionAction(v.derived());
275  }
276 
277  void disp(std::ostream & os) const
278  {
279  derived().disp_impl(os);
280  }
281  friend std::ostream & operator<<(std::ostream & os, const ForceBase<Derived> & X)
282  {
283  X.disp(os);
284  return os;
285  }
286 
287  }; // class ForceBase
288 
289 } // namespace pinocchio
290 
291 #endif // ifndef __pinocchio_spatial_force_base_hpp__
test-cpp2pybind11.m
m
Definition: test-cpp2pybind11.py:22
pinocchio::ForceBase::linear
ConstLinearType linear() const
Return the linear part of the force vector.
Definition: force-base.hpp:57
pinocchio::ForceBase::operator-
Derived operator-(const ForceBase< Derived > &phi) const
Definition: force-base.hpp:221
pinocchio::ForceBase::derived
Derived & derived()
Definition: force-base.hpp:28
pinocchio::ForceBase
Base interface for forces representation.
Definition: context/casadi.hpp:32
pinocchio::SE3Tpl
Definition: context/casadi.hpp:29
pinocchio::SE3GroupAction::ReturnType
D ReturnType
Definition: spatial/se3.hpp:41
pinocchio::ForceBase::operator-=
Derived & operator-=(const ForceBase< Derived > &phi)
Replaces *this by *this - other.
Definition: force-base.hpp:184
pinocchio::MotionDense
Definition: context/casadi.hpp:36
pinocchio::python::Scalar
context::Scalar Scalar
Definition: admm-solver.cpp:29
pinocchio::ForceBase::operator=
Derived & operator=(const ForceBase< Derived > &other)
Copies the Derived Force into *this.
Definition: force-base.hpp:166
autodiff-rnea.f
f
Definition: autodiff-rnea.py:24
pinocchio::MotionAlgebraAction::ReturnType
D ReturnType
Definition: spatial/motion.hpp:47
pinocchio::ForceBase::motionAction
MotionAlgebraAction< Derived, M1 >::ReturnType motionAction(const MotionDense< M1 > &v) const
Definition: force-base.hpp:272
pinocchio::ForceBase::se3Action
SE3GroupAction< Derived >::ReturnType se3Action(const SE3Tpl< S2, O2 > &m) const
Transform from A to B coordinates the Force represented by *this such that.
Definition: force-base.hpp:247
pinocchio::ForceBase::operator+=
Derived & operator+=(const ForceBase< Derived > &phi)
Replaces *this by *this + other.
Definition: force-base.hpp:175
reachable-workspace-with-collisions.alpha
float alpha
Definition: reachable-workspace-with-collisions.py:159
pinocchio::ForceBase::operator-
Derived operator-() const
Definition: force-base.hpp:214
pinocchio::ForceBase::disp
void disp(std::ostream &os) const
Definition: force-base.hpp:277
pinocchio::ForceBase::toVector
ToVectorReturnType toVector()
Return the force as an Eigen vector.
Definition: force-base.hpp:114
pinocchio::ForceBase::se3ActionInverse
SE3GroupAction< Derived >::ReturnType se3ActionInverse(const SE3Tpl< S2, O2 > &m) const
Transform from B to A coordinates the Force represented by *this such that.
Definition: force-base.hpp:265
pinocchio::ForceBase::FORCE_TYPEDEF_TPL
FORCE_TYPEDEF_TPL(Derived)
pinocchio::ForceBase::dot
Scalar dot(const MotionDense< MotionDerived > &m) const
Definition: force-base.hpp:229
pinocchio::v
JointCollectionTpl const Eigen::MatrixBase< ConfigVectorType > const Eigen::MatrixBase< TangentVectorType > & v
Definition: joint-configuration.hpp:1118
pinocchio::ForceBase::isZero
bool isZero(const Scalar &prec=Eigen::NumTraits< Scalar >::dummy_precision()) const
Definition: force-base.hpp:158
pinocchio::ForceBase::const_cast_derived
Derived & const_cast_derived() const
Definition: force-base.hpp:37
pinocchio::ForceBase::toVector
ToVectorConstReturnType toVector() const
Return the force as an Eigen vector.
Definition: force-base.hpp:108
pinocchio::ForceBase::operator+
Derived operator+(const ForceBase< Derived > &phi) const
Definition: force-base.hpp:191
pinocchio::ForceBase::operator!=
bool operator!=(const ForceBase< F2 > &other) const
Definition: force-base.hpp:141
pinocchio::ForceBase::operator/
ForcePlain operator/(const OtherScalar &alpha) const
Definition: force-base.hpp:207
pinocchio::ForceBase::isApprox
bool isApprox(const Derived &other, const Scalar &prec=Eigen::NumTraits< Scalar >::dummy_precision()) const
Definition: force-base.hpp:148
pinocchio::ForceBase::angular
ConstAngularType angular() const
Return the angular part of the force vector.
Definition: force-base.hpp:47
pinocchio::ForceBase::operator<<
friend std::ostream & operator<<(std::ostream &os, const ForceBase< Derived > &X)
Definition: force-base.hpp:281
pinocchio::ForceDense::derived
const Derived & derived() const
Definition: force-base.hpp:32
pinocchio::ForceBase::operator==
bool operator==(const ForceBase< F2 > &other) const
Definition: force-base.hpp:133
X
n
Vec3f n
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:27
pinocchio::ForceBase::operator*
ForcePlain operator*(const OtherScalar &alpha) const
Definition: force-base.hpp:199


pinocchio
Author(s):
autogenerated on Fri Jun 7 2024 02:40:46