GCC Code Coverage Report


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