GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: bindings/python/parsers/srdf.cpp Lines: 17 20 85.0 %
Date: 2024-04-26 13:14:21 Branches: 10 24 41.7 %

Line Branch Exec Source
1
//
2
// Copyright (c) 2015-2020 CNRS INRIA
3
//
4
5
#include "pinocchio/parsers/srdf.hpp"
6
#include "pinocchio/bindings/python/parsers/srdf.hpp"
7
8
#include <boost/python.hpp>
9
10
namespace pinocchio
11
{
12
  namespace python
13
  {
14
15
    namespace bp = boost::python;
16
17
40
    BOOST_PYTHON_FUNCTION_OVERLOADS(removeCollisionPairs_overload,
18
                                    srdf::removeCollisionPairs,
19
                                    3,4)
20
21
38
    BOOST_PYTHON_FUNCTION_OVERLOADS(removeCollisionPairsFromXML_overload,
22
                                    srdf::removeCollisionPairsFromXML,
23
                                    3,4)
24
25
40
    BOOST_PYTHON_FUNCTION_OVERLOADS(loadReferenceConfigurations_overload,
26
                                    srdf::loadReferenceConfigurations,
27
                                    2,3)
28
29
    void loadReferenceConfigurationsFromXML(Model & model,
30
                                            const std::string & xmlStream,
31
                                            const bool verbose = false)
32
    {
33
      std::istringstream iss (xmlStream);
34
      pinocchio::srdf::loadReferenceConfigurationsFromXML(model, iss, verbose);
35
    }
36
37
38
    BOOST_PYTHON_FUNCTION_OVERLOADS(loadReferenceConfigurationsFromXML_overload,
38
                                    loadReferenceConfigurationsFromXML,
39
                                    2,3)
40
41
38
    BOOST_PYTHON_FUNCTION_OVERLOADS(loadRotorParameters_overload,
42
                                    srdf::loadRotorParameters,
43
                                    2,3)
44
45
19
    void exposeSRDFParser()
46
    {
47
48
19
      bp::def("removeCollisionPairs",
49
              static_cast<void (*)(const Model &, GeometryModel &, const std::string &, const bool)>(&srdf::removeCollisionPairs),
50
38
              removeCollisionPairs_overload(bp::args("model", "geom_model","srdf_filename", "verbose"),
51
                                            "Parse an SRDF file in order to remove some collision pairs for a specific GeometryModel.\n""Parameters:\n"
52
                                            "Parameters:\n"
53
                                            "\tmodel: model of the robot\n"
54
                                            "\tgeom_model: geometry model of the robot\n"
55
                                            "\tsrdf_filename: path to the SRDF file containing the collision pairs to remove\n"
56
                                            "\tverbose: [optional] display to the current terminal some internal information"
57
                                            ));
58
59
19
      bp::def("removeCollisionPairsFromXML",
60
              static_cast<void (*)(const Model &, GeometryModel &, const std::string &, const bool)>(&srdf::removeCollisionPairsFromXML),
61
38
              removeCollisionPairsFromXML_overload(bp::args("model", "geom_model","srdf_xml_stream", "verbose"),
62
                                                   "Parse an SRDF file in order to remove some collision pairs for a specific GeometryModel.\n""Parameters:\n"
63
                                                   "Parameters:\n"
64
                                                   "\tmodel: model of the robot\n"
65
                                                   "\tgeom_model: geometry model of the robot\n"
66
                                                   "\tsrdf_xml_stream: XML stream containing the SRDF information with the collision pairs to remove\n"
67
                                                   "\tverbose: [optional] display to the current terminal some internal information"
68
                                                   ));
69
70
19
      bp::def("loadReferenceConfigurations",
71
              static_cast<void (*)(Model &, const std::string &, const bool)>(&srdf::loadReferenceConfigurations),
72
38
              loadReferenceConfigurations_overload(bp::args("model","srdf_filename","verbose"),
73
                                                   "Retrieve all the reference configurations of a given model from the SRDF file.\n"
74
                                                   "Parameters:\n"
75
                                                   "\tmodel: model of the robot\n"
76
                                                   "\tsrdf_filename: path to the SRDF file containing the reference configurations\n"
77
                                                   "\tverbose: [optional] display to the current terminal some internal information"
78
                                                   ));
79
80
19
      bp::def("loadReferenceConfigurationsFromXML",
81
              static_cast<void (*)(Model &, const std::string &, const bool)>(&srdf::loadReferenceConfigurations),
82
38
              loadReferenceConfigurationsFromXML_overload(bp::args("model","srdf_xml_stream","verbose"),
83
                                                          "Retrieve all the reference configurations of a given model from the SRDF file.\n"
84
                                                          "Parameters:\n"
85
                                                          "\tmodel: model of the robot\n"
86
                                                          "\tsrdf_xml_stream: XML stream containing the SRDF information with the reference configurations\n"
87
                                                          "\tverbose: [optional] display to the current terminal some internal information"
88
                                                          ));
89
90
19
      bp::def("loadRotorParameters",
91
              static_cast<bool (*)(Model &, const std::string &, const bool)>(&srdf::loadRotorParameters),
92
38
              loadRotorParameters_overload(bp::args("model","srdf_filename","verbose"),
93
                                           "Load the rotor parameters of a given model from a SRDF file.\n"
94
                                           "Results are stored in model.rotorInertia and model.rotorGearRatio."
95
                                           "Parameters:\n"
96
                                           "\tmodel: model of the robot\n"
97
                                           "\tsrdf_filename: path to the SRDF file containing the rotor parameters\n"
98
                                           "\tverbose: [optional] display to the current terminal some internal information"
99
                                           ));
100
19
    }
101
  }
102
}