spatial.cpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2015-2020 CNRS INRIA
3 //
4 
5 #include <iostream>
6 
7 #include "pinocchio/spatial/force.hpp"
8 #include "pinocchio/spatial/motion.hpp"
9 #include "pinocchio/spatial/se3.hpp"
10 #include "pinocchio/spatial/inertia.hpp"
11 #include "pinocchio/spatial/act-on-set.hpp"
12 #include "pinocchio/spatial/explog.hpp"
13 #include "pinocchio/spatial/skew.hpp"
14 #include "pinocchio/spatial/cartesian-axis.hpp"
15 #include "pinocchio/spatial/spatial-axis.hpp"
16 
17 #include <boost/test/unit_test.hpp>
18 #include <boost/utility/binary.hpp>
19 
20 BOOST_AUTO_TEST_SUITE ( BOOST_TEST_MODULE )
21 
23 {
24  using namespace pinocchio;
25  typedef SE3::HomogeneousMatrixType HomogeneousMatrixType;
26  typedef SE3::ActionMatrixType ActionMatrixType;
27  typedef SE3::Vector3 Vector3;
28  typedef Eigen::Matrix<double,4,1> Vector4;
29 
30  const SE3 identity = SE3::Identity();
31 
32  typedef SE3::Quaternion Quaternion;
33  typedef SE3::Vector4 Vector4;
34  Quaternion quat(Vector4::Random().normalized());
35 
36  SE3 m_from_quat(quat,Vector3::Random());
37 
38  SE3 amb = SE3::Random();
39  SE3 bmc = SE3::Random();
40  SE3 amc = amb*bmc;
41 
42  HomogeneousMatrixType aMb = amb;
43  HomogeneousMatrixType bMc = bmc;
44 
45  // Test internal product
46  HomogeneousMatrixType aMc = amc;
47  BOOST_CHECK(aMc.isApprox(aMb*bMc));
48 
49  HomogeneousMatrixType bMa = amb.inverse();
50  BOOST_CHECK(bMa.isApprox(aMb.inverse()));
51 
52  // Test point action
53  Vector3 p = Vector3::Random();
54  Vector4 p4; p4.head(3) = p; p4[3] = 1;
55 
56  Vector3 Mp = (aMb*p4).head(3);
57  BOOST_CHECK(amb.act(p).isApprox(Mp));
58 
59  Vector3 Mip = (aMb.inverse()*p4).head(3);
60  BOOST_CHECK(amb.actInv(p).isApprox(Mip));
61 
62  // Test action matrix
63  ActionMatrixType aXb = amb;
64  ActionMatrixType bXc = bmc;
65  ActionMatrixType aXc = amc;
66  BOOST_CHECK(aXc.isApprox(aXb*bXc));
67 
68  ActionMatrixType bXa = amb.inverse();
69  BOOST_CHECK(bXa.isApprox(aXb.inverse()));
70 
71  ActionMatrixType X_identity = identity.toActionMatrix();
72  BOOST_CHECK(X_identity.isIdentity());
73 
74  ActionMatrixType X_identity_inverse = identity.toActionMatrixInverse();
75  BOOST_CHECK(X_identity_inverse.isIdentity());
76 
77  // Test dual action matrix
78  BOOST_CHECK(aXb.inverse().transpose().isApprox(amb.toDualActionMatrix()));
79 
80  // Test isIdentity
81  BOOST_CHECK(identity.isIdentity());
82 
83  // Test isApprox
84  BOOST_CHECK(identity.isApprox(identity));
85 
86  // Test cast
87  typedef SE3Tpl<float> SE3f;
88  SE3f::Matrix3 rot_float(amb.rotation().cast<float>());
89  SE3f amb_float = amb.cast<float>();
90  BOOST_CHECK(amb_float.isApprox(amb.cast<float>()));
91 
92  // Test actInv
93  const SE3 M = SE3::Random();
94  const SE3 Minv = M.inverse();
95 
96  BOOST_CHECK(Minv.actInv(Minv).isIdentity());
97  BOOST_CHECK(M.actInv(identity).isApprox(Minv));
98 
99  // Test normalization
100  {
101  const double prec = Eigen::NumTraits<double>::dummy_precision();
102  SE3 M(SE3::Random());
103  M.rotation() += prec * SE3::Matrix3::Random();
104  BOOST_CHECK(!M.isNormalized());
105 
106  SE3 M_normalized = M.normalized();
107  BOOST_CHECK(M_normalized.isNormalized());
108 
109  M.normalize();
110  BOOST_CHECK(M.isNormalized());
111  }
112 
113 }
114 
115 BOOST_AUTO_TEST_CASE ( test_Motion )
116 {
117  using namespace pinocchio;
118  typedef SE3::ActionMatrixType ActionMatrixType;
119  typedef Motion::Vector6 Vector6;
120 
121  SE3 amb = SE3::Random();
122  SE3 bmc = SE3::Random();
123  SE3 amc = amb*bmc;
124 
125  Motion bv = Motion::Random();
126  Motion bv2 = Motion::Random();
127 
128  typedef MotionBase<Motion> Base;
129 
130  Vector6 bv_vec = bv;
131  Vector6 bv2_vec = bv2;
132 
133  // std::stringstream
134  std::stringstream ss;
135  ss << bv << std::endl;
136  BOOST_CHECK(!ss.str().empty());
137 
138  // Test .+.
139  Vector6 bvPbv2_vec = bv+bv2;
140  BOOST_CHECK(bvPbv2_vec.isApprox(bv_vec+bv2_vec));
141 
142  Motion bplus = static_cast<Base &>(bv) + static_cast<Base &>(bv2);
143  BOOST_CHECK((bv+bv2).isApprox(bplus));
144 
145  Motion v_not_zero(Vector6::Ones());
146  BOOST_CHECK(!v_not_zero.isZero());
147 
148  Motion v_zero(Vector6::Zero());
149  BOOST_CHECK(v_zero.isZero());
150 
151  // Test == and !=
152  BOOST_CHECK(bv == bv);
153  BOOST_CHECK(!(bv != bv));
154 
155  // Test -.
156  Vector6 Mbv_vec = -bv;
157  BOOST_CHECK( Mbv_vec.isApprox(-bv_vec));
158 
159  // Test .+=.
160  Motion bv3 = bv; bv3 += bv2;
161  BOOST_CHECK( bv3.toVector().isApprox(bv_vec+bv2_vec));
162 
163  // Test .=V6
164  bv3 = bv2_vec;
165  BOOST_CHECK( bv3.toVector().isApprox(bv2_vec));
166 
167  // Test scalar*M6
168  Motion twicebv(2.*bv);
169  BOOST_CHECK(twicebv.isApprox(Motion(2.*bv.toVector())));
170 
171  // Test M6*scalar
172  Motion bvtwice(bv*2.);
173  BOOST_CHECK(bvtwice.isApprox(twicebv));
174 
175  // Test M6/scalar
176  Motion bvdividedbytwo(bvtwice/2.);
177  BOOST_CHECK(bvdividedbytwo.isApprox(bv));
178 
179  // Test constructor from V6
180  Motion bv4(bv2_vec);
181  BOOST_CHECK( bv4.toVector().isApprox(bv2_vec));
182 
183  // Test action
184  ActionMatrixType aXb = amb;
185  BOOST_CHECK(amb.act(bv).toVector().isApprox(aXb*bv_vec));
186 
187  // Test action inverse
188  ActionMatrixType bXc = bmc;
189  BOOST_CHECK(bmc.actInv(bv).toVector().isApprox(bXc.inverse()*bv_vec));
190 
191  // Test double action
192  Motion cv = Motion::Random();
193  bv = bmc.act(cv);
194  BOOST_CHECK(amb.act(bv).toVector().isApprox(amc.act(cv).toVector()));
195 
196  // Simple test for cross product vxv
197  Motion vxv = bv.cross(bv);
198  BOOST_CHECK_SMALL(vxv.toVector().tail(3).norm(), 1e-3); //previously ensure that (vxv.toVector().tail(3).isMuchSmallerThan(1e-3));
199 
200  // Test Action Matrix
201  Motion v2xv = bv2.cross(bv);
202  Motion::ActionMatrixType actv2 = bv2.toActionMatrix();
203 
204  BOOST_CHECK(v2xv.toVector().isApprox(actv2*bv.toVector()));
205 
206  // Test Dual Action Matrix
207  Force f(bv.toVector());
208  Force v2xf = bv2.cross(f);
209  Motion::ActionMatrixType dualactv2 = bv2.toDualActionMatrix();
210 
211  BOOST_CHECK(v2xf.toVector().isApprox(dualactv2*f.toVector()));
212  BOOST_CHECK(dualactv2.isApprox(-actv2.transpose()));
213 
214  // Simple test for cross product vxf
215  Force vxf = bv.cross(f);
216  BOOST_CHECK(vxf.linear().isApprox(bv.angular().cross(f.linear())));
217  BOOST_CHECK_SMALL(vxf.angular().norm(), 1e-3);//previously ensure that ( vxf.angular().isMuchSmallerThan(1e-3));
218 
219  // Test frame change for vxf
220  Motion av = Motion::Random();
221  Force af = Force::Random();
222  bv = amb.actInv(av);
223  Force bf = amb.actInv(af);
224  Force avxf = av.cross(af);
225  Force bvxf = bv.cross(bf);
226  BOOST_CHECK(avxf.toVector().isApprox(amb.act(bvxf).toVector()));
227 
228  // Test frame change for vxv
229  av = Motion::Random();
230  Motion aw = Motion::Random();
231  bv = amb.actInv(av);
232  Motion bw = amb.actInv(aw);
233  Motion avxw = av.cross(aw);
234  Motion bvxw = bv.cross(bw);
235  BOOST_CHECK(avxw.toVector().isApprox(amb.act(bvxw).toVector()));
236 
237  // Test isApprox
238  bv.toVector().setOnes();
239  const double eps = 1e-6;
240  BOOST_CHECK(bv == bv);
241  BOOST_CHECK(bv.isApprox(bv));
242  Motion bv_approx(bv);
243  bv_approx.linear()[0] += eps;
244  BOOST_CHECK(bv_approx.isApprox(bv,eps));
245 
246  // Test ref() method
247  {
249  BOOST_CHECK(a.ref().isApprox(a));
250 
251  const Motion b(a);
252  BOOST_CHECK(b.isApprox(a.ref()));
253  }
254 
255  // Test cast
256  {
257  typedef MotionTpl<float> Motionf;
259  Motionf a_float = a.cast<float>();
260  BOOST_CHECK(a_float.isApprox(a.cast<float>()));
261  }
262 }
263 
264 BOOST_AUTO_TEST_CASE (test_motion_ref)
265 {
266  using namespace pinocchio;
267  typedef Motion::Vector6 Vector6;
268 
269  typedef MotionRef<Vector6> MotionV6;
270 
271  Motion v_ref(Motion::Random());
272  MotionV6 v(v_ref.toVector());
273 
274  BOOST_CHECK(v_ref.isApprox(v));
275 
276  MotionV6::MotionPlain v2(v*2.);
277  Motion v2_ref(v_ref*2.);
278 
279  BOOST_CHECK(v2_ref.isApprox(v2));
280 
281  v2 = v_ref + v;
282  BOOST_CHECK(v2_ref.isApprox(v2));
283 
284  v = v2;
285  BOOST_CHECK(v2.isApprox(v));
286 
287  v2 = v - v;
288  BOOST_CHECK(v2.isApprox(Motion::Zero()));
289 
290  SE3 M(SE3::Identity());
291  v2 = M.act(v);
292  BOOST_CHECK(v2.isApprox(v));
293 
294  v2 = M.actInv(v);
295  BOOST_CHECK(v2.isApprox(v));
296 
297  Motion v3(Motion::Random());
298  v_ref.setRandom();
299  v = v_ref;
300  v2 = v.cross(v3);
301  v2_ref = v_ref.cross(v3);
302 
303  BOOST_CHECK(v2.isApprox(v2_ref));
304 
305  v.setRandom();
306  v.setZero();
307  BOOST_CHECK(v.isApprox(Motion::Zero()));
308 
309  // Test ref() method
310  {
311  Vector6 v6(Vector6::Random());
312  MotionV6 a(v6);
313  BOOST_CHECK(a.ref().isApprox(a));
314 
315  const Motion b(a);
316  BOOST_CHECK(b.isApprox(a.ref()));
317  }
318 
319 }
320 
321 BOOST_AUTO_TEST_CASE(test_motion_zero)
322 {
323  using namespace pinocchio;
324  Motion v((MotionZero()));
325 
326  BOOST_CHECK(v.toVector().isZero());
327  BOOST_CHECK(MotionZero() == Motion::Zero());
328 
329  // SE3.act
330  SE3 m(SE3::Random());
331  BOOST_CHECK(m.act(MotionZero()) == Motion::Zero());
332  BOOST_CHECK(m.actInv(MotionZero()) == Motion::Zero());
333 
334  // Motion.cross
335  Motion v2(Motion::Random());
336  BOOST_CHECK(v2.cross(MotionZero()) == Motion::Zero());
337 }
338 
339 BOOST_AUTO_TEST_CASE ( test_Force )
340 {
341  using namespace pinocchio;
342  typedef SE3::ActionMatrixType ActionMatrixType;
343  typedef Force::Vector6 Vector6;
344 
345  SE3 amb = SE3::Random();
346  SE3 bmc = SE3::Random();
347  SE3 amc = amb*bmc;
348 
349  Force bf = Force::Random();
350  Force bf2 = Force::Random();
351 
352  Vector6 bf_vec = bf;
353  Vector6 bf2_vec = bf2;
354 
355  // std::stringstream
356  std::stringstream ss;
357  ss << bf << std::endl;
358  BOOST_CHECK(!ss.str().empty());
359 
360  // Test .+.
361  Vector6 bfPbf2_vec = bf+bf2;
362  BOOST_CHECK(bfPbf2_vec.isApprox(bf_vec+bf2_vec));
363 
364  // Test -.
365  Vector6 Mbf_vec = -bf;
366  BOOST_CHECK(Mbf_vec.isApprox(-bf_vec));
367 
368  // Test .+=.
369  Force bf3 = bf; bf3 += bf2;
370  BOOST_CHECK(bf3.toVector().isApprox(bf_vec+bf2_vec));
371 
372  // Test .= V6
373  bf3 = bf2_vec;
374  BOOST_CHECK(bf3.toVector().isApprox(bf2_vec));
375 
376  // Test constructor from V6
377  Force bf4(bf2_vec);
378  BOOST_CHECK(bf4.toVector().isApprox(bf2_vec));
379 
380  // Test action
381  ActionMatrixType aXb = amb;
382  BOOST_CHECK(amb.act(bf).toVector().isApprox(aXb.inverse().transpose()*bf_vec));
383 
384  // Test action inverse
385  ActionMatrixType bXc = bmc;
386  BOOST_CHECK(bmc.actInv(bf).toVector().isApprox(bXc.transpose()*bf_vec));
387 
388  // Test double action
389  Force cf = Force::Random();
390  bf = bmc.act(cf);
391  BOOST_CHECK(amb.act(bf).toVector().isApprox(amc.act(cf).toVector()));
392 
393  // Simple test for cross product
394  // Force vxv = bf.cross(bf);
395  // ensure that (vxv.toVector().isMuchSmallerThan(bf.toVector()));
396 
397  Force f_not_zero(Vector6::Ones());
398  BOOST_CHECK(!f_not_zero.isZero());
399 
400  Force f_zero(Vector6::Zero());
401  BOOST_CHECK(f_zero.isZero());
402 
403  // Test isApprox
404 
405  BOOST_CHECK(bf == bf);
406  bf.setRandom();
407  bf2.setZero();
408  BOOST_CHECK(bf == bf);
409  BOOST_CHECK(bf != bf2);
410  BOOST_CHECK(bf.isApprox(bf));
411  BOOST_CHECK(!bf.isApprox(bf2));
412 
413  const double eps = 1e-6;
414  Force bf_approx(bf);
415  bf_approx.linear()[0] += 2.*eps;
416  BOOST_CHECK(!bf_approx.isApprox(bf,eps));
417 
418  // Test ref() method
419  {
420  Force a(Force::Random());
421  BOOST_CHECK(a.ref().isApprox(a));
422 
423  const Force b(a);
424  BOOST_CHECK(b.isApprox(a.ref()));
425  }
426 
427  // Test cast
428  {
429  typedef ForceTpl<float> Forcef;
430  Force a(Force::Random());
431  Forcef a_float = a.cast<float>();
432  BOOST_CHECK(a_float.isApprox(a.cast<float>()));
433  }
434 
435  // Test scalar multiplication
436  const double alpha = 1.5;
437  Force b(Force::Random());
438  Force alpha_f = alpha * b;
439  Force f_alpha = b * alpha;
440 
441  BOOST_CHECK(alpha_f == f_alpha);
442 }
443 
444 BOOST_AUTO_TEST_CASE (test_force_ref)
445 {
446  using namespace pinocchio;
447  typedef Force::Vector6 Vector6;
448 
449  typedef ForceRef<Vector6> ForceV6;
450 
451  Force f_ref(Force::Random());
452  ForceV6 f(f_ref.toVector());
453 
454  BOOST_CHECK(f_ref.isApprox(f));
455 
456  ForceV6::ForcePlain f2(f*2.);
457  Force f2_ref(f_ref*2.);
458 
459  BOOST_CHECK(f2_ref.isApprox(f2));
460 
461  f2 = f_ref + f;
462  BOOST_CHECK(f2_ref.isApprox(f2));
463 
464  f = f2;
465  BOOST_CHECK(f2.isApprox(f));
466 
467  f2 = f - f;
468  BOOST_CHECK(f2.isApprox(Force::Zero()));
469 
470  SE3 M(SE3::Identity());
471  f2 = M.act(f);
472  BOOST_CHECK(f2.isApprox(f));
473 
474  f2 = M.actInv(f);
475  BOOST_CHECK(f2.isApprox(f));
476 
478  f_ref.setRandom();
479  f = f_ref;
480  f2 = v.cross(f);
481  f2_ref = v.cross(f_ref);
482 
483  BOOST_CHECK(f2.isApprox(f2_ref));
484 
485  f.setRandom();
486  f.setZero();
487  BOOST_CHECK(f.isApprox(Force::Zero()));
488 
489  // Test ref() method
490  {
491  Vector6 v6(Vector6::Random());
492  ForceV6 a(v6);
493  BOOST_CHECK(a.ref().isApprox(a));
494 
495  const Force b(a);
496  BOOST_CHECK(b.isApprox(a.ref()));
497  }
498 }
499 
500 BOOST_AUTO_TEST_CASE ( test_Inertia )
501 {
502  using namespace pinocchio;
503  typedef Inertia::Matrix6 Matrix6;
504 
505  Inertia aI = Inertia::Random();
506  Matrix6 matI = aI;
507  BOOST_CHECK_EQUAL(matI(0,0), aI.mass());
508  BOOST_CHECK_EQUAL(matI(1,1), aI.mass());
509  BOOST_CHECK_EQUAL(matI(2,2), aI.mass()); // 1,1 before unifying
510 
511  BOOST_CHECK_SMALL((matI-matI.transpose()).norm(),matI.norm()); //previously ensure that( (matI-matI.transpose()).isMuchSmallerThan(matI) );
512  BOOST_CHECK_SMALL((matI.topRightCorner<3,3>()*aI.lever()).norm(),
513  aI.lever().norm()); //previously ensure that( (matI.topRightCorner<3,3>()*aI.lever()).isMuchSmallerThan(aI.lever()) );
514 
515  Inertia I1 = Inertia::Identity();
516  BOOST_CHECK(I1.matrix().isApprox(Matrix6::Identity()));
517 
518  // Test motion-to-force map
519  Motion v = Motion::Random();
520  Force f = I1 * v;
521  BOOST_CHECK(f.toVector().isApprox(v.toVector()));
522 
523  // Test Inertia group application
524  SE3 bma = SE3::Random();
525  Inertia bI = bma.act(aI);
526  Matrix6 bXa = bma;
527  BOOST_CHECK((bma.rotation()*aI.inertia().matrix()*bma.rotation().transpose())
528  .isApprox(bI.inertia().matrix()));
529  BOOST_CHECK((bXa.transpose().inverse() * aI.matrix() * bXa.inverse())
530  .isApprox(bI.matrix()));
531 
532  // Test inverse action
533  BOOST_CHECK((bXa.transpose() * bI.matrix() * bXa)
534  .isApprox(bma.actInv(bI).matrix()));
535 
536  // Test vxIv cross product
537  v = Motion::Random();
538  f = aI*v;
539  Force vxf = v.cross(f);
540  Force vxIv = aI.vxiv(v);
541  BOOST_CHECK(vxf.toVector().isApprox(vxIv.toVector()));
542 
543  // Test operator+
544  I1 = Inertia::Random();
545  Inertia I2 = Inertia::Random();
546  BOOST_CHECK((I1.matrix()+I2.matrix()).isApprox((I1+I2).matrix()));
547 
548  // operator +=
549  Inertia I12 = I1;
550  I12 += I2;
551  BOOST_CHECK((I1.matrix()+I2.matrix()).isApprox(I12.matrix()));
552 
553  // Test operator vtiv
554  double kinetic_ref = v.toVector().transpose() * aI.matrix() * v.toVector();
555  double kinetic = aI.vtiv(v);
556  BOOST_CHECK_SMALL(kinetic_ref - kinetic, 1e-12);
557 
558  // Test constructor (Matrix6)
559  Inertia I1_bis(I1.matrix());
560  BOOST_CHECK(I1.matrix().isApprox(I1_bis.matrix()));
561 
562  // Test Inertia from ellipsoid
563  const double sphere_mass = 5.;
564  const double sphere_radius = 2.;
565  I1 = Inertia::FromSphere(sphere_mass, sphere_radius);
566  const double L_sphere = 2./5. * sphere_mass * sphere_radius * sphere_radius;
567  BOOST_CHECK_SMALL(I1.mass() - sphere_mass, 1e-12);
568  BOOST_CHECK(I1.lever().isZero());
569  BOOST_CHECK(I1.inertia().matrix().isApprox(Symmetric3(L_sphere, 0., L_sphere , 0., 0., L_sphere).matrix()));
570 
571  // Test Inertia from ellipsoid
572  I1 = Inertia::FromEllipsoid(2., 3., 4., 5.);
573  BOOST_CHECK_SMALL(I1.mass() - 2, 1e-12);
574  BOOST_CHECK_SMALL(I1.lever().norm(), 1e-12);
575  BOOST_CHECK(I1.inertia().matrix().isApprox(Symmetric3(
576  16.4, 0., 13.6, 0., 0., 10.).matrix()));
577 
578  // Test Inertia from Cylinder
579  I1 = Inertia::FromCylinder(2., 4., 6.);
580  BOOST_CHECK_SMALL(I1.mass() - 2, 1e-12);
581  BOOST_CHECK_SMALL(I1.lever().norm(), 1e-12);
582  BOOST_CHECK(I1.inertia().matrix().isApprox(Symmetric3(
583  14., 0., 14., 0., 0., 16.).matrix()));
584 
585  // Test Inertia from Box
586  I1 = Inertia::FromBox(2., 6., 12., 18.);
587  BOOST_CHECK_SMALL(I1.mass() - 2, 1e-12);
588  BOOST_CHECK_SMALL(I1.lever().norm(), 1e-12);
589  BOOST_CHECK(I1.inertia().matrix().isApprox(Symmetric3(
590  78., 0., 60., 0., 0., 30.).matrix()));
591 
592  // Copy operator
593  Inertia aI_copy(aI);
594  BOOST_CHECK(aI_copy == aI);
595 
596  // Test isZero
597  Inertia I_not_zero = Inertia::Identity();
598  BOOST_CHECK(!I_not_zero.isZero());
599 
600  Inertia I_zero = Inertia::Zero();
601  BOOST_CHECK(I_zero.isZero());
602 
603  // Test isApprox
604  const double eps = 1e-6;
605  BOOST_CHECK(aI == aI);
606  BOOST_CHECK(aI.isApprox(aI));
607  Inertia aI_approx(aI);
608  aI_approx.mass() += eps/2.;
609  BOOST_CHECK(aI_approx.isApprox(aI,eps));
610 
611  // Test Variation
612  Inertia::Matrix6 aIvariation = aI.variation(v);
613 
614  Motion::ActionMatrixType vAction = v.toActionMatrix();
615  Motion::ActionMatrixType vDualAction = v.toDualActionMatrix();
616 
617  Inertia::Matrix6 aImatrix = aI.matrix();
618  Inertia::Matrix6 aIvariation_ref = vDualAction * aImatrix - aImatrix * vAction;
619 
620  BOOST_CHECK(aIvariation.isApprox(aIvariation_ref));
621  BOOST_CHECK(vxIv.isApprox(Force(aIvariation*v.toVector())));
622 
623  // Test vxI operator
624  {
625  typedef Inertia::Matrix6 Matrix6;
628 
629  const Matrix6 M_ref(v.toDualActionMatrix()*I.matrix());
630  Matrix6 M; Inertia::vxi(v,I,M);
631 
632  BOOST_CHECK(M.isApprox(M_ref));
633  BOOST_CHECK(I.vxi(v).isApprox(M_ref));
634  }
635 
636  // Test Ivx operator
637  {
638  typedef Inertia::Matrix6 Matrix6;
641 
642  const Matrix6 M_ref(I.matrix()*v.toActionMatrix());
643  Matrix6 M; Inertia::ivx(v,I,M);
644 
645  BOOST_CHECK(M.isApprox(M_ref));
646  BOOST_CHECK(I.ivx(v).isApprox(M_ref));
647  }
648 
649  // Test variation against vxI - Ivx operator
650  {
651  typedef Inertia::Matrix6 Matrix6;
654 
655  Matrix6 Ivariation = I.variation(v);
656 
657  Matrix6 M1; Inertia::vxi(v,I,M1);
658  Matrix6 M2; Inertia::ivx(v,I,M2);
659  Matrix6 M3(M1-M2);
660 
661  BOOST_CHECK(M3.isApprox(Ivariation));
662  }
663 
664  // Test dynamic parameters
665  {
667 
669 
670  BOOST_CHECK_CLOSE(v[0], I.mass(), 1e-12);
671 
672  BOOST_CHECK(v.segment<3>(1).isApprox(I.mass()*I.lever()));
673 
674  Eigen::Matrix3d I_o = I.inertia() + I.mass()*skew(I.lever()).transpose()*skew(I.lever());
675  Eigen::Matrix3d I_ov;
676  I_ov << v[4], v[5], v[7],
677  v[5], v[6], v[8],
678  v[7], v[8], v[9];
679 
680  BOOST_CHECK(I_o.isApprox(I_ov));
681 
683  BOOST_CHECK(I2.isApprox(I));
684 
685  }
686 
687  // Test disp
688  std::cout << aI << std::endl;
689 
690 }
691 
692 BOOST_AUTO_TEST_CASE(cast_inertia)
693 {
694  using namespace pinocchio;
696 
697  BOOST_CHECK(Y.cast<double>() == Y);
698  BOOST_CHECK(Y.cast<long double>().cast<double>() == Y);
699 }
700 
701 BOOST_AUTO_TEST_CASE ( test_ActOnSet )
702 {
703  using namespace pinocchio;
704  const int N = 20;
705  typedef Eigen::Matrix<double,6,N> Matrix6N;
706  SE3 jMi = SE3::Random();
707  Motion v = Motion::Random();
708 
709  // Forcet SET
710  Matrix6N iF = Matrix6N::Random(),jF,jFinv,jF_ref,jFinv_ref;
711 
712  // forceSet::se3Action
713  forceSet::se3Action(jMi,iF,jF);
714  for( int k=0;k<N;++k )
715  BOOST_CHECK(jMi.act(Force(iF.col(k))).toVector().isApprox(jF.col(k)));
716 
717  jF_ref = jMi.toDualActionMatrix()*iF;
718  BOOST_CHECK(jF_ref.isApprox(jF));
719 
720  forceSet::se3ActionInverse(jMi.inverse(),iF,jFinv);
721  BOOST_CHECK(jFinv.isApprox(jF));
722 
723  Matrix6N iF2 = Matrix6N::Random();
724  jF_ref += jMi.toDualActionMatrix() * iF2;
725 
726  forceSet::se3Action<ADDTO>(jMi,iF2,jF);
727  BOOST_CHECK(jF.isApprox(jF_ref));
728 
729  Matrix6N iF3 = Matrix6N::Random();
730  jF_ref -= jMi.toDualActionMatrix() * iF3;
731 
732  forceSet::se3Action<RMTO>(jMi,iF3,jF);
733  BOOST_CHECK(jF.isApprox(jF_ref));
734 
735  // forceSet::se3ActionInverse
736  forceSet::se3ActionInverse(jMi,iF,jFinv);
737  jFinv_ref = jMi.inverse().toDualActionMatrix() * iF;
738  BOOST_CHECK(jFinv_ref.isApprox(jFinv));
739 
740  jFinv_ref += jMi.inverse().toDualActionMatrix() * iF2;
741  forceSet::se3ActionInverse<ADDTO>(jMi,iF2,jFinv);
742  BOOST_CHECK(jFinv.isApprox(jFinv_ref));
743 
744  jFinv_ref -= jMi.inverse().toDualActionMatrix() * iF3;
745  forceSet::se3ActionInverse<RMTO>(jMi,iF3,jFinv);
746  BOOST_CHECK(jFinv.isApprox(jFinv_ref));
747 
748  // forceSet::motionAction
749  forceSet::motionAction(v,iF,jF);
750  for( int k=0;k<N;++k )
751  BOOST_CHECK(v.cross(Force(iF.col(k))).toVector().isApprox(jF.col(k)));
752 
753  jF_ref = v.toDualActionMatrix() * iF;
754  BOOST_CHECK(jF.isApprox(jF_ref));
755 
756  jF_ref += v.toDualActionMatrix() * iF2;
757  forceSet::motionAction<ADDTO>(v,iF2,jF);
758  BOOST_CHECK(jF.isApprox(jF_ref));
759 
760  jF_ref -= v.toDualActionMatrix() * iF3;
761  forceSet::motionAction<RMTO>(v,iF3,jF);
762  BOOST_CHECK(jF.isApprox(jF_ref));
763 
764  // Motion SET
765  Matrix6N iV = Matrix6N::Random(),jV,jV_ref,jVinv,jVinv_ref;
766 
767  // motionSet::se3Action
768  motionSet::se3Action(jMi,iV,jV);
769  for( int k=0;k<N;++k )
770  BOOST_CHECK(jMi.act(Motion(iV.col(k))).toVector().isApprox(jV.col(k)));
771 
772  jV_ref = jMi.toActionMatrix()*iV;
773  BOOST_CHECK(jV.isApprox(jV_ref));
774 
775  motionSet::se3ActionInverse(jMi.inverse(),iV,jVinv);
776  BOOST_CHECK(jVinv.isApprox(jV));
777 
778  Matrix6N iV2 = Matrix6N::Random();
779  jV_ref += jMi.toActionMatrix()*iV2;
780  motionSet::se3Action<ADDTO>(jMi,iV2,jV);
781  BOOST_CHECK(jV.isApprox(jV_ref));
782 
783  Matrix6N iV3 = Matrix6N::Random();
784  jV_ref -= jMi.toActionMatrix()*iV3;
785  motionSet::se3Action<RMTO>(jMi,iV3,jV);
786  BOOST_CHECK(jV.isApprox(jV_ref));
787 
788  // motionSet::se3ActionInverse
789  motionSet::se3ActionInverse(jMi,iV,jVinv);
790  jVinv_ref = jMi.inverse().toActionMatrix() * iV;
791  BOOST_CHECK(jVinv.isApprox(jVinv_ref));
792 
793  jVinv_ref += jMi.inverse().toActionMatrix()*iV2;
794  motionSet::se3ActionInverse<ADDTO>(jMi,iV2,jVinv);
795  BOOST_CHECK(jVinv.isApprox(jVinv_ref));
796 
797  jVinv_ref -= jMi.inverse().toActionMatrix()*iV3;
798  motionSet::se3ActionInverse<RMTO>(jMi,iV3,jVinv);
799  BOOST_CHECK(jVinv.isApprox(jVinv_ref));
800 
801  // motionSet::motionAction
802  motionSet::motionAction(v,iV,jV);
803  for( int k=0;k<N;++k )
804  BOOST_CHECK(v.cross(Motion(iV.col(k))).toVector().isApprox(jV.col(k)));
805 
806  jV_ref = v.toActionMatrix()*iV;
807  BOOST_CHECK(jV.isApprox(jV_ref));
808 
809  jV_ref += v.toActionMatrix()*iV2;
810  motionSet::motionAction<ADDTO>(v,iV2,jV);
811  BOOST_CHECK(jV.isApprox(jV_ref));
812 
813  jV_ref -= v.toActionMatrix()*iV3;
814  motionSet::motionAction<RMTO>(v,iV3,jV);
815  BOOST_CHECK(jV.isApprox(jV_ref));
816 
817  // motionSet::inertiaAction
818  const Inertia I(Inertia::Random());
819  motionSet::inertiaAction(I,iV,jV);
820  for( int k=0;k<N;++k )
821  BOOST_CHECK((I*(Motion(iV.col(k)))).toVector().isApprox(jV.col(k)));
822 
823  jV_ref = I.matrix()*iV;
824  BOOST_CHECK(jV.isApprox(jV_ref));
825 
826  jV_ref += I.matrix()*iV2;
827  motionSet::inertiaAction<ADDTO>(I,iV2,jV);
828  BOOST_CHECK(jV.isApprox(jV_ref));
829 
830  jV_ref -= I.matrix()*iV3;
831  motionSet::inertiaAction<RMTO>(I,iV3,jV);
832  BOOST_CHECK(jV.isApprox(jV_ref));
833 
834  // motionSet::act
835  Force f = Force::Random();
836  motionSet::act(iV,f,jF);
837  for( int k=0;k<N;++k )
838  BOOST_CHECK(Motion(iV.col(k)).cross(f).toVector().isApprox(jF.col(k)));
839 
840  for( int k=0;k<N;++k )
841  jF_ref.col(k) = Force(Motion(iV.col(k)).cross(f)).toVector();
842  BOOST_CHECK(jF.isApprox(jF_ref));
843 
844  for( int k=0;k<N;++k )
845  jF_ref.col(k) += Force(Motion(iV2.col(k)).cross(f)).toVector();
846  motionSet::act<ADDTO>(iV2,f,jF);
847  BOOST_CHECK(jF.isApprox(jF_ref));
848 
849  for( int k=0;k<N;++k )
850  jF_ref.col(k) -= Force(Motion(iV3.col(k)).cross(f)).toVector();
851  motionSet::act<RMTO>(iV3,f,jF);
852  BOOST_CHECK(jF.isApprox(jF_ref));
853 }
854 
856 {
857  using namespace pinocchio;
858  typedef SE3::Vector3 Vector3;
859  typedef Motion::Vector6 Vector6;
860 
861  Vector3 v3(Vector3::Random());
862  Vector6 v6(Vector6::Random());
863 
864  Vector3 res1 = unSkew(skew(v3));
865  BOOST_CHECK(res1.isApprox(v3));
866 
867  Vector3 res2 = unSkew(skew(v6.head<3>()));
868  BOOST_CHECK(res2.isApprox(v6.head<3>()));
869 
870  Vector3 res3 = skew(v3)*v3;
871  BOOST_CHECK(res3.isZero());
872 
873  Vector3 rhs(Vector3::Random());
874  Vector3 res41 = skew(v3)*rhs;
875  Vector3 res42 = v3.cross(rhs);
876 
877  BOOST_CHECK(res41.isApprox(res42));
878 
879 }
880 
881 BOOST_AUTO_TEST_CASE(test_addSkew)
882 {
883  using namespace pinocchio;
884  typedef SE3::Vector3 Vector3;
885  typedef SE3::Matrix3 Matrix3;
886 
887  Vector3 v(Vector3::Random());
888  Matrix3 M(Matrix3::Random());
889  Matrix3 Mcopy(M);
890 
891  addSkew(v,M);
892  Matrix3 Mref = Mcopy + skew(v);
893  BOOST_CHECK(M.isApprox(Mref));
894 
895  Mref += skew(-v);
896  addSkew(-v,M);
897  BOOST_CHECK(M.isApprox(Mcopy));
898 
899  M.setZero();
900  addSkew(v,M);
901  BOOST_CHECK(M.isApprox(skew(v)));
902 }
903 
904 BOOST_AUTO_TEST_CASE(test_skew_square)
905 {
906  using namespace pinocchio;
907  typedef SE3::Vector3 Vector3;
908  typedef SE3::Matrix3 Matrix3;
909 
910  Vector3 u(Vector3::Random());
911  Vector3 v(Vector3::Random());
912 
913  Matrix3 ref = skew(u) * skew(v);
914 
915  Matrix3 res = skewSquare(u,v);
916 
917  BOOST_CHECK(res.isApprox(ref));
918 }
919 
920 template<int axis>
922 {
924  typedef double Scalar;
925  typedef Eigen::Matrix<Scalar,3,1> Vector3;
926 
927  static void run()
928  {
929  const Scalar alpha = static_cast <Scalar> (rand()) / static_cast <Scalar> (RAND_MAX);
930  const Vector3 r1 = Axis() * alpha;
931  const Vector3 r2 = alpha * Axis();
932 
933  BOOST_CHECK(r1.isApprox(r2));
934 
935  for(int k = 0; k < Axis::dim; ++k)
936  {
937  if(k==axis)
938  {
939  BOOST_CHECK(r1[k] == alpha);
940  BOOST_CHECK(r2[k] == alpha);
941  }
942  else
943  {
944  BOOST_CHECK(r1[k] == Scalar(0));
945  BOOST_CHECK(r2[k] == Scalar(0));
946  }
947  }
948  }
949 };
950 
951 BOOST_AUTO_TEST_CASE(test_cartesian_axis)
952 {
953  using namespace Eigen;
954  using namespace pinocchio;
955  Vector3d v(Vector3d::Random());
956  const double alpha = 3;
957  Vector3d v2(alpha*v);
958 
959  BOOST_CHECK(AxisX::cross(v).isApprox(Vector3d::Unit(0).cross(v)));
960  BOOST_CHECK(AxisY::cross(v).isApprox(Vector3d::Unit(1).cross(v)));
961  BOOST_CHECK(AxisZ::cross(v).isApprox(Vector3d::Unit(2).cross(v)));
962  BOOST_CHECK(AxisX::alphaCross(alpha,v).isApprox(Vector3d::Unit(0).cross(v2)));
963  BOOST_CHECK(AxisY::alphaCross(alpha,v).isApprox(Vector3d::Unit(1).cross(v2)));
964  BOOST_CHECK(AxisZ::alphaCross(alpha,v).isApprox(Vector3d::Unit(2).cross(v2)));
965 
969 }
970 
971 template<int axis>
973 {
975  typedef double Scalar;
977 
978  static void run()
979  {
980  const Scalar alpha = static_cast <Scalar> (rand()) / static_cast <Scalar> (RAND_MAX);
981  const Motion r1 = Axis() * alpha;
982  const Motion r2 = alpha * Axis();
983 
984  BOOST_CHECK(r1.isApprox(r2));
985 
986  for(int k = 0; k < Axis::dim; ++k)
987  {
988  if(k==axis)
989  {
990  BOOST_CHECK(r1.toVector()[k] == alpha);
991  BOOST_CHECK(r2.toVector()[k] == alpha);
992  }
993  else
994  {
995  BOOST_CHECK(r1.toVector()[k] == Scalar(0));
996  BOOST_CHECK(r2.toVector()[k] == Scalar(0));
997  }
998  }
999  }
1000 };
1001 
1002 BOOST_AUTO_TEST_CASE(test_spatial_axis)
1003 {
1004  using namespace pinocchio;
1005 
1006  Motion v(Motion::Random());
1007  Force f(Force::Random());
1008 
1009  Motion vaxis;
1010  vaxis << AxisVX();
1011  BOOST_CHECK(AxisVX::cross(v).isApprox(vaxis.cross(v)));
1012  BOOST_CHECK(v.cross(AxisVX()).isApprox(v.cross(vaxis)));
1013  BOOST_CHECK(AxisVX::cross(f).isApprox(vaxis.cross(f)));
1014 
1015  vaxis << AxisVY();
1016  BOOST_CHECK(AxisVY::cross(v).isApprox(vaxis.cross(v)));
1017  BOOST_CHECK(v.cross(AxisVY()).isApprox(v.cross(vaxis)));
1018  BOOST_CHECK(AxisVY::cross(f).isApprox(vaxis.cross(f)));
1019 
1020  vaxis << AxisVZ();
1021  BOOST_CHECK(AxisVZ::cross(v).isApprox(vaxis.cross(v)));
1022  BOOST_CHECK(v.cross(AxisVZ()).isApprox(v.cross(vaxis)));
1023  BOOST_CHECK(AxisVZ::cross(f).isApprox(vaxis.cross(f)));
1024 
1025  vaxis << AxisWX();
1026  BOOST_CHECK(AxisWX::cross(v).isApprox(vaxis.cross(v)));
1027  BOOST_CHECK(v.cross(AxisWX()).isApprox(v.cross(vaxis)));
1028  BOOST_CHECK(AxisWX::cross(f).isApprox(vaxis.cross(f)));
1029 
1030  vaxis << AxisWY();
1031  BOOST_CHECK(AxisWY::cross(v).isApprox(vaxis.cross(v)));
1032  BOOST_CHECK(v.cross(AxisWY()).isApprox(v.cross(vaxis)));
1033  BOOST_CHECK(AxisWY::cross(f).isApprox(vaxis.cross(f)));
1034 
1035  vaxis << AxisWZ();
1036  BOOST_CHECK(AxisWZ::cross(v).isApprox(vaxis.cross(v)));
1037  BOOST_CHECK(v.cross(AxisWZ()).isApprox(v.cross(vaxis)));
1038  BOOST_CHECK(AxisWZ::cross(f).isApprox(vaxis.cross(f)));
1039 
1040  // Test operation Axis * Scalar
1047 
1048  // Operations of Constraint on forces Sxf
1049  typedef Motion::ActionMatrixType ActionMatrixType;
1050  typedef ActionMatrixType::ColXpr ColType;
1051  typedef ForceRef<ColType> ForceRefOnColType;
1052  typedef MotionRef<ColType> MotionRefOnColType;
1053  ActionMatrixType Sxf,Sxf_ref;
1054  ActionMatrixType S(ActionMatrixType::Identity());
1055 
1056  SpatialAxis<0>::cross(f,ForceRefOnColType(Sxf.col(0)));
1057  SpatialAxis<1>::cross(f,ForceRefOnColType(Sxf.col(1)));
1058  SpatialAxis<2>::cross(f,ForceRefOnColType(Sxf.col(2)));
1059  SpatialAxis<3>::cross(f,ForceRefOnColType(Sxf.col(3)));
1060  SpatialAxis<4>::cross(f,ForceRefOnColType(Sxf.col(4)));
1061  SpatialAxis<5>::cross(f,ForceRefOnColType(Sxf.col(5)));
1062 
1063  for(int k = 0; k < 6; ++k)
1064  {
1065  MotionRefOnColType Scol(S.col(k));
1066  ForceRefOnColType(Sxf_ref.col(k)) = Scol.cross(f);
1067  }
1068 
1069  BOOST_CHECK(Sxf.isApprox(Sxf_ref));
1070 }
1071 
1072 BOOST_AUTO_TEST_SUITE_END ()
JointCollectionTpl const Eigen::MatrixBase< ConfigVectorType > const Eigen::MatrixBase< TangentVectorType > & v
Eigen::Matrix< Scalar, 3, 1 > Vector3
Definition: spatial.cpp:925
Force vxiv(const Motion &v) const
static ForceTpl Random()
Definition: force-tpl.hpp:88
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:82
SpatialAxis< 2 > AxisVZ
axis
Mref
ForceTpl< double, 0 > Force
bool isApprox(const Derived &other, const Scalar &prec=Eigen::NumTraits< Scalar >::dummy_precision()) const
Definition: se3-base.hpp:108
SpatialAxis< 1 > AxisVY
SpatialAxis< 3 > AxisWX
boost::python::object matrix()
bool isIdentity(const Scalar &prec=Eigen::NumTraits< Scalar >::dummy_precision()) const
static InertiaTpl Random()
int eps
Definition: dcrba.py:384
bool isApprox(const ForceDense< M2 > &f, const Scalar &prec=Eigen::NumTraits< Scalar >::dummy_precision()) const
Eigen::Matrix< _Scalar, 10, 1, _Options > Vector10
ToVectorConstReturnType toVector() const
Return the force as an Eigen vector.
Definition: force-base.hpp:81
Vector10 toDynamicParameters() const
MotionAlgebraAction< OtherSpatialType, Derived >::ReturnType cross(const OtherSpatialType &d) const
Definition: motion-base.hpp:72
static InertiaTpl FromSphere(const Scalar mass, const Scalar radius)
Computes the Inertia of a sphere defined by its mass and its radius.
static void alphaCross(const Scalar &s, const Eigen::MatrixBase< V3_in > &vin, const Eigen::MatrixBase< V3_out > &vout)
SpatialAxis< 0 > AxisVX
ConstAngularType angular() const
Return the angular part of the force vector.
Definition: force-base.hpp:35
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...
bool isApprox(const Derived &other, const Scalar &prec=Eigen::NumTraits< Scalar >::dummy_precision()) const
static void se3ActionInverse(const SE3Tpl< Scalar, Options > &m, const Eigen::MatrixBase< Mat > &iF, Eigen::MatrixBase< MatRet > const &jF)
Inverse SE3 action on a set of forces, represented by a 6xN matrix whose each column represent a spat...
static void act(const Eigen::MatrixBase< Mat > &iV, const ForceDense< ForceDerived > &f, Eigen::MatrixBase< MatRet > const &jF)
Action of a motion set on a force object. The input motion set is represented by a 6xN matrix whose e...
bool isZero(const Scalar &prec=Eigen::NumTraits< Scalar >::dummy_precision()) const
SE3::Scalar Scalar
Definition: conversions.cpp:13
static InertiaTpl Zero()
Matrix6 variation(const Motion &v) const
static void motionAction(const MotionDense< MotionDerived > &v, const Eigen::MatrixBase< Mat > &iF, Eigen::MatrixBase< MatRet > const &jF)
Action of a motion on a set of motions, represented by a 6xN matrix whose columns represent a spatial...
ConstLinearType linear() const
Return the linear part of the force vector.
Definition: force-base.hpp:42
JointCollectionTpl const Eigen::MatrixBase< ConfigVectorIn1 > const Eigen::MatrixBase< ConfigVectorIn2 > const Scalar & u
ActionMatrixType toActionMatrix() const
The action matrix of .
Definition: se3-base.hpp:60
const Symmetric3 & inertia() const
const Vector3 & lever() const
Eigen::Quaternion< Scalar, Options > Quaternion
static ForceTpl Zero()
Definition: force-tpl.hpp:87
SE3GroupAction< D >::ReturnType actInv(const D &d) const
by = aXb.actInv(ay)
Definition: se3-base.hpp:97
SpatialAxis< 4 > AxisWY
static void se3Action(const SE3Tpl< Scalar, Options > &m, const Eigen::MatrixBase< Mat > &iF, Eigen::MatrixBase< MatRet > const &jF)
SE3 action on a set of forces, represented by a 6xN matrix whose each column represent a spatial forc...
bool isApprox(const MotionDense< M2 > &m2, const Scalar &prec=Eigen::NumTraits< Scalar >::dummy_precision()) const
bool isNormalized(const Scalar &prec=Eigen::NumTraits< Scalar >::dummy_precision()) const
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:211
static void cross(const MotionDense< Derived1 > &min, const MotionDense< Derived2 > &mout)
InertiaTpl< NewScalar, Options > cast() const
ActionMatrixType toDualActionMatrix() const
Definition: se3-base.hpp:75
SE3Tpl inverse() const
aXb = bXa.inverse()
pinocchio::CartesianAxis< axis > Axis
Definition: spatial.cpp:923
static MotionTpl Zero()
Definition: motion-tpl.hpp:89
ForceTpl< NewScalar, Options > cast() const
Definition: force-tpl.hpp:116
MotionTpl< double, 0 > Motion
static InertiaTpl Identity()
PlainType normalized() const
static InertiaTpl FromDynamicParameters(const Eigen::MatrixBase< Vector10Like > &params)
static void cross(const Eigen::MatrixBase< V3_in > &vin, const Eigen::MatrixBase< V3_out > &vout)
SE3GroupAction< D >::ReturnType act(const D &d) const
ay = aXb.act(by)
Definition: se3-base.hpp:90
quat
pinocchio::SpatialAxis< axis > Axis
Definition: spatial.cpp:974
static void se3ActionInverse(const SE3Tpl< Scalar, Options > &m, const Eigen::MatrixBase< Mat > &iV, Eigen::MatrixBase< MatRet > const &jV)
Inverse SE3 action on a set of motions, represented by a 6xN matrix whose column represent a spatial ...
traits< SE3Tpl >::Vector3 Vector3
traits< SE3Tpl >::Vector4 Vector4
ForceRef< Vector6 > ref()
Definition: force-tpl.hpp:112
void addSkew(const Eigen::MatrixBase< Vector3Like > &v, const Eigen::MatrixBase< Matrix3Like > &M)
Add skew matrix represented by a 3d vector to a given matrix, i.e. add the antisymmetric matrix repre...
Definition: skew.hpp:60
BOOST_AUTO_TEST_CASE(test_SE3)
Definition: spatial.cpp:22
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:166
Main pinocchio namespace.
Definition: timings.cpp:30
Mp
Definition: dcrba.py:380
SpatialAxis< 5 > AxisWZ
MotionRef< Vector6 > ref()
Definition: motion-tpl.hpp:153
r2
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).
res
ToVectorConstReturnType toVector() const
Definition: motion-base.hpp:37
bool isZero(const Scalar &prec=Eigen::NumTraits< Scalar >::dummy_precision()) const
Definition: force-base.hpp:111
static void ivx(const Motion &v, const InertiaTpl< _Scalar, _Options > &I, const Eigen::MatrixBase< M6 > &Iout)
Time variation operator. It computes the time derivative of an inertia I corresponding to the formula...
Symmetric3Tpl< double, 0 > Symmetric3
ActionMatrixType toDualActionMatrix() const
Definition: motion-base.hpp:42
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...
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:21
list a
ActionMatrixType toActionMatrixInverse() const
The action matrix of .
Definition: se3-base.hpp:70
static void inertiaAction(const InertiaTpl< Scalar, Options > &I, const Eigen::MatrixBase< Mat > &iF, Eigen::MatrixBase< MatRet > const &jF)
Action of an Inertia matrix on a set of motions, represented by a 6xN matrix whose columns represent ...
SE3Tpl< NewScalar, Options > cast() const
Scalar vtiv(const Motion &v) const
bool isZero(const Scalar &prec=Eigen::NumTraits< Scalar >::dummy_precision()) const
Definition: motion-base.hpp:80
MotionZeroTpl< double, 0 > MotionZero
ConstAngularType angular() const
Definition: motion-base.hpp:21
M
static void motionAction(const MotionDense< MotionDerived > &v, const Eigen::MatrixBase< Mat > &iF, Eigen::MatrixBase< MatRet > const &jF)
Action of a motion on a set of forces, represented by a 6xN matrix whose each column represent a spat...
traits< SE3Tpl >::Matrix3 Matrix3
static void se3Action(const SE3Tpl< Scalar, Options > &m, const Eigen::MatrixBase< Mat > &iV, Eigen::MatrixBase< MatRet > const &jV)
SE3 action on a set of motions, represented by a 6xN matrix whose column represent a spatial motion...
static MotionTpl Random()
Definition: motion-tpl.hpp:90
ConstAngularRef rotation() const
Definition: se3-base.hpp:37
MotionTpl< NewScalar, Options > cast() const
Definition: motion-tpl.hpp:157
ActionMatrixType toActionMatrix() const
Definition: motion-base.hpp:41
static void vxi(const Motion &v, const InertiaTpl< _Scalar, _Options > &I, const Eigen::MatrixBase< M6 > &Iout)
Time variation operator. It computes the time derivative of an inertia I corresponding to the formula...
pinocchio::MotionTpl< Scalar > Motion
Definition: spatial.cpp:976


pinocchio
Author(s):
autogenerated on Tue Jun 1 2021 02:45:04