GCC Code Coverage Report


Directory: ./
File: bindings/python/algorithm/expose-energy.cpp
Date: 2025-04-30 16:14:33
Exec Total Coverage
Lines: 20 20 100.0%
Branches: 12 24 50.0%

Line Branch Exec Source
1 //
2 // Copyright (c) 2015-2020 CNRS INRIA
3 //
4
5 #include "pinocchio/bindings/python/algorithm/algorithms.hpp"
6 #include "pinocchio/algorithm/energy.hpp"
7
8 #include "pinocchio/bindings/python/utils/model-checker.hpp"
9
10 namespace pinocchio
11 {
12 namespace python
13 {
14
15 72 void exposeEnergy()
16 {
17 typedef context::Scalar Scalar;
18 typedef context::VectorXs VectorXs;
19 enum
20 {
21 Options = context::Options
22 };
23
24
1/2
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
72 bp::def(
25 "computeKineticEnergy",
26 &computeKineticEnergy<Scalar, Options, JointCollectionDefaultTpl, VectorXs, VectorXs>,
27
1/2
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
144 bp::args("model", "data", "q", "v"),
28 "Computes the forward kinematics and the kinematic energy of the system for the "
29 "given joint configuration and velocity given as input. The result is accessible "
30 "through data.kinetic_energy.",
31 72 mimic_not_supported_function<>(0));
32
33
1/2
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
72 bp::def(
34 "computeKineticEnergy", &computeKineticEnergy<Scalar, Options, JointCollectionDefaultTpl>,
35
1/2
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
144 bp::args("model", "data"),
36 "Computes the kinematic energy of the system for the "
37 "given joint placement and velocity stored in data. The result is accessible through "
38 "data.kinetic_energy.",
39 72 mimic_not_supported_function<>(0));
40
41
1/2
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
72 bp::def(
42 "computePotentialEnergy",
43 &computePotentialEnergy<Scalar, Options, JointCollectionDefaultTpl, VectorXs>,
44
1/2
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
144 bp::args("model", "data", "q"),
45 "Computes the potential energy of the system for the "
46 "given the joint configuration given as input. The result is accessible through "
47 "data.potential_energy.",
48 72 mimic_not_supported_function<>(0));
49
50
1/2
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
72 bp::def(
51 "computePotentialEnergy",
52 &computePotentialEnergy<Scalar, Options, JointCollectionDefaultTpl>,
53
1/2
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
144 bp::args("model", "data"),
54 "Computes the potential energy of the system for the "
55 "given joint placement stored in data. The result is accessible through "
56 "data.potential_energy.",
57 72 mimic_not_supported_function<>(0));
58
59
1/2
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
72 bp::def(
60 "computeMechanicalEnergy",
61 &computeMechanicalEnergy<Scalar, Options, JointCollectionDefaultTpl, VectorXs, VectorXs>,
62
1/2
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
144 bp::args("model", "data", "q", "v"),
63 "Computes the forward kinematics and the kinematic energy of the system for the "
64 "given joint configuration and velocity given as input. The result is accessible through "
65 "data.mechanical_energy.\n"
66 "A byproduct of this function is the computation of both data.kinetic_energy and "
67 "data.potential_energy too.",
68 72 mimic_not_supported_function<>(0));
69
70
1/2
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
72 bp::def(
71 "computeMechanicalEnergy",
72 &computeMechanicalEnergy<Scalar, Options, JointCollectionDefaultTpl>,
73
1/2
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
144 bp::args("model", "data"),
74 "Computes the mechanical energy of the system for the "
75 "given joint placement and velocity stored in data. The result is accessible through "
76 "data.mechanical_energy.\n"
77 "A byproduct of this function is the computation of both data.kinetic_energy and "
78 "data.potential_energy too.",
79 72 mimic_not_supported_function<>(0));
80 72 }
81
82 } // namespace python
83 } // namespace pinocchio
84