GCC Code Coverage Report


Directory: ./
File: bindings/python/multibody/sample-models.cpp
Date: 2025-04-30 16:14:33
Exec Total Coverage
Lines: 32 32 100.0%
Branches: 19 38 50.0%

Line Branch Exec Source
1 //
2 // Copyright (c) 2015-2020 CNRS INRIA
3 //
4
5 #include "pinocchio/multibody/sample-models.hpp"
6
7 #include <boost/python.hpp>
8
9 namespace pinocchio
10 {
11 namespace python
12 {
13 namespace bp = boost::python;
14
15 78 Model buildSampleModelHumanoidRandom(bool usingFF, bool mimic)
16 {
17 78 Model model;
18
1/2
✓ Branch 1 taken 78 times.
✗ Branch 2 not taken.
78 buildModels::humanoidRandom(model, usingFF, mimic);
19 78 return model;
20 }
21
22 9 Model buildSampleModelManipulator(bool mimic)
23 {
24 9 Model model;
25
1/2
✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
9 buildModels::manipulator(model, mimic);
26 9 return model;
27 }
28
29 #ifdef PINOCCHIO_WITH_HPP_FCL
30 1 GeometryModel buildSampleGeometryModelManipulator(const Model & model)
31 {
32 1 GeometryModel geom;
33
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 buildModels::manipulatorGeometries(model, geom);
34 1 return geom;
35 }
36 #endif
37
38 13 Model buildSampleModelHumanoid(bool usingFF)
39 {
40 13 Model model;
41
1/2
✓ Branch 1 taken 13 times.
✗ Branch 2 not taken.
13 buildModels::humanoid(model, usingFF);
42 13 return model;
43 }
44
45 #ifdef PINOCCHIO_WITH_HPP_FCL
46 10 GeometryModel buildSampleGeometryModelHumanoid(const Model & model)
47 {
48 10 GeometryModel geom;
49
1/2
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
10 buildModels::humanoidGeometries(model, geom);
50 10 return geom;
51 }
52 #endif
53
54 72 void exposeSampleModels()
55 {
56
1/2
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
72 bp::def(
57 "buildSampleModelHumanoidRandom",
58 static_cast<Model (*)(bool, bool)>(pinocchio::python::buildSampleModelHumanoidRandom),
59
5/10
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 72 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 72 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 72 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 72 times.
✗ Branch 14 not taken.
144 (bp::arg("using_free_flyer") = true, bp::arg("mimic") = false),
60 "Generate a (hard-coded) model of a humanoid robot with 6-DOF limbs and random joint "
61 "placements.\nOnly meant for unit tests.");
62
63 72 bp::def(
64 "buildSampleModelManipulator",
65 static_cast<Model (*)(bool)>(pinocchio::python::buildSampleModelManipulator),
66
3/6
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 72 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 72 times.
✗ Branch 8 not taken.
72 (bp::arg("mimic") = false), "Generate a (hard-coded) model of a simple manipulator.");
67
68 #ifdef PINOCCHIO_WITH_HPP_FCL
69
1/2
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
72 bp::def(
70 "buildSampleGeometryModelManipulator",
71 static_cast<GeometryModel (*)(const Model &)>(
72 pinocchio::python::buildSampleGeometryModelManipulator),
73 144 bp::args("model"), "Generate a (hard-coded) geometry model of a simple manipulator.");
74 #endif
75
76 72 bp::def(
77 "buildSampleModelHumanoid",
78 static_cast<Model (*)(bool)>(pinocchio::python::buildSampleModelHumanoid),
79
3/6
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 72 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 72 times.
✗ Branch 8 not taken.
72 (bp::arg("using_free_flyer") = true),
80 "Generate a (hard-coded) model of a simple humanoid.");
81
82 #ifdef PINOCCHIO_WITH_HPP_FCL
83
1/2
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
72 bp::def(
84 "buildSampleGeometryModelHumanoid",
85 static_cast<GeometryModel (*)(const Model &)>(
86 pinocchio::python::buildSampleGeometryModelHumanoid),
87 144 bp::args("model"), "Generate a (hard-coded) geometry model of a simple humanoid.");
88 #endif
89 72 }
90 } // namespace python
91
92 } // namespace pinocchio
93