spatial/inertia.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2015-2021 CNRS INRIA
3 // Copyright (c) 2016 Wandercraft, 86 rue de Paris 91400 Orsay, France.
4 //
5 
6 #ifndef __pinocchio_spatial_inertia_hpp__
7 #define __pinocchio_spatial_inertia_hpp__
8 
9 #include "pinocchio/math/fwd.hpp"
14 
15 namespace pinocchio
16 {
17 
18  template<class Derived>
19  struct InertiaBase : NumericalBase<Derived>
20  {
21  SPATIAL_TYPEDEF_TEMPLATE(Derived);
22 
23  Derived & derived()
24  {
25  return *static_cast<Derived *>(this);
26  }
27  const Derived & derived() const
28  {
29  return *static_cast<const Derived *>(this);
30  }
31 
32  Derived & const_cast_derived() const
33  {
34  return *const_cast<Derived *>(&derived());
35  }
36 
37  Scalar mass() const
38  {
39  return static_cast<const Derived *>(this)->mass();
40  }
42  {
43  return static_cast<const Derived *>(this)->mass();
44  }
45  const Vector3 & lever() const
46  {
47  return static_cast<const Derived *>(this)->lever();
48  }
50  {
51  return static_cast<const Derived *>(this)->lever();
52  }
53  const Symmetric3 & inertia() const
54  {
55  return static_cast<const Derived *>(this)->inertia();
56  }
58  {
59  return static_cast<const Derived *>(this)->inertia();
60  }
61 
62  template<typename Matrix6Like>
63  void matrix(const Eigen::MatrixBase<Matrix6Like> & mat) const
64  {
65  derived().matrix_impl(mat);
66  }
67  Matrix6 matrix() const
68  {
69  return derived().matrix_impl();
70  }
71  operator Matrix6() const
72  {
73  return matrix();
74  }
75 
76  template<typename Matrix6Like>
77  void inverse(const Eigen::MatrixBase<Matrix6Like> & mat) const
78  {
79  derived().inverse_impl(mat);
80  }
81  Matrix6 inverse() const
82  {
83  return derived().inverse_impl();
84  }
85 
86  Derived & operator=(const Derived & clone)
87  {
88  return derived().__equl__(clone);
89  }
90  bool operator==(const Derived & other) const
91  {
92  return derived().isEqual(other);
93  }
94  bool operator!=(const Derived & other) const
95  {
96  return !(*this == other);
97  }
98 
99  Derived & operator+=(const Derived & Yb)
100  {
101  return derived().__pequ__(Yb);
102  }
103  Derived operator+(const Derived & Yb) const
104  {
105  return derived().__plus__(Yb);
106  }
107  Derived & operator-=(const Derived & Yb)
108  {
109  return derived().__mequ__(Yb);
110  }
111  Derived operator-(const Derived & Yb) const
112  {
113  return derived().__minus__(Yb);
114  }
115 
116  template<typename MotionDerived>
119  {
120  return derived().__mult__(v);
121  }
122 
123  template<typename MotionDerived>
125  {
126  return derived().vtiv_impl(v);
127  }
128 
129  template<typename MotionDerived>
130  Matrix6 variation(const MotionDense<MotionDerived> & v) const
131  {
132  return derived().variation_impl(v);
133  }
134 
143  template<typename MotionDerived, typename M6>
144  static void
145  vxi(const MotionDense<MotionDerived> & v, const Derived & I, const Eigen::MatrixBase<M6> & Iout)
146  {
147  EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(M6, Matrix6);
148  Derived::vxi_impl(v, I, Iout);
149  }
150 
151  template<typename MotionDerived>
152  Matrix6 vxi(const MotionDense<MotionDerived> & v) const
153  {
154  Matrix6 Iout;
155  vxi(v, derived(), Iout);
156  return Iout;
157  }
158 
167  template<typename MotionDerived, typename M6>
168  static void
169  ivx(const MotionDense<MotionDerived> & v, const Derived & I, const Eigen::MatrixBase<M6> & Iout)
170  {
171  EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(M6, Matrix6);
172  Derived::ivx_impl(v, I, Iout);
173  }
174 
175  template<typename MotionDerived>
176  Matrix6 ivx(const MotionDense<MotionDerived> & v) const
177  {
178  Matrix6 Iout;
179  ivx(v, derived(), Iout);
180  return Iout;
181  }
182 
183  void setZero()
184  {
185  derived().setZero();
186  }
187  void setIdentity()
188  {
189  derived().setIdentity();
190  }
191  void setRandom()
192  {
193  derived().setRandom();
194  }
195 
196  bool isApprox(
197  const Derived & other,
198  const Scalar & prec = Eigen::NumTraits<Scalar>::dummy_precision()) const
199  {
200  return derived().isApprox_impl(other, prec);
201  }
202 
203  bool isZero(const Scalar & prec = Eigen::NumTraits<Scalar>::dummy_precision()) const
204  {
205  return derived().isZero_impl(prec);
206  }
207 
209  template<typename S2, int O2>
210  Derived se3Action(const SE3Tpl<S2, O2> & M) const
211  {
212  return derived().se3Action_impl(M);
213  }
214 
216  template<typename S2, int O2>
217  Derived se3ActionInverse(const SE3Tpl<S2, O2> & M) const
218  {
219  return derived().se3ActionInverse_impl(M);
220  }
221 
222  void disp(std::ostream & os) const
223  {
224  static_cast<const Derived *>(this)->disp_impl(os);
225  }
226  friend std::ostream & operator<<(std::ostream & os, const InertiaBase<Derived> & X)
227  {
228  X.disp(os);
229  return os;
230  }
231 
232  }; // class InertiaBase
233 
234  template<typename T, int U>
235  struct traits<InertiaTpl<T, U>>
236  {
237  typedef T Scalar;
238  typedef Eigen::Matrix<T, 3, 1, U> Vector3;
239  typedef Eigen::Matrix<T, 4, 1, U> Vector4;
240  typedef Eigen::Matrix<T, 6, 1, U> Vector6;
241  typedef Eigen::Matrix<T, 3, 3, U> Matrix3;
242  typedef Eigen::Matrix<T, 4, 4, U> Matrix4;
243  typedef Eigen::Matrix<T, 6, 6, U> Matrix6;
246  typedef Vector3 Linear_t;
247  typedef const Vector3 ConstAngular_t;
248  typedef const Vector3 ConstLinear_t;
249  typedef Eigen::Quaternion<T, U> Quaternion_t;
250  typedef SE3Tpl<T, U> SE3;
254  enum
255  {
256  LINEAR = 0,
257  ANGULAR = 3
258  };
259  }; // traits InertiaTpl
260 
261  template<typename _Scalar, int _Options>
262  struct InertiaTpl : public InertiaBase<InertiaTpl<_Scalar, _Options>>
263  {
264  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
265 
267  enum
268  {
269  Options = _Options
270  };
271 
272  typedef typename Symmetric3::AlphaSkewSquare AlphaSkewSquare;
273  typedef typename Eigen::Matrix<Scalar, 10, 1, Options> Vector10;
274 
275  // Constructors
277  {
278  }
279 
280  InertiaTpl(const Scalar & mass, const Vector3 & com, const Matrix3 & rotational_inertia)
281  : m_mass(mass)
282  , m_com(com)
283  , m_inertia(rotational_inertia)
284  {
285  }
286 
287  explicit InertiaTpl(const Matrix6 & I6)
288  {
289  assert(check_expression_if_real<Scalar>(isZero(I6 - I6.transpose())));
290  mass() = I6(LINEAR, LINEAR);
291  const typename Matrix6::template ConstFixedBlockXpr<3, 3>::Type mc_cross =
292  I6.template block<3, 3>(ANGULAR, LINEAR);
293  lever() = unSkew(mc_cross);
294  lever() /= mass();
295 
296  Matrix3 I3(mc_cross * mc_cross);
297  I3 /= mass();
298  I3 += I6.template block<3, 3>(ANGULAR, ANGULAR);
299  const Symmetric3 S3(I3);
300  inertia() = S3;
301  }
302 
303  InertiaTpl(const Scalar & mass, const Vector3 & com, const Symmetric3 & rotational_inertia)
304  : m_mass(mass)
305  , m_com(com)
306  , m_inertia(rotational_inertia)
307  {
308  }
309 
310  InertiaTpl(const InertiaTpl & clone) // Copy constructor
311  : m_mass(clone.mass())
312  , m_com(clone.lever())
313  , m_inertia(clone.inertia())
314  {
315  }
316 
317  InertiaTpl & operator=(const InertiaTpl & clone) // Copy assignment operator
318  {
319  m_mass = clone.mass();
320  m_com = clone.lever();
321  m_inertia = clone.inertia();
322  return *this;
323  }
324 
325  template<typename S2, int O2>
327  {
328  *this = clone.template cast<Scalar>();
329  }
330 
331  // Initializers
332  static InertiaTpl Zero()
333  {
334  return InertiaTpl(Scalar(0), Vector3::Zero(), Symmetric3::Zero());
335  }
336 
337  void setZero()
338  {
339  mass() = Scalar(0);
340  lever().setZero();
341  inertia().setZero();
342  }
343 
345  {
346  return InertiaTpl(Scalar(1), Vector3::Zero(), Symmetric3::Identity());
347  }
348 
349  void setIdentity()
350  {
351  mass() = Scalar(1);
352  lever().setZero();
353  inertia().setIdentity();
354  }
355 
357  {
358  // We have to shoot "I" definite positive and not only symmetric.
359  return InertiaTpl(
360  Eigen::internal::random<Scalar>() + 1, Vector3::Random(), Symmetric3::RandomPositive());
361  }
362 
370  {
372  }
373 
383  static InertiaTpl
384  FromEllipsoid(const Scalar mass, const Scalar x, const Scalar y, const Scalar z)
385  {
386  const Scalar a = mass * (y * y + z * z) / Scalar(5);
387  const Scalar b = mass * (x * x + z * z) / Scalar(5);
388  const Scalar c = mass * (y * y + x * x) / Scalar(5);
389  return InertiaTpl(
390  mass, Vector3::Zero(), Symmetric3(a, Scalar(0), b, Scalar(0), Scalar(0), c));
391  }
392 
402  {
403  const Scalar radius_square = radius * radius;
404  const Scalar a = mass * (radius_square / Scalar(4) + length * length / Scalar(12));
405  const Scalar c = mass * (radius_square / Scalar(2));
406  return InertiaTpl(
407  mass, Vector3::Zero(), Symmetric3(a, Scalar(0), a, Scalar(0), Scalar(0), c));
408  }
409 
418  static InertiaTpl FromBox(const Scalar mass, const Scalar x, const Scalar y, const Scalar z)
419  {
420  const Scalar a = mass * (y * y + z * z) / Scalar(12);
421  const Scalar b = mass * (x * x + z * z) / Scalar(12);
422  const Scalar c = mass * (y * y + x * x) / Scalar(12);
423  return InertiaTpl(
424  mass, Vector3::Zero(), Symmetric3(a, Scalar(0), b, Scalar(0), Scalar(0), c));
425  }
426 
435  {
436  const Scalar pi = boost::math::constants::pi<Scalar>();
437 
438  // first need to compute mass repartition between cylinder and halfsphere
439  const Scalar v_cyl = pi * math::pow(radius, 2) * height;
440  const Scalar v_hs = Scalar(2) / Scalar(3) * math::pow(radius, 3) * pi;
441  const Scalar total_v = v_cyl + Scalar(2) * v_hs;
442 
443  const Scalar m_cyl = mass * (v_cyl / total_v);
444  const Scalar m_hs = mass * (v_hs / total_v);
445 
446  // Then Distance between halfSphere center and cylindere center.
447  const Scalar dist_hc_cyl = height / Scalar(2) + Scalar(0.375) * radius;
448 
449  // Computes inertia terms
450  const Scalar ix_c =
451  m_cyl * (math::pow(height, 2) / Scalar(12) + math::pow(radius, 2) / Scalar(4));
452  const Scalar iz_c = m_cyl * math::pow(radius, 2) / Scalar(2);
453 
454  // For halfsphere inertia see, "Dynamics: Theory and Applications" McGraw-Hill, New York,
455  // 1985, by T.R. Kane and D.A. Levinson, Appendix 23.
456  const Scalar ix_hs = m_hs * math::pow(radius, 2) * Scalar(0.259375);
457  const Scalar iz_hs = m_hs * math::pow(radius, 2) * Scalar(0.4);
458 
459  // Put everything together using the parallel axis theorem
460  const Scalar ix = ix_c + Scalar(2) * (ix_hs + m_hs * math::pow(dist_hc_cyl, 2));
461  const Scalar iz = iz_c + Scalar(2) * iz_hs;
462 
463  return InertiaTpl(
464  mass, Vector3::Zero(), Symmetric3(ix, Scalar(0), ix, Scalar(0), Scalar(0), iz));
465  }
466 
467  void setRandom()
468  {
469  mass() = static_cast<Scalar>(std::rand()) / static_cast<Scalar>(RAND_MAX);
470  lever().setRandom();
471  inertia().setRandom();
472  }
473 
474  template<typename Matrix6Like>
475  void matrix_impl(const Eigen::MatrixBase<Matrix6Like> & M_) const
476  {
477  Matrix6Like & M = M_.const_cast_derived();
478 
479  M.template block<3, 3>(LINEAR, LINEAR).setZero();
480  M.template block<3, 3>(LINEAR, LINEAR).diagonal().fill(mass());
481  M.template block<3, 3>(ANGULAR, LINEAR) = alphaSkew(mass(), lever());
482  M.template block<3, 3>(LINEAR, ANGULAR) = -M.template block<3, 3>(ANGULAR, LINEAR);
483  M.template block<3, 3>(ANGULAR, ANGULAR) =
484  (inertia() - AlphaSkewSquare(mass(), lever())).matrix();
485  }
486 
487  Matrix6 matrix_impl() const
488  {
489  Matrix6 M;
490  matrix_impl(M);
491  return M;
492  }
493 
494  template<typename Matrix6Like>
495  void inverse_impl(const Eigen::MatrixBase<Matrix6Like> & M_) const
496  {
497  Matrix6Like & M = M_.const_cast_derived();
498  inertia().inverse(M.template block<3, 3>(ANGULAR, ANGULAR));
499 
500  M.template block<3, 3>(LINEAR, ANGULAR).noalias() =
501  -M.template block<3, 3>(ANGULAR, ANGULAR).colwise().cross(lever());
502  M.template block<3, 3>(ANGULAR, LINEAR) = M.template block<3, 3>(LINEAR, ANGULAR).transpose();
503 
504  const Scalar &cx = lever()[0], cy = lever()[1], cz = lever()[2];
505 
506  M.template block<3, 3>(LINEAR, LINEAR).col(0).noalias() =
507  cy * M.template block<3, 3>(LINEAR, ANGULAR).col(2)
508  - cz * M.template block<3, 3>(LINEAR, ANGULAR).col(1);
509 
510  M.template block<3, 3>(LINEAR, LINEAR).col(1).noalias() =
511  cz * M.template block<3, 3>(LINEAR, ANGULAR).col(0)
512  - cx * M.template block<3, 3>(LINEAR, ANGULAR).col(2);
513 
514  M.template block<3, 3>(LINEAR, LINEAR).col(2).noalias() =
515  cx * M.template block<3, 3>(LINEAR, ANGULAR).col(1)
516  - cy * M.template block<3, 3>(LINEAR, ANGULAR).col(0);
517 
518  const Scalar m_inv = Scalar(1) / mass();
519  M.template block<3, 3>(LINEAR, LINEAR).diagonal().array() += m_inv;
520  }
521 
522  Matrix6 inverse_impl() const
523  {
524  Matrix6 res;
525  inverse_impl(res);
526  return res;
527  }
528 
537  {
538  Vector10 v;
539 
540  v[0] = mass();
541  v.template segment<3>(1).noalias() = mass() * lever();
542  v.template segment<6>(4) = (inertia() - AlphaSkewSquare(mass(), lever())).data();
543 
544  return v;
545  }
546 
555  template<typename Vector10Like>
556  static InertiaTpl FromDynamicParameters(const Eigen::MatrixBase<Vector10Like> & params)
557  {
558  PINOCCHIO_ASSERT_MATRIX_SPECIFIC_SIZE(Vector10Like, params, 10, 1);
559 
560  const Scalar & mass = params[0];
561  Vector3 lever = params.template segment<3>(1);
562  lever /= mass;
563 
564  return InertiaTpl(
565  mass, lever, Symmetric3(params.template segment<6>(4)) + AlphaSkewSquare(mass, lever));
566  }
567 
568  // Arithmetic operators
570  {
571  mass() = clone.mass();
572  lever() = clone.lever();
573  inertia() = clone.inertia();
574  return *this;
575  }
576 
577  // Required by std::vector boost::python bindings.
578  bool isEqual(const InertiaTpl & Y2) const
579  {
580  return (mass() == Y2.mass()) && (lever() == Y2.lever()) && (inertia() == Y2.inertia());
581  }
582 
584  const InertiaTpl & other,
585  const Scalar & prec = Eigen::NumTraits<Scalar>::dummy_precision()) const
586  {
587  using math::fabs;
588  return fabs(static_cast<Scalar>(mass() - other.mass())) <= prec
589  && lever().isApprox(other.lever(), prec) && inertia().isApprox(other.inertia(), prec);
590  }
591 
592  bool isZero_impl(const Scalar & prec = Eigen::NumTraits<Scalar>::dummy_precision()) const
593  {
594  using math::fabs;
595  return fabs(mass()) <= prec && lever().isZero(prec) && inertia().isZero(prec);
596  }
597 
598  InertiaTpl __plus__(const InertiaTpl & Yb) const
599  {
600  /* Y_{a+b} = ( m_a+m_b,
601  * (m_a*c_a + m_b*c_b ) / (m_a + m_b),
602  * I_a + I_b - (m_a*m_b)/(m_a+m_b) * AB_x * AB_x )
603  */
604 
605  const Scalar eps = ::Eigen::NumTraits<Scalar>::epsilon();
606 
607  const Scalar & mab = mass() + Yb.mass();
608  const Scalar mab_inv = Scalar(1) / math::max(mab, eps);
609  const Vector3 & AB = (lever() - Yb.lever()).eval();
610  return InertiaTpl(
611  mab, (mass() * lever() + Yb.mass() * Yb.lever()) * mab_inv,
612  inertia() + Yb.inertia()
613  - (mass() * Yb.mass() * mab_inv) * typename Symmetric3::SkewSquare(AB));
614  }
615 
617  {
618  static const Scalar eps = ::Eigen::NumTraits<Scalar>::epsilon();
619 
620  const InertiaTpl & Ya = *this;
621  const Scalar & mab = mass() + Yb.mass();
622  const Scalar mab_inv = Scalar(1) / math::max(mab, eps);
623  const Vector3 & AB = (Ya.lever() - Yb.lever()).eval();
624  lever() *= (mass() * mab_inv);
625  lever() += (Yb.mass() * mab_inv) * Yb.lever(); // c *= mab_inv;
626  inertia() += Yb.inertia();
627  inertia() -= (Ya.mass() * Yb.mass() * mab_inv) * typename Symmetric3::SkewSquare(AB);
628  mass() = mab;
629  return *this;
630  }
631 
632  InertiaTpl __minus__(const InertiaTpl & Yb) const
633  {
634  /* Y_{a} = ( m_{a+b}+m_b,
635  * (m_{a+b}*c_{a+b} - m_b*c_b ) / (m_a),
636  * I_{a+b} - I_b + (m_a*m_b)/(m_a+m_b) * AB_x * AB_x )
637  */
638 
639  const Scalar eps = ::Eigen::NumTraits<Scalar>::epsilon();
640 
641  const Scalar ma = mass() - Yb.mass();
642  assert(check_expression_if_real<Scalar>(ma >= Scalar(0)));
643 
644  const Scalar ma_inv = Scalar(1) / math::max(ma, eps);
645  const Vector3 c_a((mass() * lever() - Yb.mass() * Yb.lever()) * ma_inv);
646 
647  const Vector3 AB = c_a - Yb.lever();
648 
649  return InertiaTpl(
650  ma, c_a,
651  inertia() - Yb.inertia() + (ma * Yb.mass() / mass()) * typename Symmetric3::SkewSquare(AB));
652  }
653 
655  {
656  static const Scalar eps = ::Eigen::NumTraits<Scalar>::epsilon();
657 
658  const Scalar ma = mass() - Yb.mass();
659  assert(check_expression_if_real<Scalar>(ma >= Scalar(0)));
660 
661  const Scalar ma_inv = Scalar(1) / math::max(ma, eps);
662 
663  lever() *= (mass() * ma_inv);
664  lever().noalias() -= (Yb.mass() * ma_inv) * Yb.lever();
665 
666  const Vector3 AB = lever() - Yb.lever();
667  inertia() -= Yb.inertia();
668  inertia() += (ma * Yb.mass() / mass()) * typename Symmetric3::SkewSquare(AB);
669  mass() = ma;
670 
671  return *this;
672  }
673 
674  template<typename MotionDerived>
677  {
679  ReturnType;
680  ReturnType f;
681  __mult__(v, f);
682  return f;
683  }
684 
685  template<typename MotionDerived, typename ForceDerived>
687  {
688  f.linear().noalias() = mass() * (v.linear() - lever().cross(v.angular()));
689  Symmetric3::rhsMult(inertia(), v.angular(), f.angular());
690  f.angular() += lever().cross(f.linear());
691  // f.angular().noalias() = c.cross(f.linear()) + I*v.angular();
692  }
693 
694  template<typename MotionDerived>
696  {
697  const Vector3 cxw(lever().cross(v.angular()));
698  Scalar res = mass() * (v.linear().squaredNorm() - Scalar(2) * v.linear().dot(cxw));
699  const Vector3 mcxcxw(-mass() * lever().cross(cxw));
700  res += v.angular().dot(mcxcxw);
701  res += inertia().vtiv(v.angular());
702 
703  return res;
704  }
705 
706  template<typename MotionDerived>
707  Matrix6 variation(const MotionDense<MotionDerived> & v) const
708  {
709  Matrix6 res;
710  const Motion mv(v * mass());
711 
712  res.template block<3, 3>(LINEAR, ANGULAR) =
713  -skew(mv.linear()) - skewSquare(mv.angular(), lever()) + skewSquare(lever(), mv.angular());
714  res.template block<3, 3>(ANGULAR, LINEAR) =
715  res.template block<3, 3>(LINEAR, ANGULAR).transpose();
716 
717  // res.template block<3,3>(LINEAR,LINEAR) = mv.linear()*c.transpose(); // use as
718  // temporary variable res.template block<3,3>(ANGULAR,ANGULAR) = res.template
719  // block<3,3>(LINEAR,LINEAR) - res.template block<3,3>(LINEAR,LINEAR).transpose();
720  res.template block<3, 3>(ANGULAR, ANGULAR) =
721  -skewSquare(mv.linear(), lever()) - skewSquare(lever(), mv.linear());
722 
723  res.template block<3, 3>(LINEAR, LINEAR) =
724  (inertia() - AlphaSkewSquare(mass(), lever())).matrix();
725 
726  res.template block<3, 3>(ANGULAR, ANGULAR) -=
727  res.template block<3, 3>(LINEAR, LINEAR) * skew(v.angular());
728  res.template block<3, 3>(ANGULAR, ANGULAR) +=
729  cross(v.angular(), res.template block<3, 3>(LINEAR, LINEAR));
730 
731  res.template block<3, 3>(LINEAR, LINEAR).setZero();
732  return res;
733  }
734 
735  template<typename MotionDerived, typename M6>
736  static void vxi_impl(
738  const InertiaTpl & I,
739  const Eigen::MatrixBase<M6> & Iout)
740  {
741  EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(M6, 6, 6);
742  M6 & Iout_ = PINOCCHIO_EIGEN_CONST_CAST(M6, Iout);
743 
744  // Block 1,1
745  alphaSkew(I.mass(), v.angular(), Iout_.template block<3, 3>(LINEAR, LINEAR));
746  // Iout_.template block<3,3>(LINEAR,LINEAR) = alphaSkew(I.mass(),v.angular());
747  const Vector3 mc(I.mass() * I.lever());
748 
749  // Block 1,2
750  skewSquare(-v.angular(), mc, Iout_.template block<3, 3>(LINEAR, ANGULAR));
751 
753  alphaSkew(I.mass(), v.linear(), Iout_.template block<3, 3>(ANGULAR, LINEAR));
754  Iout_.template block<3, 3>(ANGULAR, LINEAR) -= Iout_.template block<3, 3>(LINEAR, ANGULAR);
755 
757  skewSquare(-v.linear(), mc, Iout_.template block<3, 3>(ANGULAR, ANGULAR));
758 
759  // TODO: I do not why, but depending on the CPU, these three lines can give
760  // wrong output.
761  // typename Symmetric3::AlphaSkewSquare mcxcx(I.mass(),I.lever());
762  // const Symmetric3 I_mcxcx(I.inertia() - mcxcx);
763  // Iout_.template block<3,3>(ANGULAR,ANGULAR) += I_mcxcx.vxs(v.angular());
764  Symmetric3 mcxcx(typename Symmetric3::AlphaSkewSquare(I.mass(), I.lever()));
765  Iout_.template block<3, 3>(ANGULAR, ANGULAR) += I.inertia().vxs(v.angular());
766  Iout_.template block<3, 3>(ANGULAR, ANGULAR) -= mcxcx.vxs(v.angular());
767  }
768 
769  template<typename MotionDerived, typename M6>
770  static void ivx_impl(
772  const InertiaTpl & I,
773  const Eigen::MatrixBase<M6> & Iout)
774  {
775  EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(M6, 6, 6);
776  M6 & Iout_ = PINOCCHIO_EIGEN_CONST_CAST(M6, Iout);
777 
778  // Block 1,1
779  alphaSkew(I.mass(), v.angular(), Iout_.template block<3, 3>(LINEAR, LINEAR));
780 
781  // Block 2,1
782  const Vector3 mc(I.mass() * I.lever());
783  skewSquare(mc, v.angular(), Iout_.template block<3, 3>(ANGULAR, LINEAR));
784 
785  // Block 1,2
786  alphaSkew(I.mass(), v.linear(), Iout_.template block<3, 3>(LINEAR, ANGULAR));
787 
788  // Block 2,2
789  cross(
790  -I.lever(), Iout_.template block<3, 3>(ANGULAR, LINEAR),
791  Iout_.template block<3, 3>(ANGULAR, ANGULAR));
792  Iout_.template block<3, 3>(ANGULAR, ANGULAR) += I.inertia().svx(v.angular());
793  for (int k = 0; k < 3; ++k)
794  Iout_.template block<3, 3>(ANGULAR, ANGULAR).col(k) +=
795  I.lever().cross(Iout_.template block<3, 3>(LINEAR, ANGULAR).col(k));
796 
797  // Block 1,2
798  Iout_.template block<3, 3>(LINEAR, ANGULAR) -= Iout_.template block<3, 3>(ANGULAR, LINEAR);
799  }
800 
801  // Getters
802  Scalar mass() const
803  {
804  return m_mass;
805  }
806  const Vector3 & lever() const
807  {
808  return m_com;
809  }
810  const Symmetric3 & inertia() const
811  {
812  return m_inertia;
813  }
814 
816  {
817  return m_mass;
818  }
820  {
821  return m_com;
822  }
824  {
825  return m_inertia;
826  }
827 
829  template<typename S2, int O2>
831  {
832  /* The multiplication RIR' has a particular form that could be used, however it
833  * does not seems to be more efficient, see http://stackoverflow.m_comom/questions/
834  * 13215467/eigen-best-way-to-evaluate-asa-transpose-and-store-the-result-in-a-symmetric .*/
835  return InertiaTpl(
836  mass(), M.translation() + M.rotation() * lever(), inertia().rotate(M.rotation()));
837  }
838 
840  template<typename S2, int O2>
842  {
843  return InertiaTpl(
844  mass(), M.rotation().transpose() * (lever() - M.translation()),
845  inertia().rotate(M.rotation().transpose()));
846  }
847 
848  template<typename MotionDerived>
850  {
851  const Vector3 & mcxw = mass() * lever().cross(v.angular());
852  const Vector3 & mv_mcxw = mass() * v.linear() - mcxw;
853  return Force(
854  v.angular().cross(mv_mcxw),
855  v.angular().cross(lever().cross(mv_mcxw) + inertia() * v.angular())
856  - v.linear().cross(mcxw));
857  }
858 
859  void disp_impl(std::ostream & os) const
860  {
861  os << " m = " << mass() << "\n"
862  << " c = " << lever().transpose() << "\n"
863  << " I = \n"
864  << inertia().matrix() << "";
865  }
866 
868  template<typename NewScalar>
870  {
872  pinocchio::cast<NewScalar>(mass()), lever().template cast<NewScalar>(),
873  inertia().template cast<NewScalar>());
874  }
875 
876  // TODO: adjust code
877  // /// \brief Check whether *this is a valid inertia, resulting from a positive mass
878  // distribution bool isValid() const
879  // {
880  // return
881  // (m_mass > Scalar(0) && m_inertia.isValid())
882  // || (m_mass == Scalar(0) && (m_inertia.data().array() == Scalar(0)).all());
883  // }
884 
885  protected:
889 
890  }; // class InertiaTpl
891 
892 } // namespace pinocchio
893 
894 #endif // ifndef __pinocchio_spatial_inertia_hpp__
simulation-contact-dynamics.T
int T
Definition: simulation-contact-dynamics.py:94
pinocchio::InertiaTpl
Definition: spatial/fwd.hpp:58
pinocchio::traits< InertiaTpl< T, U > >::ConstAngular_t
const typedef Vector3 ConstAngular_t
Definition: spatial/inertia.hpp:247
pinocchio::InertiaTpl::isEqual
bool isEqual(const InertiaTpl &Y2) const
Definition: spatial/inertia.hpp:578
pinocchio::InertiaBase::operator-
Derived operator-(const Derived &Yb) const
Definition: spatial/inertia.hpp:111
pinocchio::InertiaTpl::vxi_impl
static void vxi_impl(const MotionDense< MotionDerived > &v, const InertiaTpl &I, const Eigen::MatrixBase< M6 > &Iout)
Definition: spatial/inertia.hpp:736
pinocchio::InertiaTpl::m_com
Vector3 m_com
Definition: spatial/inertia.hpp:887
pinocchio::InertiaTpl::__plus__
InertiaTpl __plus__(const InertiaTpl &Yb) const
Definition: spatial/inertia.hpp:598
pinocchio::NumericalBase
Definition: fwd.hpp:89
pinocchio::Symmetric3
Symmetric3Tpl< context::Scalar, context::Options > Symmetric3
Definition: spatial/fwd.hpp:66
pinocchio::InertiaTpl::__mequ__
InertiaTpl & __mequ__(const InertiaTpl &Yb)
Definition: spatial/inertia.hpp:654
pinocchio::InertiaTpl::FromEllipsoid
static InertiaTpl FromEllipsoid(const Scalar mass, const Scalar x, const Scalar y, const Scalar z)
Computes the Inertia of an ellipsoid defined by its mass and main semi-axis dimensions (x,...
Definition: spatial/inertia.hpp:384
pinocchio::InertiaBase::setRandom
void setRandom()
Definition: spatial/inertia.hpp:191
pinocchio::traits< InertiaTpl< T, U > >::Scalar
T Scalar
Definition: spatial/inertia.hpp:237
pinocchio::Symmetric3Tpl::vxs
static void vxs(const Eigen::MatrixBase< Vector3 > &v, const Symmetric3Tpl &S3, const Eigen::MatrixBase< Matrix3 > &M)
Performs the operation . This operation is equivalent to applying the cross product of v on each colu...
Definition: spatial/symmetric3.hpp:351
pinocchio::InertiaBase::inverse
Matrix6 inverse() const
Definition: spatial/inertia.hpp:81
pinocchio::InertiaBase::mass
Scalar mass() const
Definition: spatial/inertia.hpp:37
pinocchio::InertiaTpl::setZero
void setZero()
Definition: spatial/inertia.hpp:337
pinocchio::InertiaTpl::lever
const Vector3 & lever() const
Definition: spatial/inertia.hpp:806
pinocchio::traits< InertiaTpl< T, U > >::ConstLinear_t
const typedef Vector3 ConstLinear_t
Definition: spatial/inertia.hpp:248
pinocchio::InertiaTpl::lever
Vector3 & lever()
Definition: spatial/inertia.hpp:819
pinocchio::InertiaTpl::variation
Matrix6 variation(const MotionDense< MotionDerived > &v) const
Definition: spatial/inertia.hpp:707
pinocchio::InertiaBase::vxi
static void vxi(const MotionDense< MotionDerived > &v, const Derived &I, const Eigen::MatrixBase< M6 > &Iout)
Time variation operator. It computes the time derivative of an inertia I corresponding to the formula...
Definition: spatial/inertia.hpp:145
pinocchio::isZero
bool isZero(const Eigen::MatrixBase< MatrixLike > &m, const typename MatrixLike::RealScalar &prec=Eigen::NumTraits< typename MatrixLike::Scalar >::dummy_precision())
Definition: math/matrix.hpp:59
y
y
pinocchio::InertiaBase::derived
const Derived & derived() const
Definition: spatial/inertia.hpp:27
pinocchio::InertiaTpl::__minus__
InertiaTpl __minus__(const InertiaTpl &Yb) const
Definition: spatial/inertia.hpp:632
c
Vec3f c
PINOCCHIO_EIGEN_CONST_CAST
#define PINOCCHIO_EIGEN_CONST_CAST(TYPE, OBJ)
Macro for an automatic const_cast.
Definition: eigen-macros.hpp:51
pinocchio::SE3Tpl
Definition: context/casadi.hpp:29
pinocchio::InertiaTpl::InertiaTpl
InertiaTpl(const Scalar &mass, const Vector3 &com, const Matrix3 &rotational_inertia)
Definition: spatial/inertia.hpp:280
pinocchio::InertiaBase::operator==
bool operator==(const Derived &other) const
Definition: spatial/inertia.hpp:90
pinocchio::InertiaTpl::InertiaTpl
InertiaTpl(const InertiaTpl &clone)
Definition: spatial/inertia.hpp:310
pinocchio::InertiaTpl::InertiaTpl
InertiaTpl(const InertiaTpl< S2, O2 > &clone)
Definition: spatial/inertia.hpp:326
setup.data
data
Definition: cmake/cython/setup.in.py:48
pinocchio::NumericalBase::Scalar
traits< Derived >::Scalar Scalar
Definition: fwd.hpp:91
pinocchio::InertiaBase::ivx
static void ivx(const MotionDense< MotionDerived > &v, const Derived &I, const Eigen::MatrixBase< M6 > &Iout)
Time variation operator. It computes the time derivative of an inertia I corresponding to the formula...
Definition: spatial/inertia.hpp:169
pinocchio::Symmetric3Tpl::isApprox
bool isApprox(const Symmetric3Tpl &other, const Scalar &prec=Eigen::NumTraits< Scalar >::dummy_precision()) const
Definition: spatial/symmetric3.hpp:146
pinocchio::InertiaTpl::ivx_impl
static void ivx_impl(const MotionDense< MotionDerived > &v, const InertiaTpl &I, const Eigen::MatrixBase< M6 > &Iout)
Definition: spatial/inertia.hpp:770
pinocchio::InertiaBase::operator=
Derived & operator=(const Derived &clone)
Definition: spatial/inertia.hpp:86
rotate
Vec3f rotate(Vec3f input, FCL_REAL w, Vec3f vec)
pinocchio::MotionDense
Definition: context/casadi.hpp:36
pinocchio::python::Scalar
context::Scalar Scalar
Definition: admm-solver.cpp:29
pinocchio::InertiaBase::matrix
void matrix(const Eigen::MatrixBase< Matrix6Like > &mat) const
Definition: spatial/inertia.hpp:63
pinocchio::InertiaTpl::vxiv
Force vxiv(const MotionDense< MotionDerived > &v) const
Definition: spatial/inertia.hpp:849
pinocchio::InertiaBase::matrix
Matrix6 matrix() const
Definition: spatial/inertia.hpp:67
pinocchio::res
ReturnType res
Definition: spatial/classic-acceleration.hpp:57
pinocchio::InertiaTpl::inverse_impl
void inverse_impl(const Eigen::MatrixBase< Matrix6Like > &M_) const
Definition: spatial/inertia.hpp:495
pinocchio::Symmetric3Tpl::setRandom
void setRandom()
Definition: spatial/symmetric3.hpp:105
motion.hpp
autodiff-rnea.f
f
Definition: autodiff-rnea.py:24
pinocchio::InertiaTpl::isZero_impl
bool isZero_impl(const Scalar &prec=Eigen::NumTraits< Scalar >::dummy_precision()) const
Definition: spatial/inertia.hpp:592
b
Vec3f b
pinocchio::Symmetric3Tpl::vtiv
Scalar vtiv(const Vector3 &v) const
Definition: spatial/symmetric3.hpp:323
pinocchio::InertiaTpl::isApprox_impl
bool isApprox_impl(const InertiaTpl &other, const Scalar &prec=Eigen::NumTraits< Scalar >::dummy_precision()) const
Definition: spatial/inertia.hpp:583
skew.hpp
height
FCL_REAL height() const
pinocchio::InertiaBase::operator+=
Derived & operator+=(const Derived &Yb)
Definition: spatial/inertia.hpp:99
pinocchio::InertiaBase::se3Action
Derived se3Action(const SE3Tpl< S2, O2 > &M) const
aI = aXb.act(bI)
Definition: spatial/inertia.hpp:210
pinocchio::InertiaTpl::Zero
static InertiaTpl Zero()
Definition: spatial/inertia.hpp:332
pinocchio::traits< InertiaTpl< T, U > >::Matrix3
Eigen::Matrix< T, 3, 3, U > Matrix3
Definition: spatial/inertia.hpp:241
pinocchio::InertiaBase::operator+
Derived operator+(const Derived &Yb) const
Definition: spatial/inertia.hpp:103
pinocchio::traits< InertiaTpl< T, U > >::ActionMatrix_t
Matrix6 ActionMatrix_t
Definition: spatial/inertia.hpp:244
pinocchio::InertiaBase::mass
Scalar & mass()
Definition: spatial/inertia.hpp:41
pinocchio::InertiaBase::se3ActionInverse
Derived se3ActionInverse(const SE3Tpl< S2, O2 > &M) const
bI = aXb.actInv(aI)
Definition: spatial/inertia.hpp:217
pinocchio::InertiaTpl::mass
Scalar & mass()
Definition: spatial/inertia.hpp:815
pinocchio::InertiaTpl::inertia
const Symmetric3 & inertia() const
Definition: spatial/inertia.hpp:810
pinocchio::InertiaTpl::m_inertia
Symmetric3 m_inertia
Definition: spatial/inertia.hpp:888
pinocchio::InertiaTpl::Options
@ Options
Definition: spatial/inertia.hpp:269
pinocchio::InertiaBase::operator!=
bool operator!=(const Derived &other) const
Definition: spatial/inertia.hpp:94
pinocchio::InertiaBase::derived
Derived & derived()
Definition: spatial/inertia.hpp:23
pinocchio::InertiaTpl::mass
Scalar mass() const
Definition: spatial/inertia.hpp:802
pinocchio::InertiaBase::lever
Vector3 & lever()
Definition: spatial/inertia.hpp:49
pinocchio::traits< InertiaTpl< T, U > >::Vector6
Eigen::Matrix< T, 6, 1, U > Vector6
Definition: spatial/inertia.hpp:240
pinocchio::InertiaTpl::setRandom
void setRandom()
Definition: spatial/inertia.hpp:467
pinocchio::InertiaTpl::inertia
Symmetric3 & inertia()
Definition: spatial/inertia.hpp:823
pinocchio::traits< InertiaTpl< T, U > >::Force
ForceTpl< T, U > Force
Definition: spatial/inertia.hpp:251
pinocchio::InertiaBase::variation
Matrix6 variation(const MotionDense< MotionDerived > &v) const
Definition: spatial/inertia.hpp:130
pinocchio::traits< InertiaTpl< T, U > >::SE3
SE3Tpl< T, U > SE3
Definition: spatial/inertia.hpp:250
pinocchio::skew
void skew(const Eigen::MatrixBase< Vector3 > &v, const Eigen::MatrixBase< Matrix3 > &M)
Computes the skew representation of a given 3d vector, i.e. the antisymmetric matrix representation o...
Definition: skew.hpp:22
pinocchio::InertiaBase::operator-=
Derived & operator-=(const Derived &Yb)
Definition: spatial/inertia.hpp:107
collision-with-point-clouds.X
X
Definition: collision-with-point-clouds.py:34
pinocchio::InertiaTpl::InertiaTpl
InertiaTpl()
Definition: spatial/inertia.hpp:276
symmetric3.hpp
pinocchio::InertiaBase::isApprox
bool isApprox(const Derived &other, const Scalar &prec=Eigen::NumTraits< Scalar >::dummy_precision()) const
Definition: spatial/inertia.hpp:196
mat
mat
pinocchio::Symmetric3Tpl::inverse
void inverse(const Eigen::MatrixBase< Matrix3Like > &res_) const
Definition: spatial/symmetric3.hpp:164
pinocchio::InertiaBase::disp
void disp(std::ostream &os) const
Definition: spatial/inertia.hpp:222
fwd.hpp
pinocchio::ForceTpl
Definition: context/casadi.hpp:25
pinocchio::InertiaTpl::InertiaTpl
InertiaTpl(const Matrix6 &I6)
Definition: spatial/inertia.hpp:287
pinocchio::traits< InertiaTpl< T, U > >::Symmetric3
Symmetric3Tpl< T, U > Symmetric3
Definition: spatial/inertia.hpp:253
pinocchio::InertiaTpl::FromCapsule
static InertiaTpl FromCapsule(const Scalar mass, const Scalar radius, const Scalar height)
Computes the Inertia of a capsule defined by its mass, radius and length along the Z axis....
Definition: spatial/inertia.hpp:434
x
x
pinocchio::InertiaBase::setIdentity
void setIdentity()
Definition: spatial/inertia.hpp:187
pinocchio::InertiaBase::inertia
Symmetric3 & inertia()
Definition: spatial/inertia.hpp:57
pinocchio::InertiaTpl::Random
static InertiaTpl Random()
Definition: spatial/inertia.hpp:356
pinocchio::InertiaBase::inertia
const Symmetric3 & inertia() const
Definition: spatial/inertia.hpp:53
pinocchio::InertiaTpl::__mult__
ForceTpl< typename traits< MotionDerived >::Scalar, traits< MotionDerived >::Options > __mult__(const MotionDense< MotionDerived > &v) const
Definition: spatial/inertia.hpp:676
M
M
pinocchio::InertiaTpl::__pequ__
InertiaTpl & __pequ__(const InertiaTpl &Yb)
Definition: spatial/inertia.hpp:616
pinocchio::context::Vector3
Eigen::Matrix< Scalar, 3, 1, Options > Vector3
Definition: context/generic.hpp:53
pinocchio::Symmetric3Tpl::isZero
bool isZero(const Scalar &prec=Eigen::NumTraits< Scalar >::dummy_precision()) const
Definition: spatial/symmetric3.hpp:153
pinocchio::traits< InertiaTpl< T, U > >::Vector3
Eigen::Matrix< T, 3, 1, U > Vector3
Definition: spatial/inertia.hpp:238
pinocchio::traits< InertiaTpl< T, U > >::Matrix6
Eigen::Matrix< T, 6, 6, U > Matrix6
Definition: spatial/inertia.hpp:243
pinocchio::InertiaBase::inverse
void inverse(const Eigen::MatrixBase< Matrix6Like > &mat) const
Definition: spatial/inertia.hpp:77
pinocchio::Symmetric3Tpl< context::Scalar, context::Options >::rhsMult
static void rhsMult(const Symmetric3Tpl &S3, const Eigen::MatrixBase< V3in > &vin, const Eigen::MatrixBase< V3out > &vout)
Definition: spatial/symmetric3.hpp:490
pinocchio::InertiaTpl::inverse_impl
Matrix6 inverse_impl() const
Definition: spatial/inertia.hpp:522
pinocchio::InertiaTpl::toDynamicParameters
Vector10 toDynamicParameters() const
Definition: spatial/inertia.hpp:536
pinocchio::InertiaBase::setZero
void setZero()
Definition: spatial/inertia.hpp:183
pinocchio::skewSquare
void skewSquare(const Eigen::MatrixBase< V1 > &u, const Eigen::MatrixBase< V2 > &v, const Eigen::MatrixBase< Matrix3 > &C)
Computes the square cross product linear operator C(u,v) such that for any vector w,...
Definition: skew.hpp:182
pinocchio::InertiaTpl::SPATIAL_TYPEDEF_TEMPLATE
EIGEN_MAKE_ALIGNED_OPERATOR_NEW SPATIAL_TYPEDEF_TEMPLATE(InertiaTpl)
pinocchio::Symmetric3Tpl::matrix
Matrix3 matrix() const
Definition: spatial/symmetric3.hpp:304
a
Vec3f a
pinocchio::InertiaTpl::disp_impl
void disp_impl(std::ostream &os) const
Definition: spatial/inertia.hpp:859
clone
virtual CollisionGeometry * clone() const=0
pinocchio::v
JointCollectionTpl const Eigen::MatrixBase< ConfigVectorType > const Eigen::MatrixBase< TangentVectorType > & v
Definition: joint-configuration.hpp:1118
pinocchio::InertiaTpl::__equl__
InertiaTpl & __equl__(const InertiaTpl &clone)
Definition: spatial/inertia.hpp:569
pinocchio::InertiaTpl::matrix_impl
void matrix_impl(const Eigen::MatrixBase< Matrix6Like > &M_) const
Definition: spatial/inertia.hpp:475
pinocchio::InertiaTpl::Vector10
Eigen::Matrix< Scalar, 10, 1, Options > Vector10
Definition: spatial/inertia.hpp:273
pinocchio::InertiaTpl::matrix_impl
Matrix6 matrix_impl() const
Definition: spatial/inertia.hpp:487
pinocchio::Symmetric3Tpl< context::Scalar, context::Options >
pinocchio::Force
ForceTpl< context::Scalar, context::Options > Force
Definition: spatial/fwd.hpp:64
pinocchio::InertiaBase::vxi
Matrix6 vxi(const MotionDense< MotionDerived > &v) const
Definition: spatial/inertia.hpp:152
pinocchio::InertiaBase::const_cast_derived
Derived & const_cast_derived() const
Definition: spatial/inertia.hpp:32
pinocchio::InertiaBase::isZero
bool isZero(const Scalar &prec=Eigen::NumTraits< Scalar >::dummy_precision()) const
Definition: spatial/inertia.hpp:203
ocp.U
U
Definition: ocp.py:61
pinocchio::InertiaTpl::FromDynamicParameters
static InertiaTpl FromDynamicParameters(const Eigen::MatrixBase< Vector10Like > &params)
Definition: spatial/inertia.hpp:556
pinocchio::InertiaTpl::Identity
static InertiaTpl Identity()
Definition: spatial/inertia.hpp:344
pinocchio::InertiaBase::vtiv
Scalar vtiv(const MotionDense< MotionDerived > &v) const
Definition: spatial/inertia.hpp:124
pinocchio::traits< InertiaTpl< T, U > >::Angular_t
Vector3 Angular_t
Definition: spatial/inertia.hpp:245
pinocchio::ForceDense
Definition: context/casadi.hpp:34
pinocchio::Symmetric3Tpl< context::Scalar, context::Options >::Identity
static Symmetric3Tpl Identity()
Definition: spatial/symmetric3.hpp:117
pinocchio::traits< InertiaTpl< T, U > >::Motion
MotionTpl< T, U > Motion
Definition: spatial/inertia.hpp:252
pinocchio::cross
void cross(const Eigen::MatrixBase< Vector3 > &v, const Eigen::MatrixBase< Matrix3xIn > &Min, const Eigen::MatrixBase< Matrix3xOut > &Mout)
Applies the cross product onto the columns of M.
Definition: skew.hpp:228
pinocchio::InertiaBase::operator<<
friend std::ostream & operator<<(std::ostream &os, const InertiaBase< Derived > &X)
Definition: spatial/inertia.hpp:226
pinocchio::InertiaTpl::AlphaSkewSquare
Symmetric3::AlphaSkewSquare AlphaSkewSquare
Definition: spatial/inertia.hpp:272
pinocchio::InertiaBase::SPATIAL_TYPEDEF_TEMPLATE
SPATIAL_TYPEDEF_TEMPLATE(Derived)
pinocchio::InertiaBase::ivx
Matrix6 ivx(const MotionDense< MotionDerived > &v) const
Definition: spatial/inertia.hpp:176
pinocchio::InertiaTpl::se3Action_impl
InertiaTpl se3Action_impl(const SE3Tpl< S2, O2 > &M) const
aI = aXb.act(bI)
Definition: spatial/inertia.hpp:830
dcrba.eps
int eps
Definition: dcrba.py:439
pinocchio::traits< InertiaTpl< T, U > >::Vector4
Eigen::Matrix< T, 4, 1, U > Vector4
Definition: spatial/inertia.hpp:239
pinocchio::InertiaTpl::FromBox
static InertiaTpl FromBox(const Scalar mass, const Scalar x, const Scalar y, const Scalar z)
Computes the Inertia of a box defined by its mass and main dimensions (x,y,z).
Definition: spatial/inertia.hpp:418
pinocchio::traits< InertiaTpl< T, U > >::Matrix4
Eigen::Matrix< T, 4, 4, U > Matrix4
Definition: spatial/inertia.hpp:242
pinocchio::traits< InertiaTpl< T, U > >::Linear_t
Vector3 Linear_t
Definition: spatial/inertia.hpp:246
pinocchio::traits
Common traits structure to fully define base classes for CRTP.
Definition: fwd.hpp:71
pinocchio::Symmetric3Tpl::setIdentity
void setIdentity()
Definition: spatial/symmetric3.hpp:121
pinocchio::InertiaTpl::FromSphere
static InertiaTpl FromSphere(const Scalar mass, const Scalar radius)
Computes the Inertia of a sphere defined by its mass and its radius.
Definition: spatial/inertia.hpp:369
pinocchio::InertiaTpl::InertiaTpl
InertiaTpl(const Scalar &mass, const Vector3 &com, const Symmetric3 &rotational_inertia)
Definition: spatial/inertia.hpp:303
PINOCCHIO_ASSERT_MATRIX_SPECIFIC_SIZE
#define PINOCCHIO_ASSERT_MATRIX_SPECIFIC_SIZE(type, M, nrows, ncols)
Ensure that a matrix (or vector) is of correct size (compile-time and run-time assertion)
Definition: include/pinocchio/macros.hpp:70
pinocchio::Symmetric3Tpl< context::Scalar, context::Options >::Zero
static Symmetric3Tpl Zero()
Definition: spatial/symmetric3.hpp:92
pinocchio::traits< InertiaTpl< T, U > >::Quaternion_t
Eigen::Quaternion< T, U > Quaternion_t
Definition: spatial/inertia.hpp:249
pinocchio::alphaSkew
void alphaSkew(const Scalar alpha, const Eigen::MatrixBase< Vector3 > &v, const Eigen::MatrixBase< Matrix3 > &M)
Computes the skew representation of a given 3d vector multiplied by a given scalar....
Definition: skew.hpp:134
pinocchio.utils.rand
def rand(n)
Definition: bindings/python/pinocchio/utils.py:42
pinocchio::MotionTpl
Definition: context/casadi.hpp:27
pinocchio::Symmetric3Tpl< context::Scalar, context::Options >::RandomPositive
static Symmetric3Tpl RandomPositive()
Definition: spatial/symmetric3.hpp:291
pinocchio::Symmetric3Tpl::setZero
void setZero()
Definition: spatial/symmetric3.hpp:96
pinocchio::InertiaBase::lever
const Vector3 & lever() const
Definition: spatial/inertia.hpp:45
pinocchio::InertiaBase
Definition: spatial/inertia.hpp:19
pinocchio::InertiaTpl::__mult__
void __mult__(const MotionDense< MotionDerived > &v, ForceDense< ForceDerived > &f) const
Definition: spatial/inertia.hpp:686
pinocchio::InertiaBase::operator*
ForceTpl< typename traits< MotionDerived >::Scalar, traits< MotionDerived >::Options > operator*(const MotionDense< MotionDerived > &v) const
Definition: spatial/inertia.hpp:118
pinocchio::unSkew
void unSkew(const Eigen::MatrixBase< Matrix3 > &M, const Eigen::MatrixBase< Vector3 > &v)
Inverse of skew operator. From a given skew-symmetric matrix M of dimension 3x3, it extracts the supp...
Definition: skew.hpp:93
force.hpp
pinocchio::InertiaTpl::se3ActionInverse_impl
InertiaTpl se3ActionInverse_impl(const SE3Tpl< S2, O2 > &M) const
bI = aXb.actInv(aI)
Definition: spatial/inertia.hpp:841
pinocchio::InertiaTpl::FromCylinder
static InertiaTpl FromCylinder(const Scalar mass, const Scalar radius, const Scalar length)
Computes the Inertia of a cylinder defined by its mass, radius and length along the Z axis.
Definition: spatial/inertia.hpp:401
pinocchio::InertiaTpl::operator=
InertiaTpl & operator=(const InertiaTpl &clone)
Definition: spatial/inertia.hpp:317
pinocchio::InertiaTpl::vtiv_impl
Scalar vtiv_impl(const MotionDense< MotionDerived > &v) const
Definition: spatial/inertia.hpp:695
CppAD::max
AD< Scalar > max(const AD< Scalar > &x, const AD< Scalar > &y)
Definition: autodiff/cppad.hpp:180
length
FCL_REAL length[2]
pinocchio::InertiaTpl::setIdentity
void setIdentity()
Definition: spatial/inertia.hpp:349
pinocchio::InertiaTpl::m_mass
Scalar m_mass
Definition: spatial/inertia.hpp:886
robot-wrapper-viewer.com
com
Definition: robot-wrapper-viewer.py:45
radius
FCL_REAL radius
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:27
pinocchio::InertiaTpl::cast
InertiaTpl< NewScalar, Options > cast() const
Definition: spatial/inertia.hpp:869


pinocchio
Author(s):
autogenerated on Sat Jun 1 2024 02:40:35