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