Directory: | ./ |
---|---|
File: | bindings/python/multibody/sample-models.cpp |
Date: | 2024-08-27 18:20:05 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 29 | 41 | 70.7% |
Branches: | 8 | 22 | 36.4% |
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 | 3 | Model buildSampleModelHumanoidRandom() | |
16 | { | ||
17 | 3 | Model model; | |
18 |
1/2✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
|
3 | buildModels::humanoidRandom(model); |
19 | 3 | return model; | |
20 | } | ||
21 | |||
22 | ✗ | Model buildSampleModelHumanoidRandom(bool usingFF) | |
23 | { | ||
24 | ✗ | Model model; | |
25 | ✗ | buildModels::humanoidRandom(model, usingFF); | |
26 | ✗ | return model; | |
27 | } | ||
28 | |||
29 | 2 | Model buildSampleModelManipulator() | |
30 | { | ||
31 | 2 | Model model; | |
32 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | buildModels::manipulator(model); |
33 | 2 | return model; | |
34 | } | ||
35 | |||
36 | #ifdef PINOCCHIO_WITH_HPP_FCL | ||
37 | ✗ | GeometryModel buildSampleGeometryModelManipulator(const Model & model) | |
38 | { | ||
39 | ✗ | GeometryModel geom; | |
40 | ✗ | buildModels::manipulatorGeometries(model, geom); | |
41 | ✗ | return geom; | |
42 | } | ||
43 | #endif | ||
44 | |||
45 | 1 | Model buildSampleModelHumanoid() | |
46 | { | ||
47 | 1 | Model model; | |
48 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | buildModels::humanoid(model); |
49 | 1 | return model; | |
50 | } | ||
51 | |||
52 | ✗ | Model buildSampleModelHumanoid(bool usingFF) | |
53 | { | ||
54 | ✗ | Model model; | |
55 | ✗ | buildModels::humanoid(model, usingFF); | |
56 | ✗ | return model; | |
57 | } | ||
58 | |||
59 | #ifdef PINOCCHIO_WITH_HPP_FCL | ||
60 | 1 | GeometryModel buildSampleGeometryModelHumanoid(const Model & model) | |
61 | { | ||
62 | 1 | GeometryModel geom; | |
63 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | buildModels::humanoidGeometries(model, geom); |
64 | 1 | return geom; | |
65 | } | ||
66 | #endif | ||
67 | |||
68 | 20 | void exposeSampleModels() | |
69 | { | ||
70 | 20 | bp::def( | |
71 | "buildSampleModelHumanoidRandom", | ||
72 | static_cast<Model (*)()>(pinocchio::python::buildSampleModelHumanoidRandom), | ||
73 | "Generate a (hard-coded) model of a humanoid robot with 6-DOF limbs and random joint " | ||
74 | "placements.\nOnly meant for unit tests."); | ||
75 | |||
76 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 | bp::def( |
77 | "buildSampleModelHumanoidRandom", | ||
78 | static_cast<Model (*)(bool)>(pinocchio::python::buildSampleModelHumanoidRandom), | ||
79 | 40 | bp::args("using_free_flyer"), | |
80 | "Generate a (hard-coded) model of a humanoid robot with 6-DOF limbs and random joint " | ||
81 | "placements.\nOnly meant for unit tests."); | ||
82 | |||
83 | 20 | bp::def( | |
84 | "buildSampleModelManipulator", | ||
85 | static_cast<Model (*)()>(pinocchio::python::buildSampleModelManipulator), | ||
86 | "Generate a (hard-coded) model of a simple manipulator."); | ||
87 | |||
88 | #ifdef PINOCCHIO_WITH_HPP_FCL | ||
89 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 | bp::def( |
90 | "buildSampleGeometryModelManipulator", | ||
91 | static_cast<GeometryModel (*)(const Model &)>( | ||
92 | pinocchio::python::buildSampleGeometryModelManipulator), | ||
93 | 40 | bp::args("model"), "Generate a (hard-coded) geometry model of a simple manipulator."); | |
94 | #endif | ||
95 | |||
96 | 20 | bp::def( | |
97 | "buildSampleModelHumanoid", | ||
98 | static_cast<Model (*)()>(pinocchio::python::buildSampleModelHumanoid), | ||
99 | "Generate a (hard-coded) model of a simple humanoid."); | ||
100 | |||
101 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 | bp::def( |
102 | "buildSampleModelHumanoid", | ||
103 | static_cast<Model (*)(bool)>(pinocchio::python::buildSampleModelHumanoid), | ||
104 | 40 | bp::args("using_free_flyer"), "Generate a (hard-coded) model of a simple humanoid."); | |
105 | |||
106 | #ifdef PINOCCHIO_WITH_HPP_FCL | ||
107 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 | bp::def( |
108 | "buildSampleGeometryModelHumanoid", | ||
109 | static_cast<GeometryModel (*)(const Model &)>( | ||
110 | pinocchio::python::buildSampleGeometryModelHumanoid), | ||
111 | 40 | bp::args("model"), "Generate a (hard-coded) geometry model of a simple humanoid."); | |
112 | #endif | ||
113 | 20 | } | |
114 | } // namespace python | ||
115 | |||
116 | } // namespace pinocchio | ||
117 |