| Directory: | ./ |
|---|---|
| File: | bindings/python/algorithm/expose-centroidal-derivatives.cpp |
| Date: | 2025-02-12 21:03:38 |
| Exec | Total | Coverage | |
|---|---|---|---|
| Lines: | 22 | 22 | 100.0% |
| Branches: | 22 | 44 | 50.0% |
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // | ||
| 2 | // Copyright (c) 2019-2020 CNRS INRIA | ||
| 3 | // | ||
| 4 | |||
| 5 | #include "pinocchio/bindings/python/algorithm/algorithms.hpp" | ||
| 6 | #include "pinocchio/algorithm/centroidal-derivatives.hpp" | ||
| 7 | |||
| 8 | #include <boost/python/tuple.hpp> | ||
| 9 | |||
| 10 | namespace pinocchio | ||
| 11 | { | ||
| 12 | namespace python | ||
| 13 | { | ||
| 14 | |||
| 15 | 1 | bp::tuple computeCentroidalDynamicsDerivatives_proxy( | |
| 16 | const context::Model & model, | ||
| 17 | context::Data & data, | ||
| 18 | const context::VectorXs & q, | ||
| 19 | const context::VectorXs & v, | ||
| 20 | const context::VectorXs & a) | ||
| 21 | { | ||
| 22 | typedef context::Data::Matrix6x Matrix6x; | ||
| 23 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | Matrix6x partialh_dq(Matrix6x::Zero(6, model.nv)); |
| 24 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | Matrix6x partial_dq(Matrix6x::Zero(6, model.nv)); |
| 25 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | Matrix6x partial_dv(Matrix6x::Zero(6, model.nv)); |
| 26 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | Matrix6x partial_da(Matrix6x::Zero(6, model.nv)); |
| 27 | |||
| 28 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | computeCentroidalDynamicsDerivatives( |
| 29 | model, data, q, v, a, partialh_dq, partial_dq, partial_dv, partial_da); | ||
| 30 | |||
| 31 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | return bp::make_tuple(partialh_dq, partial_dq, partial_dv, partial_da); |
| 32 | 1 | } | |
| 33 | |||
| 34 | bp::tuple | ||
| 35 | 1 | getCentroidalDynamicsDerivatives_proxy(const context::Model & model, context::Data & data) | |
| 36 | { | ||
| 37 | typedef context::Data::Matrix6x Matrix6x; | ||
| 38 | |||
| 39 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | Matrix6x partialh_dq(Matrix6x::Zero(6, model.nv)); |
| 40 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | Matrix6x partial_dq(Matrix6x::Zero(6, model.nv)); |
| 41 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | Matrix6x partial_dv(Matrix6x::Zero(6, model.nv)); |
| 42 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | Matrix6x partial_da(Matrix6x::Zero(6, model.nv)); |
| 43 | |||
| 44 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | impl::getCentroidalDynamicsDerivatives( |
| 45 | model, data, partialh_dq, partial_dq, partial_dv, partial_da); | ||
| 46 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | return bp::make_tuple(partialh_dq, partial_dq, partial_dv, partial_da); |
| 47 | 1 | } | |
| 48 | |||
| 49 | 69 | void exposeCentroidalDerivatives() | |
| 50 | { | ||
| 51 | using namespace Eigen; | ||
| 52 | |||
| 53 |
1/2✓ Branch 1 taken 69 times.
✗ Branch 2 not taken.
|
69 | bp::def( |
| 54 | "computeCentroidalDynamicsDerivatives", computeCentroidalDynamicsDerivatives_proxy, | ||
| 55 | 138 | bp::args("model", "data", "q", "v", "a"), | |
| 56 | "Computes the analytical derivatives of the centroidal dynamics\n" | ||
| 57 | "with respect to the joint configuration vector, velocity and acceleration."); | ||
| 58 | |||
| 59 |
1/2✓ Branch 1 taken 69 times.
✗ Branch 2 not taken.
|
69 | bp::def( |
| 60 | "getCentroidalDynamicsDerivatives", getCentroidalDynamicsDerivatives_proxy, | ||
| 61 | 138 | bp::args("model", "data"), | |
| 62 | "Retrive the analytical derivatives of the centroidal dynamics\n" | ||
| 63 | "from the RNEA derivatives.\n" | ||
| 64 | "pinocchio.computeRNEADerivatives should have been called first."); | ||
| 65 | 69 | } | |
| 66 | |||
| 67 | } // namespace python | ||
| 68 | } // namespace pinocchio | ||
| 69 |