GCC Code Coverage Report


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

Line Branch Exec Source
1 //
2 // Copyright (c) 2018-2020 CNRS INRIA
3 //
4
5 #include "pinocchio/bindings/python/algorithm/algorithms.hpp"
6 #include "pinocchio/algorithm/regressor.hpp"
7
8 #include "pinocchio/bindings/python/utils/model-checker.hpp"
9
10 namespace pinocchio
11 {
12 namespace python
13 {
14
15 1 context::MatrixXs bodyRegressor_proxy(const context::Motion & v, const context::Motion & a)
16 {
17
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 return bodyRegressor(v, a);
18 }
19
20 1 context::MatrixXs jointBodyRegressor_proxy(
21 const context::Model & model, context::Data & data, const JointIndex jointId)
22 {
23 1 return jointBodyRegressor(model, data, jointId);
24 }
25
26 1 context::MatrixXs frameBodyRegressor_proxy(
27 const context::Model & model, context::Data & data, const FrameIndex frameId)
28 {
29 1 return frameBodyRegressor(model, data, frameId);
30 }
31
32 72 void exposeRegressor()
33 {
34 typedef context::Scalar Scalar;
35 typedef context::VectorXs VectorXs;
36 enum
37 {
38 Options = context::Options
39 };
40
41
1/2
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
72 bp::def(
42 "computeStaticRegressor",
43 &computeStaticRegressor<Scalar, Options, JointCollectionDefaultTpl, VectorXs>,
44
1/2
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
144 bp::args("model", "data", "q"),
45 "Compute the static regressor that links the inertia parameters of the system to its "
46 "center of mass position,\n"
47 "store the result in context::Data and return it.\n\n"
48 "Parameters:\n"
49 "\tmodel: model of the kinematic tree\n"
50 "\tdata: data related to the model\n"
51 "\tq: the joint configuration vector (size model.nq)\n",
52 72 mimic_not_supported_function<bp::return_value_policy<bp::return_by_value>>(0));
53
54
1/2
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
72 bp::def(
55 144 "bodyRegressor", &bodyRegressor_proxy, bp::args("velocity", "acceleration"),
56 "Computes the regressor for the dynamic parameters of a single rigid body.\n"
57 "The result is such that "
58 "Ia + v x Iv = bodyRegressor(v,a) * I.toDynamicParameters()\n\n"
59 "Parameters:\n"
60 "\tvelocity: spatial velocity of the rigid body\n"
61 "\tacceleration: spatial acceleration of the rigid body\n");
62
63
1/2
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
72 bp::def(
64
1/2
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
144 "jointBodyRegressor", &jointBodyRegressor_proxy, bp::args("model", "data", "joint_id"),
65 "Compute the regressor for the dynamic parameters of a rigid body attached to a "
66 "given joint.\n"
67 "This algorithm assumes RNEA has been run to compute the acceleration and "
68 "gravitational effects.\n\n"
69 "Parameters:\n"
70 "\tmodel: model of the kinematic tree\n"
71 "\tdata: data related to the model\n"
72 "\tjoint_id: index of the joint\n",
73 72 mimic_not_supported_function<>(0));
74
75
1/2
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
72 bp::def(
76
1/2
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
144 "frameBodyRegressor", &frameBodyRegressor_proxy, bp::args("model", "data", "frame_id"),
77 "Computes the regressor for the dynamic parameters of a rigid body attached to a "
78 "given frame.\n"
79 "This algorithm assumes RNEA has been run to compute the acceleration and "
80 "gravitational effects.\n\n"
81 "Parameters:\n"
82 "\tmodel: model of the kinematic tree\n"
83 "\tdata: data related to the model\n"
84 "\tframe_id: index of the frame\n",
85 72 mimic_not_supported_function<>(0));
86
87
1/2
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
72 bp::def(
88 "computeJointTorqueRegressor",
89 &computeJointTorqueRegressor<
90 Scalar, Options, JointCollectionDefaultTpl, VectorXs, VectorXs, VectorXs>,
91
1/2
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
144 bp::args("model", "data", "q", "v", "a"),
92 "Compute the joint torque regressor that links the joint torque "
93 "to the dynamic parameters of each link according to the current the robot motion,\n"
94 "store the result in context::Data and return it.\n\n"
95 "Parameters:\n"
96 "\tmodel: model of the kinematic tree\n"
97 "\tdata: data related to the model\n"
98 "\tq: the joint configuration vector (size model.nq)\n"
99 "\tv: the joint velocity vector (size model.nv)\n"
100 "\ta: the joint acceleration vector (size model.nv)\n",
101 72 mimic_not_supported_function<bp::return_value_policy<bp::return_by_value>>(0));
102
103
1/2
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
72 bp::def(
104 "computeKineticEnergyRegressor",
105 &computeKineticEnergyRegressor<
106 Scalar, Options, JointCollectionDefaultTpl, VectorXs, VectorXs>,
107
1/2
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
144 bp::args("model", "data", "q", "v"),
108 "Compute the kinetic energy regressor that links the kinetic energy"
109 "to the dynamic parameters of each link according to the current the robot motion,\n"
110 "store the result in context::Data and return it.\n\n"
111 "Parameters:\n"
112 "\tmodel: model of the kinematic tree\n"
113 "\tdata: data related to the model\n"
114 "\tq: the joint configuration vector (size model.nq)\n"
115 "\tv: the joint velocity vector (size model.nv)\n",
116 72 mimic_not_supported_function<bp::return_value_policy<bp::return_by_value>>(0));
117
118
1/2
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
72 bp::def(
119 "computePotentialEnergyRegressor",
120 &computePotentialEnergyRegressor<Scalar, Options, JointCollectionDefaultTpl, VectorXs>,
121
1/2
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
144 bp::args("model", "data", "q"),
122 "Compute the potential energy regressor that links the potential energy"
123 "to the dynamic parameters of each link according to the current the robot motion,\n"
124 "store the result in context::Data and return it.\n\n"
125 "Parameters:\n"
126 "\tmodel: model of the kinematic tree\n"
127 "\tdata: data related to the model\n"
128 "\tq: the joint configuration vector (size model.nq)\n",
129 72 mimic_not_supported_function<bp::return_value_policy<bp::return_by_value>>(0));
130 72 }
131
132 } // namespace python
133 } // namespace pinocchio
134