Directory: | ./ |
---|---|
File: | bindings/python/algorithm/expose-centroidal-derivatives.cpp |
Date: | 2024-08-27 18:20:05 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 6 | 20 | 30.0% |
Branches: | 2 | 44 | 4.5% |
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 | ✗ | 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 | ✗ | Matrix6x partialh_dq(Matrix6x::Zero(6, model.nv)); | |
24 | ✗ | Matrix6x partial_dq(Matrix6x::Zero(6, model.nv)); | |
25 | ✗ | Matrix6x partial_dv(Matrix6x::Zero(6, model.nv)); | |
26 | ✗ | Matrix6x partial_da(Matrix6x::Zero(6, model.nv)); | |
27 | |||
28 | ✗ | computeCentroidalDynamicsDerivatives( | |
29 | model, data, q, v, a, partialh_dq, partial_dq, partial_dv, partial_da); | ||
30 | |||
31 | ✗ | return bp::make_tuple(partialh_dq, partial_dq, partial_dv, partial_da); | |
32 | } | ||
33 | |||
34 | bp::tuple | ||
35 | ✗ | getCentroidalDynamicsDerivatives_proxy(const context::Model & model, context::Data & data) | |
36 | { | ||
37 | typedef context::Data::Matrix6x Matrix6x; | ||
38 | |||
39 | ✗ | Matrix6x partialh_dq(Matrix6x::Zero(6, model.nv)); | |
40 | ✗ | Matrix6x partial_dq(Matrix6x::Zero(6, model.nv)); | |
41 | ✗ | Matrix6x partial_dv(Matrix6x::Zero(6, model.nv)); | |
42 | ✗ | Matrix6x partial_da(Matrix6x::Zero(6, model.nv)); | |
43 | |||
44 | ✗ | impl::getCentroidalDynamicsDerivatives( | |
45 | model, data, partialh_dq, partial_dq, partial_dv, partial_da); | ||
46 | ✗ | return bp::make_tuple(partialh_dq, partial_dq, partial_dv, partial_da); | |
47 | } | ||
48 | |||
49 | 20 | void exposeCentroidalDerivatives() | |
50 | { | ||
51 | using namespace Eigen; | ||
52 | |||
53 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 | bp::def( |
54 | "computeCentroidalDynamicsDerivatives", computeCentroidalDynamicsDerivatives_proxy, | ||
55 | 40 | 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 20 times.
✗ Branch 2 not taken.
|
20 | bp::def( |
60 | "getCentroidalDynamicsDerivatives", getCentroidalDynamicsDerivatives_proxy, | ||
61 | 40 | 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 | 20 | } | |
66 | |||
67 | } // namespace python | ||
68 | } // namespace pinocchio | ||
69 |