1 |
|
|
// |
2 |
|
|
// Copyright (c) 2015-2020 CNRS INRIA |
3 |
|
|
// |
4 |
|
|
|
5 |
|
|
#include "pinocchio/parsers/urdf.hpp" |
6 |
|
|
#include "pinocchio/bindings/python/parsers/urdf.hpp" |
7 |
|
|
|
8 |
|
|
#include <boost/python.hpp> |
9 |
|
|
|
10 |
|
|
namespace pinocchio |
11 |
|
|
{ |
12 |
|
|
namespace python |
13 |
|
|
{ |
14 |
|
|
|
15 |
|
|
namespace bp = boost::python; |
16 |
|
|
|
17 |
|
|
#ifdef PINOCCHIO_WITH_URDFDOM |
18 |
|
|
|
19 |
|
6 |
Model buildModelFromUrdf(const std::string & filename) |
20 |
|
|
{ |
21 |
|
6 |
Model model; |
22 |
✓✗ |
6 |
pinocchio::urdf::buildModel(filename, model); |
23 |
|
6 |
return model; |
24 |
|
|
} |
25 |
|
|
|
26 |
|
|
Model & buildModelFromUrdf(const std::string & filename, |
27 |
|
|
Model & model) |
28 |
|
|
{ |
29 |
|
|
return pinocchio::urdf::buildModel(filename, model); |
30 |
|
|
} |
31 |
|
|
|
32 |
|
6 |
Model buildModelFromUrdf(const std::string & filename, |
33 |
|
|
const JointModel & root_joint) |
34 |
|
|
{ |
35 |
|
6 |
Model model; |
36 |
✓✗ |
6 |
pinocchio::urdf::buildModel(filename, root_joint, model); |
37 |
|
6 |
return model; |
38 |
|
|
} |
39 |
|
|
|
40 |
|
|
Model & buildModelFromUrdf(const std::string & filename, |
41 |
|
|
const JointModel & root_joint, |
42 |
|
|
Model & model) |
43 |
|
|
{ |
44 |
|
|
return pinocchio::urdf::buildModel(filename, root_joint, model); |
45 |
|
|
} |
46 |
|
|
|
47 |
|
|
Model buildModelFromXML(const std::string & XMLstream, |
48 |
|
|
const JointModel & root_joint) |
49 |
|
|
{ |
50 |
|
|
Model model; |
51 |
|
|
pinocchio::urdf::buildModelFromXML(XMLstream, root_joint, model); |
52 |
|
|
return model; |
53 |
|
|
} |
54 |
|
|
|
55 |
|
|
Model & buildModelFromXML(const std::string & XMLstream, |
56 |
|
|
const JointModel & root_joint, |
57 |
|
|
Model & model) |
58 |
|
|
{ |
59 |
|
|
pinocchio::urdf::buildModelFromXML(XMLstream, root_joint, model); |
60 |
|
|
return model; |
61 |
|
|
} |
62 |
|
|
|
63 |
|
|
Model buildModelFromXML(const std::string & XMLstream) |
64 |
|
|
{ |
65 |
|
|
Model model; |
66 |
|
|
pinocchio::urdf::buildModelFromXML(XMLstream, model); |
67 |
|
|
return model; |
68 |
|
|
} |
69 |
|
|
|
70 |
|
|
Model & buildModelFromXML(const std::string & XMLstream, |
71 |
|
|
Model & model) |
72 |
|
|
{ |
73 |
|
|
pinocchio::urdf::buildModelFromXML(XMLstream, model); |
74 |
|
|
return model; |
75 |
|
|
} |
76 |
|
|
|
77 |
|
|
#endif |
78 |
|
|
|
79 |
|
19 |
void exposeURDFModel() |
80 |
|
|
{ |
81 |
|
|
|
82 |
|
|
#ifdef PINOCCHIO_WITH_URDFDOM |
83 |
|
|
|
84 |
✓✗ |
19 |
bp::def("buildModelFromUrdf", |
85 |
|
|
static_cast <Model (*) (const std::string &, const JointModel &)> (pinocchio::python::buildModelFromUrdf), |
86 |
|
38 |
bp::args("urdf_filename","root_joint"), |
87 |
|
|
"Parse the URDF file given in input and return a pinocchio Model starting with the given root joint." |
88 |
|
|
); |
89 |
|
|
|
90 |
✓✗ |
19 |
bp::def("buildModelFromUrdf", |
91 |
|
|
static_cast <Model (*) (const std::string &)> (pinocchio::python::buildModelFromUrdf), |
92 |
|
38 |
bp::args("urdf_filename"), |
93 |
|
|
"Parse the URDF file given in input and return a pinocchio Model." |
94 |
|
|
); |
95 |
|
|
|
96 |
✓✗ |
19 |
bp::def("buildModelFromUrdf", |
97 |
|
|
static_cast <Model & (*) (const std::string &, Model &)> (pinocchio::python::buildModelFromUrdf), |
98 |
✓✗ |
38 |
bp::args("urdf_filename","model"), |
99 |
|
|
"Append to a given model a URDF structure given by its filename.", |
100 |
|
|
bp::return_internal_reference<2>() |
101 |
|
|
); |
102 |
|
|
|
103 |
✓✗ |
19 |
bp::def("buildModelFromUrdf", |
104 |
|
|
static_cast <Model & (*) (const std::string &, const JointModel &, Model &)> (pinocchio::python::buildModelFromUrdf), |
105 |
✓✗ |
38 |
bp::args("urdf_filename","root_joint","model"), |
106 |
|
|
"Append to a given model a URDF structure given by its filename and the root joint.\n" |
107 |
|
|
"Remark: In the URDF format, a joint of type fixed can be defined. For efficiency reasons," |
108 |
|
|
"it is treated as operational frame and not as a joint of the model.", |
109 |
|
|
bp::return_internal_reference<3>() |
110 |
|
|
); |
111 |
|
|
|
112 |
✓✗ |
19 |
bp::def("buildModelFromXML", |
113 |
|
|
static_cast <Model (*) (const std::string &, const JointModel &)> (pinocchio::python::buildModelFromXML), |
114 |
|
38 |
bp::args("urdf_xml_stream","root_joint"), |
115 |
|
|
"Parse the URDF XML stream given in input and return a pinocchio Model starting with the given root joint." |
116 |
|
|
); |
117 |
|
|
|
118 |
✓✗ |
19 |
bp::def("buildModelFromXML", |
119 |
|
|
static_cast <Model & (*) (const std::string &, const JointModel &, Model &)> (pinocchio::python::buildModelFromXML), |
120 |
✓✗ |
38 |
bp::args("urdf_xml_stream","root_joint","model"), |
121 |
|
|
"Parse the URDF XML stream given in input and append it to the input model with the given interfacing joint.", |
122 |
|
|
bp::return_internal_reference<3>() |
123 |
|
|
); |
124 |
|
|
|
125 |
✓✗ |
19 |
bp::def("buildModelFromXML", |
126 |
|
|
static_cast <Model (*) (const std::string &)> (pinocchio::python::buildModelFromXML), |
127 |
|
38 |
bp::args("urdf_xml_stream"), |
128 |
|
|
"Parse the URDF XML stream given in input and return a pinocchio Model." |
129 |
|
|
); |
130 |
|
|
|
131 |
✓✗ |
19 |
bp::def("buildModelFromXML", |
132 |
|
|
static_cast <Model & (*) (const std::string &, Model &)> (pinocchio::python::buildModelFromXML), |
133 |
✓✗ |
38 |
bp::args("urdf_xml_stream","model"), |
134 |
|
|
"Parse the URDF XML stream given in input and append it to the input model.", |
135 |
|
19 |
bp::return_internal_reference<2>() |
136 |
|
|
); |
137 |
|
|
#endif |
138 |
|
19 |
} |
139 |
|
|
} |
140 |
|
|
} |