unittest/rnea-derivatives.cpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2017-2020 CNRS INRIA
3 //
4 
15 
16 #include <iostream>
17 
18 #include <boost/test/unit_test.hpp>
19 #include <boost/utility/binary.hpp>
20 
21 BOOST_AUTO_TEST_SUITE(BOOST_TEST_MODULE)
22 
23 BOOST_AUTO_TEST_CASE(test_generalized_gravity_derivatives)
24 {
25  using namespace Eigen;
26  using namespace pinocchio;
27 
28  Model model;
30 
31  Data data(model), data_fd(model);
32 
33  model.lowerPositionLimit.head<3>().fill(-1.);
34  model.upperPositionLimit.head<3>().fill(1.);
35  VectorXd q = randomConfiguration(model);
36  VectorXd v(VectorXd::Zero(model.nv));
37  VectorXd a(VectorXd::Zero(model.nv));
38 
39  // Check againt non-derivative algo
40  MatrixXd g_partial_dq(model.nv, model.nv);
41  g_partial_dq.setZero();
43 
44  VectorXd g0 = computeGeneralizedGravity(model, data_fd, q);
45  BOOST_CHECK(data.g.isApprox(g0));
46 
47  MatrixXd g_partial_dq_fd(model.nv, model.nv);
48  g_partial_dq_fd.setZero();
49 
50  VectorXd v_eps(Eigen::VectorXd::Zero(model.nv));
51  VectorXd q_plus(model.nq);
52  VectorXd g_plus(model.nv);
53  const double alpha = 1e-8;
54  for (int k = 0; k < model.nv; ++k)
55  {
56  v_eps[k] += alpha;
57  q_plus = integrate(model, q, v_eps);
58  g_plus = computeGeneralizedGravity(model, data_fd, q_plus);
59 
60  g_partial_dq_fd.col(k) = (g_plus - g0) / alpha;
61  v_eps[k] -= alpha;
62  }
63 
64  BOOST_CHECK(g_partial_dq.isApprox(g_partial_dq_fd, sqrt(alpha)));
65 }
66 
67 BOOST_AUTO_TEST_CASE(test_generalized_gravity_derivatives_fext)
68 {
69  using namespace Eigen;
70  using namespace pinocchio;
71 
72  Model model;
74 
75  Data data(model), data_fd(model);
76 
77  model.lowerPositionLimit.head<3>().fill(-1.);
78  model.upperPositionLimit.head<3>().fill(1.);
79  VectorXd q = randomConfiguration(model);
80 
81  typedef PINOCCHIO_ALIGNED_STD_VECTOR(Force) ForceVector;
82  ForceVector fext((size_t)model.njoints);
83  for (ForceVector::iterator it = fext.begin(); it != fext.end(); ++it)
84  (*it).setRandom();
85 
86  // Check againt non-derivative algo
87  MatrixXd static_vec_partial_dq(model.nv, model.nv);
88  static_vec_partial_dq.setZero();
89  computeStaticTorqueDerivatives(model, data, q, fext, static_vec_partial_dq);
90 
91  VectorXd tau0 = computeStaticTorque(model, data_fd, q, fext);
92  BOOST_CHECK(data.tau.isApprox(tau0));
93 
94  MatrixXd static_vec_partial_dq_fd(model.nv, model.nv);
95 
96  VectorXd v_eps(Eigen::VectorXd::Zero(model.nv));
97  VectorXd q_plus(model.nq);
98  VectorXd tau_plus(model.nv);
99  const double alpha = 1e-8;
100  for (int k = 0; k < model.nv; ++k)
101  {
102  v_eps[k] += alpha;
103  q_plus = integrate(model, q, v_eps);
104  tau_plus = computeStaticTorque(model, data_fd, q_plus, fext);
105 
106  static_vec_partial_dq_fd.col(k) = (tau_plus - tau0) / alpha;
107  v_eps[k] = 0.;
108  }
109 
110  BOOST_CHECK(static_vec_partial_dq.isApprox(static_vec_partial_dq_fd, sqrt(alpha)));
111 }
112 
113 BOOST_AUTO_TEST_CASE(test_rnea_derivatives)
114 {
115  using namespace Eigen;
116  using namespace pinocchio;
117 
118  Model model;
120  model.armature = VectorXd::Random(model.nv) + VectorXd::Ones(model.nv);
121 
122  Data data(model), data_fd(model), data_ref(model);
123 
124  model.lowerPositionLimit.head<3>().fill(-1.);
125  model.upperPositionLimit.head<3>().fill(1.);
126  VectorXd q = randomConfiguration(model);
127  VectorXd v(VectorXd::Random(model.nv));
128  VectorXd a(VectorXd::Random(model.nv));
129 
131  MatrixXd rnea_partial_dq(model.nv, model.nv);
132  rnea_partial_dq.setZero();
133  MatrixXd rnea_partial_dv(model.nv, model.nv);
134  rnea_partial_dv.setZero();
135  MatrixXd rnea_partial_da(model.nv, model.nv);
136  rnea_partial_da.setZero();
138  model, data, q, VectorXd::Zero(model.nv), VectorXd::Zero(model.nv), rnea_partial_dq,
139  rnea_partial_dv, rnea_partial_da);
140  rnea(model, data_ref, q, VectorXd::Zero(model.nv), VectorXd::Zero(model.nv));
141  for (Model::JointIndex k = 1; k < (Model::JointIndex)model.njoints; ++k)
142  {
143  BOOST_CHECK(data.of[k].isApprox(data.oMi[k].act(data_ref.f[k])));
144  }
145 
146  MatrixXd g_partial_dq(model.nv, model.nv);
147  g_partial_dq.setZero();
148  computeGeneralizedGravityDerivatives(model, data_ref, q, g_partial_dq);
149 
150  BOOST_CHECK(data.dFdq.isApprox(data_ref.dFdq));
151  BOOST_CHECK(rnea_partial_dq.isApprox(g_partial_dq));
152  BOOST_CHECK(data.tau.isApprox(data_ref.g));
153 
154  VectorXd tau0 = rnea(model, data_fd, q, VectorXd::Zero(model.nv), VectorXd::Zero(model.nv));
155  MatrixXd rnea_partial_dq_fd(model.nv, model.nv);
156  rnea_partial_dq_fd.setZero();
157 
158  VectorXd v_eps(VectorXd::Zero(model.nv));
159  VectorXd q_plus(model.nq);
160  VectorXd tau_plus(model.nv);
161  const double alpha = 1e-8;
162  for (int k = 0; k < model.nv; ++k)
163  {
164  v_eps[k] += alpha;
165  q_plus = integrate(model, q, v_eps);
166  tau_plus = rnea(model, data_fd, q_plus, VectorXd::Zero(model.nv), VectorXd::Zero(model.nv));
167 
168  rnea_partial_dq_fd.col(k) = (tau_plus - tau0) / alpha;
169  v_eps[k] -= alpha;
170  }
171  BOOST_CHECK(rnea_partial_dq.isApprox(rnea_partial_dq_fd, sqrt(alpha)));
172 
173  // Check with q and a non zero
174  tau0 = rnea(model, data_fd, q, 0 * v, a);
175  rnea_partial_dq_fd.setZero();
176 
177  for (int k = 0; k < model.nv; ++k)
178  {
179  v_eps[k] += alpha;
180  q_plus = integrate(model, q, v_eps);
181  tau_plus = rnea(model, data_fd, q_plus, VectorXd::Zero(model.nv), a);
182 
183  rnea_partial_dq_fd.col(k) = (tau_plus - tau0) / alpha;
184  v_eps[k] -= alpha;
185  }
186 
187  rnea_partial_dq.setZero();
189  model, data, q, VectorXd::Zero(model.nv), a, rnea_partial_dq, rnea_partial_dv, rnea_partial_da);
190  forwardKinematics(model, data_ref, q, VectorXd::Zero(model.nv), a);
191 
192  for (Model::JointIndex k = 1; k < (Model::JointIndex)model.njoints; ++k)
193  {
194  BOOST_CHECK(data.a[k].isApprox(data_ref.a[k]));
195  BOOST_CHECK(data.v[k].isApprox(data_ref.v[k]));
196  BOOST_CHECK(data.oMi[k].isApprox(data_ref.oMi[k]));
197  BOOST_CHECK(data.oh[k].isApprox(Force::Zero()));
198  }
199 
200  BOOST_CHECK(data.tau.isApprox(tau0));
201  BOOST_CHECK(rnea_partial_dq.isApprox(rnea_partial_dq_fd, sqrt(alpha)));
202 
203  // Check with q and v non zero
204  const Motion gravity(model.gravity);
205  model.gravity.setZero();
206  tau0 = rnea(model, data_fd, q, v, VectorXd::Zero(model.nv));
207  rnea_partial_dq_fd.setZero();
208 
209  for (int k = 0; k < model.nv; ++k)
210  {
211  v_eps[k] += alpha;
212  q_plus = integrate(model, q, v_eps);
213  tau_plus = rnea(model, data_fd, q_plus, v, VectorXd::Zero(model.nv));
214 
215  rnea_partial_dq_fd.col(k) = (tau_plus - tau0) / alpha;
216  v_eps[k] -= alpha;
217  }
218 
219  VectorXd v_plus(v);
220  MatrixXd rnea_partial_dv_fd(model.nv, model.nv);
221  rnea_partial_dv_fd.setZero();
222 
223  for (int k = 0; k < model.nv; ++k)
224  {
225  v_plus[k] += alpha;
226  tau_plus = rnea(model, data_fd, q, v_plus, VectorXd::Zero(model.nv));
227 
228  rnea_partial_dv_fd.col(k) = (tau_plus - tau0) / alpha;
229  v_plus[k] -= alpha;
230  }
231 
232  rnea_partial_dq.setZero();
233  rnea_partial_dv.setZero();
235  model, data, q, v, VectorXd::Zero(model.nv), rnea_partial_dq, rnea_partial_dv, rnea_partial_da);
236  forwardKinematics(model, data_ref, q, v, VectorXd::Zero(model.nv));
237 
238  for (Model::JointIndex k = 1; k < (Model::JointIndex)model.njoints; ++k)
239  {
240  BOOST_CHECK(data.a[k].isApprox(data_ref.a[k]));
241  BOOST_CHECK(data.v[k].isApprox(data_ref.v[k]));
242  BOOST_CHECK(data.oMi[k].isApprox(data_ref.oMi[k]));
243  }
244 
245  BOOST_CHECK(data.tau.isApprox(tau0));
246  BOOST_CHECK(rnea_partial_dq.isApprox(rnea_partial_dq_fd, sqrt(alpha)));
247  BOOST_CHECK(rnea_partial_dv.isApprox(rnea_partial_dv_fd, sqrt(alpha)));
248 
249  // std::cout << "rnea_partial_dv:\n" << rnea_partial_dv.block<10,10>(0,0) << std::endl;
250  // std::cout << "rnea_partial_dv ref:\n" << rnea_partial_dv_fd.block<10,10>(0,0) << std::endl;
251  // std::cout << "rnea_partial_dv:\n" << rnea_partial_dv.topRows<10>() << std::endl;
252  // std::cout << "rnea_partial_dv ref:\n" << rnea_partial_dv_fd.topRows<10>() << std::endl;
253  // Check with q, v and a non zero
254  model.gravity = gravity;
255  v_plus = v;
256  tau0 = rnea(model, data_fd, q, v, a);
257  rnea_partial_dq_fd.setZero();
258 
259  for (int k = 0; k < model.nv; ++k)
260  {
261  v_eps[k] += alpha;
262  q_plus = integrate(model, q, v_eps);
263  tau_plus = rnea(model, data_fd, q_plus, v, a);
264 
265  rnea_partial_dq_fd.col(k) = (tau_plus - tau0) / alpha;
266  v_eps[k] -= alpha;
267  }
268 
269  rnea_partial_dv_fd.setZero();
270  for (int k = 0; k < model.nv; ++k)
271  {
272  v_plus[k] += alpha;
273  tau_plus = rnea(model, data_fd, q, v_plus, a);
274 
275  rnea_partial_dv_fd.col(k) = (tau_plus - tau0) / alpha;
276  v_plus[k] -= alpha;
277  }
278 
279  rnea_partial_dq.setZero();
280  rnea_partial_dv.setZero();
281  computeRNEADerivatives(model, data, q, v, a, rnea_partial_dq, rnea_partial_dv, rnea_partial_da);
282  forwardKinematics(model, data_ref, q, v, a);
283 
284  for (Model::JointIndex k = 1; k < (Model::JointIndex)model.njoints; ++k)
285  {
286  BOOST_CHECK(data.a[k].isApprox(data_ref.a[k]));
287  BOOST_CHECK(data.v[k].isApprox(data_ref.v[k]));
288  BOOST_CHECK(data.oMi[k].isApprox(data_ref.oMi[k]));
289  }
290 
292  BOOST_CHECK(data.dJ.isApprox(data_ref.dJ));
293  crba(model, data_ref, q, Convention::WORLD);
294  data_ref.M.triangularView<Eigen::StrictlyLower>() =
295  data_ref.M.transpose().triangularView<Eigen::StrictlyLower>();
296 
297  rnea_partial_da.triangularView<Eigen::StrictlyLower>() =
298  rnea_partial_da.transpose().triangularView<Eigen::StrictlyLower>();
299  BOOST_CHECK(rnea_partial_da.isApprox(data_ref.M));
300 
301  BOOST_CHECK(data.tau.isApprox(tau0));
302  BOOST_CHECK(rnea_partial_dq.isApprox(rnea_partial_dq_fd, sqrt(alpha)));
303  BOOST_CHECK(rnea_partial_dv.isApprox(rnea_partial_dv_fd, sqrt(alpha)));
304 
305  Data data2(model);
306  computeRNEADerivatives(model, data2, q, v, a);
307  data2.M.triangularView<Eigen::StrictlyLower>() =
308  data2.M.transpose().triangularView<Eigen::StrictlyLower>();
309 
310  BOOST_CHECK(rnea_partial_dq.isApprox(data2.dtau_dq));
311  BOOST_CHECK(rnea_partial_dv.isApprox(data2.dtau_dv));
312  BOOST_CHECK(rnea_partial_da.isApprox(data2.M));
313 }
314 
315 BOOST_AUTO_TEST_CASE(test_rnea_derivatives_fext)
316 {
317  using namespace Eigen;
318  using namespace pinocchio;
319 
320  Model model;
322  typedef Model::Force Force;
323 
324  Data data(model), data_fd(model), data_ref(model);
325 
326  model.lowerPositionLimit.head<3>().fill(-1.);
327  model.upperPositionLimit.head<3>().fill(1.);
328  VectorXd q = randomConfiguration(model);
329  VectorXd v(VectorXd::Random(model.nv));
330  VectorXd a(VectorXd::Random(model.nv));
331 
332  typedef PINOCCHIO_ALIGNED_STD_VECTOR(Force) ForceVector;
333  ForceVector fext((size_t)model.njoints);
334  for (ForceVector::iterator it = fext.begin(); it != fext.end(); ++it)
335  (*it).setRandom();
336 
338  MatrixXd rnea_partial_dq(model.nv, model.nv);
339  rnea_partial_dq.setZero();
340  MatrixXd rnea_partial_dv(model.nv, model.nv);
341  rnea_partial_dv.setZero();
342  MatrixXd rnea_partial_da(model.nv, model.nv);
343  rnea_partial_da.setZero();
344 
346  model, data, q, v, a, fext, rnea_partial_dq, rnea_partial_dv, rnea_partial_da);
347  rnea(model, data_ref, q, v, a, fext);
348 
349  BOOST_CHECK(data.tau.isApprox(data_ref.tau));
350 
351  computeRNEADerivatives(model, data_ref, q, v, a);
352  BOOST_CHECK(rnea_partial_dv.isApprox(data_ref.dtau_dv));
353  BOOST_CHECK(rnea_partial_da.isApprox(data_ref.M));
354 
355  MatrixXd rnea_partial_dq_fd(model.nv, model.nv);
356  rnea_partial_dq_fd.setZero();
357  MatrixXd rnea_partial_dv_fd(model.nv, model.nv);
358  rnea_partial_dv_fd.setZero();
359  MatrixXd rnea_partial_da_fd(model.nv, model.nv);
360  rnea_partial_da_fd.setZero();
361 
362  VectorXd v_eps(VectorXd::Zero(model.nv));
363  VectorXd q_plus(model.nq);
364  VectorXd tau_plus(model.nv);
365  const double eps = 1e-8;
366 
367  const VectorXd tau_ref = rnea(model, data_ref, q, v, a, fext);
368  for (int k = 0; k < model.nv; ++k)
369  {
370  v_eps[k] = eps;
371  q_plus = integrate(model, q, v_eps);
372  tau_plus = rnea(model, data_fd, q_plus, v, a, fext);
373 
374  rnea_partial_dq_fd.col(k) = (tau_plus - tau_ref) / eps;
375 
376  v_eps[k] = 0.;
377  }
378  BOOST_CHECK(rnea_partial_dq.isApprox(rnea_partial_dq_fd, sqrt(eps)));
379 
380  VectorXd v_plus(v);
381  for (int k = 0; k < model.nv; ++k)
382  {
383  v_plus[k] += eps;
384 
385  tau_plus = rnea(model, data_fd, q, v_plus, a, fext);
386 
387  rnea_partial_dv_fd.col(k) = (tau_plus - tau_ref) / eps;
388 
389  v_plus[k] -= eps;
390  }
391  BOOST_CHECK(rnea_partial_dv.isApprox(rnea_partial_dv_fd, sqrt(eps)));
392 
393  VectorXd a_plus(a);
394  for (int k = 0; k < model.nv; ++k)
395  {
396  a_plus[k] += eps;
397 
398  tau_plus = rnea(model, data_fd, q, v, a_plus, fext);
399 
400  rnea_partial_da_fd.col(k) = (tau_plus - tau_ref) / eps;
401 
402  a_plus[k] -= eps;
403  }
404 
405  rnea_partial_da.triangularView<Eigen::Lower>() =
406  rnea_partial_da.transpose().triangularView<Eigen::Lower>();
407  BOOST_CHECK(rnea_partial_da.isApprox(rnea_partial_da_fd, sqrt(eps)));
408 
409  // test the shortcut
410  Data data_shortcut(model);
411  computeRNEADerivatives(model, data_shortcut, q, v, a, fext);
412  BOOST_CHECK(data_shortcut.dtau_dq.isApprox(rnea_partial_dq));
413  BOOST_CHECK(data_shortcut.dtau_dv.isApprox(rnea_partial_dv));
414  data_shortcut.M.triangularView<Eigen::Lower>() =
415  data_shortcut.M.transpose().triangularView<Eigen::Lower>();
416  BOOST_CHECK(data_shortcut.M.isApprox(rnea_partial_da));
417 }
418 
419 BOOST_AUTO_TEST_CASE(test_rnea_derivatives_vs_kinematics_derivatives)
420 {
421  using namespace Eigen;
422  using namespace pinocchio;
423 
424  Model model;
426 
427  Data data(model), data_ref(model);
428 
429  model.lowerPositionLimit.head<3>().fill(-1.);
430  model.upperPositionLimit.head<3>().fill(1.);
431  VectorXd q = randomConfiguration(model);
432  VectorXd v(VectorXd::Random(model.nv));
433  VectorXd a(VectorXd::Random(model.nv));
434 
436  MatrixXd rnea_partial_dq(model.nv, model.nv);
437  rnea_partial_dq.setZero();
438  MatrixXd rnea_partial_dv(model.nv, model.nv);
439  rnea_partial_dv.setZero();
440  MatrixXd rnea_partial_da(model.nv, model.nv);
441  rnea_partial_da.setZero();
442 
443  computeRNEADerivatives(model, data, q, v, a, rnea_partial_dq, rnea_partial_dv, rnea_partial_da);
445 
446  BOOST_CHECK(data.J.isApprox(data_ref.J));
447  BOOST_CHECK(data.dJ.isApprox(data_ref.dJ));
448 
449  for (size_t k = 1; k < (size_t)model.njoints; ++k)
450  {
451  BOOST_CHECK(data.oMi[k].isApprox(data_ref.oMi[k]));
452  BOOST_CHECK(data.ov[k].isApprox(data_ref.ov[k]));
453  BOOST_CHECK(data.oa[k].isApprox(data_ref.oa[k]));
454  }
455 }
456 
457 BOOST_AUTO_TEST_CASE(test_multiple_calls)
458 {
459  using namespace Eigen;
460  using namespace pinocchio;
461 
462  Model model;
464 
465  Data data1(model), data2(model);
466 
467  model.lowerPositionLimit.head<3>().fill(-1.);
468  model.upperPositionLimit.head<3>().fill(1.);
469  VectorXd q = randomConfiguration(model);
470  VectorXd v(VectorXd::Random(model.nv));
471  VectorXd a(VectorXd::Random(model.nv));
472 
473  computeRNEADerivatives(model, data1, q, v, a);
474  data2 = data1;
475 
476  for (int k = 0; k < 20; ++k)
477  {
478  computeRNEADerivatives(model, data1, q, v, a);
479  }
480 
481  BOOST_CHECK(data1.J.isApprox(data2.J));
482  BOOST_CHECK(data1.dJ.isApprox(data2.dJ));
483  BOOST_CHECK(data1.dVdq.isApprox(data2.dVdq));
484  BOOST_CHECK(data1.dAdq.isApprox(data2.dAdq));
485  BOOST_CHECK(data1.dAdv.isApprox(data2.dAdv));
486 
487  BOOST_CHECK(data1.dFdq.isApprox(data2.dFdq));
488  BOOST_CHECK(data1.dFdv.isApprox(data2.dFdv));
489  BOOST_CHECK(data1.dFda.isApprox(data2.dFda));
490 
491  BOOST_CHECK(data1.dtau_dq.isApprox(data2.dtau_dq));
492  BOOST_CHECK(data1.dtau_dv.isApprox(data2.dtau_dv));
493  BOOST_CHECK(data1.M.isApprox(data2.M));
494 }
495 
496 BOOST_AUTO_TEST_CASE(test_get_coriolis)
497 {
498  using namespace Eigen;
499  using namespace pinocchio;
500 
501  Model model;
503 
504  model.lowerPositionLimit.head<3>().fill(-1.);
505  model.upperPositionLimit.head<3>().fill(1.);
506 
507  Data data_ref(model);
508  Data data(model);
509 
510  VectorXd q = randomConfiguration(model);
511  VectorXd v = VectorXd::Random(model.nv);
512  VectorXd tau = VectorXd::Random(model.nv);
513 
514  computeCoriolisMatrix(model, data_ref, q, v);
515 
518 
519  BOOST_CHECK(data.J.isApprox(data_ref.J));
520  BOOST_CHECK(data.dJ.isApprox(data_ref.dJ));
521  BOOST_CHECK(data.Ag.isApprox(data_ref.Ag));
522  for (JointIndex k = 1; k < model.joints.size(); ++k)
523  {
524  BOOST_CHECK(data.B[k].isApprox(data_ref.B[k]));
525  BOOST_CHECK(data.oYcrb[k].isApprox(data_ref.oYcrb[k]));
526  }
527 
528  BOOST_CHECK(data.C.isApprox(data_ref.C));
529 }
530 
531 BOOST_AUTO_TEST_SUITE_END()
pinocchio::DataTpl::M
MatrixXs M
The joint space inertia matrix (a square matrix of dim model.nv).
Definition: multibody/data.hpp:199
pinocchio::WORLD
@ WORLD
Definition: multibody/fwd.hpp:48
pinocchio::DataTpl::dFdq
Matrix6x dFdq
Variation of the forceset with respect to the joint configuration.
Definition: multibody/data.hpp:211
pinocchio::DataTpl::g
VectorXs g
Vector of generalized gravity (dim model.nv).
Definition: multibody/data.hpp:184
Eigen
pinocchio::DataTpl
Definition: context/generic.hpp:25
pinocchio::DataTpl::dAdv
Matrix6x dAdv
Variation of the spatial acceleration set with respect to the joint velocity.
Definition: multibody/data.hpp:383
pinocchio::forwardKinematics
void forwardKinematics(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q)
Update the joint placements according to the current joint configuration.
pinocchio::DataTpl::dJ
Matrix6x dJ
Derivative of the Jacobian with respect to the time.
Definition: multibody/data.hpp:363
pinocchio::DataTpl::dFdv
Matrix6x dFdv
Variation of the forceset with respect to the joint velocity.
Definition: multibody/data.hpp:214
kinematics.hpp
rnea-derivatives.hpp
model.hpp
setup.data
data
Definition: cmake/cython/setup.in.py:48
pinocchio::python::context::Force
ForceTpl< Scalar, Options > Force
Definition: bindings/python/context/generic.hpp:55
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(test_generalized_gravity_derivatives)
Definition: unittest/rnea-derivatives.cpp:23
pinocchio::buildModels::humanoidRandom
void humanoidRandom(ModelTpl< Scalar, Options, JointCollectionTpl > &model, bool usingFF=true)
Create a humanoid kinematic tree with 6-DOF limbs and random joint placements.
pinocchio::python::computeRNEADerivatives
bp::tuple computeRNEADerivatives(const context::Model &model, context::Data &data, const context::VectorXs &q, const context::VectorXs &v, const context::VectorXs &a)
Definition: expose-rnea-derivatives.cpp:38
pinocchio::crba
const DataTpl< Scalar, Options, JointCollectionTpl >::MatrixXs & crba(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q, const Convention convention=Convention::LOCAL)
Computes the upper triangular part of the joint space inertia matrix M by using the Composite Rigid B...
pinocchio::computeJointJacobiansTimeVariation
const DataTpl< Scalar, Options, JointCollectionTpl >::Matrix6x & computeJointJacobiansTimeVariation(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q, const Eigen::MatrixBase< TangentVectorType > &v)
Computes the full model Jacobian variations with respect to time. It corresponds to dJ/dt which depen...
pinocchio::DataTpl::dFda
Matrix6x dFda
Variation of the forceset with respect to the joint acceleration.
Definition: multibody/data.hpp:217
pinocchio::randomConfiguration
void randomConfiguration(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const Eigen::MatrixBase< ConfigVectorIn1 > &lowerLimits, const Eigen::MatrixBase< ConfigVectorIn2 > &upperLimits, const Eigen::MatrixBase< ReturnType > &qout)
Generate a configuration vector uniformly sampled among provided limits.
Definition: joint-configuration.hpp:315
rnea.hpp
pinocchio::getCoriolisMatrix
const DataTpl< Scalar, Options, JointCollectionTpl >::MatrixXs & getCoriolisMatrix(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data)
Retrives the Coriolis Matrix of the Lagrangian dynamics:
anymal-simulation.model
model
Definition: anymal-simulation.py:8
pinocchio::ModelTpl::JointIndex
pinocchio::JointIndex JointIndex
Definition: multibody/model.hpp:67
pinocchio::DataTpl::C
MatrixXs C
The Coriolis matrix (a square matrix of dim model.nv).
Definition: multibody/data.hpp:205
forward-dynamics-derivatives.tau
tau
Definition: forward-dynamics-derivatives.py:25
pinocchio::computeForwardKinematicsDerivatives
void computeForwardKinematicsDerivatives(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q, const Eigen::MatrixBase< TangentVectorType1 > &v, const Eigen::MatrixBase< TangentVectorType2 > &a)
Computes all the terms required to compute the derivatives of the placement, spatial velocity and acc...
joint-configuration.hpp
reachable-workspace-with-collisions.alpha
float alpha
Definition: reachable-workspace-with-collisions.py:162
pinocchio::DataTpl::dtau_dq
RowMatrixXs dtau_dq
Partial derivative of the joint torque vector with respect to the joint configuration.
Definition: multibody/data.hpp:387
pinocchio::integrate
void integrate(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const Eigen::MatrixBase< ConfigVectorType > &q, const Eigen::MatrixBase< TangentVectorType > &v, const Eigen::MatrixBase< ReturnType > &qout)
Integrate a configuration vector for the specified model for a tangent vector during one unit time.
Definition: joint-configuration.hpp:70
pinocchio::computeStaticTorque
const DataTpl< Scalar, Options, JointCollectionTpl >::TangentVectorType & computeStaticTorque(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q, const container::aligned_vector< ForceTpl< Scalar, Options >> &fext)
Computes the generalized static torque contribution of the Lagrangian dynamics:
pinocchio::DataTpl::tau
TangentVectorType tau
Vector of joint torques (dim model.nv).
Definition: multibody/data.hpp:173
cartpole.v
v
Definition: cartpole.py:153
data.hpp
pinocchio::ForceTpl
Definition: context/casadi.hpp:25
pinocchio::python::computeGeneralizedGravityDerivatives
context::Data::MatrixXs computeGeneralizedGravityDerivatives(const context::Model &model, context::Data &data, const context::VectorXs &q)
Definition: expose-rnea-derivatives.cpp:17
pinocchio::DataTpl::Ag
Matrix6x Ag
Centroidal Momentum Matrix.
Definition: multibody/data.hpp:284
q
q
inverse-kinematics-3d.it
int it
Definition: inverse-kinematics-3d.py:17
a
Vec3f a
pinocchio::python::computeStaticTorqueDerivatives
context::Data::MatrixXs computeStaticTorqueDerivatives(const context::Model &model, context::Data &data, const context::VectorXs &q, const ForceAlignedVector &fext)
Definition: expose-rnea-derivatives.cpp:26
pinocchio::DataTpl::J
Matrix6x J
Jacobian of joint placements.
Definition: multibody/data.hpp:360
fill
fill
pinocchio::rnea
const DataTpl< Scalar, Options, JointCollectionTpl >::TangentVectorType & rnea(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q, const Eigen::MatrixBase< TangentVectorType1 > &v, const Eigen::MatrixBase< TangentVectorType2 > &a)
The Recursive Newton-Euler algorithm. It computes the inverse dynamics, aka the joint torques accordi...
kinematics-derivatives.hpp
dcrba.eps
int eps
Definition: dcrba.py:458
pinocchio::JointIndex
Index JointIndex
Definition: multibody/fwd.hpp:26
PINOCCHIO_ALIGNED_STD_VECTOR
#define PINOCCHIO_ALIGNED_STD_VECTOR(Type)
Definition: container/aligned-vector.hpp:11
pinocchio::DataTpl::dtau_dv
RowMatrixXs dtau_dv
Partial derivative of the joint torque vector with respect to the joint velocity.
Definition: multibody/data.hpp:390
sample-models.hpp
pinocchio::MotionTpl
Definition: context/casadi.hpp:27
dcrba.gravity
gravity
Definition: dcrba.py:485
jacobian.hpp
pinocchio::ModelTpl
Definition: context/generic.hpp:20
pinocchio::computeCoriolisMatrix
const DataTpl< Scalar, Options, JointCollectionTpl >::MatrixXs & computeCoriolisMatrix(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q, const Eigen::MatrixBase< TangentVectorType > &v)
Computes the Coriolis Matrix of the Lagrangian dynamics:
crba.hpp
pinocchio::DataTpl::dVdq
Matrix6x dVdq
Variation of the spatial velocity set with respect to the joint configuration.
Definition: multibody/data.hpp:377
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:27
pinocchio::computeGeneralizedGravity
const DataTpl< Scalar, Options, JointCollectionTpl >::TangentVectorType & computeGeneralizedGravity(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q)
Computes the generalized gravity contribution of the Lagrangian dynamics:
pinocchio::DataTpl::dAdq
Matrix6x dAdq
Variation of the spatial acceleration set with respect to the joint configuration.
Definition: multibody/data.hpp:380


pinocchio
Author(s):
autogenerated on Fri Nov 1 2024 02:41:48