GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: bindings/python/parsers/sample-models.cpp Lines: 29 41 70.7 %
Date: 2024-01-23 21:41:47 Branches: 8 22 36.4 %

Line Branch Exec Source
1
//
2
// Copyright (c) 2015-2020 CNRS INRIA
3
//
4
5
#include "pinocchio/parsers/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
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
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
      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
      buildModels::humanoidGeometries(model,geom);
64
1
      return geom;
65
    }
66
#endif
67
68
19
    void exposeSampleModels()
69
    {
70
19
      bp::def("buildSampleModelHumanoidRandom",
71
              static_cast <Model (*) ()> (pinocchio::python::buildSampleModelHumanoidRandom),
72
              "Generate a (hard-coded) model of a humanoid robot with 6-DOF limbs and random joint placements.\nOnly meant for unit tests."
73
              );
74
75
19
      bp::def("buildSampleModelHumanoidRandom",
76
              static_cast <Model (*) (bool)> (pinocchio::python::buildSampleModelHumanoidRandom),
77
38
              bp::args("using_free_flyer"),
78
              "Generate a (hard-coded) model of a humanoid robot with 6-DOF limbs and random joint placements.\nOnly meant for unit tests."
79
              );
80
81
19
      bp::def("buildSampleModelManipulator",
82
              static_cast <Model (*) ()> (pinocchio::python::buildSampleModelManipulator),
83
              "Generate a (hard-coded) model of a simple manipulator."
84
              );
85
86
#ifdef PINOCCHIO_WITH_HPP_FCL
87
19
      bp::def("buildSampleGeometryModelManipulator",
88
              static_cast <GeometryModel (*) (const Model&)> (pinocchio::python::buildSampleGeometryModelManipulator),
89
38
              bp::args("model"),
90
              "Generate a (hard-coded) geometry model of a simple manipulator."
91
              );
92
#endif
93
94
19
      bp::def("buildSampleModelHumanoid",
95
              static_cast <Model (*) ()> (pinocchio::python::buildSampleModelHumanoid),
96
              "Generate a (hard-coded) model of a simple humanoid."
97
              );
98
99
19
      bp::def("buildSampleModelHumanoid",
100
              static_cast <Model (*) (bool)> (pinocchio::python::buildSampleModelHumanoid),
101
38
              bp::args("using_free_flyer"),
102
              "Generate a (hard-coded) model of a simple humanoid."
103
              );
104
105
#ifdef PINOCCHIO_WITH_HPP_FCL
106
19
      bp::def("buildSampleGeometryModelHumanoid",
107
              static_cast <GeometryModel (*) (const Model&)> (pinocchio::python::buildSampleGeometryModelHumanoid),
108
38
              bp::args("model"),
109
              "Generate a (hard-coded) geometry model of a simple humanoid."
110
              );
111
#endif
112
113
19
    }
114
  }
115
116
} // namespace pinocchio::python