bindings/python/parsers/urdf/model.cpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2015-2020 CNRS INRIA
3 //
4 
5 #ifdef PINOCCHIO_WITH_URDFDOM
7 #endif
8 
11 
12 #include <boost/python.hpp>
13 
14 namespace pinocchio
15 {
16  namespace python
17  {
18 
19  namespace bp = boost::python;
20 
21 #ifdef PINOCCHIO_WITH_URDFDOM
22 
23  Model buildModelFromUrdf(const bp::object & filename, const bool mimic)
24  {
25  Model model;
26  pinocchio::urdf::buildModel(path(filename), model, false, mimic);
27  return model;
28  }
29 
30  Model & buildModelFromUrdf(const bp::object & filename, Model & model, const bool mimic)
31  {
32  return pinocchio::urdf::buildModel(path(filename), model, false, mimic);
33  }
34 
35  Model
36  buildModelFromUrdf(const bp::object & filename, const JointModel & root_joint, const bool mimic)
37  {
38  Model model;
39  pinocchio::urdf::buildModel(path(filename), root_joint, model, false, mimic);
40  return model;
41  }
42 
43  Model buildModelFromUrdf(
44  const bp::object & filename,
45  const JointModel & root_joint,
46  const std::string & root_joint_name,
47  const bool mimic)
48  {
49  Model model;
50  pinocchio::urdf::buildModel(path(filename), root_joint, root_joint_name, model, false, mimic);
51  return model;
52  }
53 
54  Model & buildModelFromUrdf(
55  const bp::object & filename, const JointModel & root_joint, Model & model, const bool mimic)
56  {
57  return pinocchio::urdf::buildModel(path(filename), root_joint, model, false, mimic);
58  }
59 
60  Model & buildModelFromUrdf(
61  const bp::object & filename,
62  const JointModel & root_joint,
63  const std::string & root_joint_name,
64  Model & model,
65  const bool mimic)
66  {
68  path(filename), root_joint, root_joint_name, model, false, mimic);
69  }
70 
72  const std::string & xml_stream, const JointModel & root_joint, const bool mimic)
73  {
74  Model model;
75  pinocchio::urdf::buildModelFromXML(xml_stream, root_joint, model, false, mimic);
76  return model;
77  }
78 
80  const std::string & xml_stream,
81  const JointModel & root_joint,
82  const std::string & root_joint_name,
83  const bool mimic)
84  {
85  Model model;
87  xml_stream, root_joint, root_joint_name, model, false, mimic);
88  return model;
89  }
90 
92  const std::string & xml_stream,
93  const JointModel & root_joint,
94  Model & model,
95  const bool mimic)
96  {
97  pinocchio::urdf::buildModelFromXML(xml_stream, root_joint, model, false, mimic);
98  return model;
99  }
100 
102  const std::string & xml_stream,
103  const JointModel & root_joint,
104  const std::string & root_joint_name,
105  Model & model,
106  const bool mimic)
107  {
109  xml_stream, root_joint, root_joint_name, model, false, mimic);
110  return model;
111  }
112 
113  Model buildModelFromXML(const std::string & xml_stream, const bool mimic)
114  {
115  Model model;
116  pinocchio::urdf::buildModelFromXML(xml_stream, model, false, mimic);
117  return model;
118  }
119 
120  Model & buildModelFromXML(const std::string & xml_stream, Model & model, const bool mimic)
121  {
122  pinocchio::urdf::buildModelFromXML(xml_stream, model, false, mimic);
123  return model;
124  }
125 
126 #endif
127 
129  {
130 
131 #ifdef PINOCCHIO_WITH_URDFDOM
132 
133  bp::def(
134  "buildModelFromUrdf",
135  static_cast<Model (*)(const bp::object &, const JointModel &, const bool)>(
136  pinocchio::python::buildModelFromUrdf),
137  (bp::arg("urdf_filename"), bp::arg("root_joint"), bp::arg("mimic") = false),
138  "Parse the URDF file given in input and return a pinocchio Model starting with the "
139  "given root joint.");
140 
141  bp::def(
142  "buildModelFromUrdf",
143  static_cast<Model (*)(
144  const bp::object &, const JointModel &, const std::string &, const bool)>(
145  pinocchio::python::buildModelFromUrdf),
146  (bp::arg("urdf_filename"), bp::arg("root_joint"), bp::arg("root_joint_name"),
147  bp::arg("mimic") = false),
148  "Parse the URDF file given in input and return a pinocchio Model starting with the "
149  "given root joint with its specified name.");
150 
151  bp::def(
152  "buildModelFromUrdf",
153  static_cast<Model (*)(const bp::object &, const bool)>(
154  pinocchio::python::buildModelFromUrdf),
155  (bp::arg("urdf_filename"), bp::arg("mimic") = false),
156  "Parse the URDF file given in input and return a pinocchio Model.");
157 
158  bp::def(
159  "buildModelFromUrdf",
160  static_cast<Model & (*)(const bp::object &, Model &, const bool)>(
161  pinocchio::python::buildModelFromUrdf),
162  (bp::arg("urdf_filename"), bp::arg("model"), bp::arg("mimic") = false),
163  "Append to a given model a URDF structure given by its filename.",
164  bp::return_internal_reference<2>());
165 
166  bp::def(
167  "buildModelFromUrdf",
168  static_cast<Model & (*)(const bp::object &, const JointModel &, Model &, const bool)>(
169  pinocchio::python::buildModelFromUrdf),
170  (bp::arg("urdf_filename"), bp::arg("root_joint"), bp::arg("model"),
171  bp::arg("mimic") = false),
172  "Append to a given model a URDF structure given by its filename and the root joint.\n"
173  "Remark: In the URDF format, a joint of type fixed can be defined. For efficiency reasons,"
174  "it is treated as operational frame and not as a joint of the model.",
175  bp::return_internal_reference<3>());
176 
177  bp::def(
178  "buildModelFromUrdf",
179  static_cast<Model & (*)(const bp::object &, const JointModel &, const std::string &,
180  Model &, const bool)>(pinocchio::python::buildModelFromUrdf),
181  (bp::arg("urdf_filename"), bp::arg("root_joint"), bp::arg("root_joint_name"),
182  bp::arg("model"), bp::arg("mimic") = false),
183  "Append to a given model a URDF structure given by its filename and the root joint with "
184  "its specified name.\n"
185  "Remark: In the URDF format, a joint of type fixed can be defined. For efficiency reasons,"
186  "it is treated as operational frame and not as a joint of the model.",
187  bp::return_internal_reference<3>());
188 
189  bp::def(
190  "buildModelFromXML",
191  static_cast<Model (*)(const std::string &, const JointModel &, const bool)>(
193  (bp::arg("urdf_xml_stream"), bp::arg("root_joint"), bp::arg("mimic") = false),
194  "Parse the URDF XML stream given in input and return a pinocchio Model starting with "
195  "the given root joint.");
196 
197  bp::def(
198  "buildModelFromXML",
199  static_cast<Model (*)(
200  const std::string &, const JointModel &, const std::string &, const bool)>(
202  (bp::arg("urdf_xml_stream"), bp::arg("root_joint"), bp::arg("root_joint_name"),
203  bp::arg("mimic") = false),
204  "Parse the URDF XML stream given in input and return a pinocchio Model starting with "
205  "the given root joint with its specified name.");
206 
207  bp::def(
208  "buildModelFromXML",
209  static_cast<Model & (*)(const std::string &, const JointModel &, Model &, const bool)>(
211  (bp::arg("urdf_xml_stream"), bp::arg("root_joint"), bp::arg("model"),
212  bp::arg("mimic") = false),
213  "Parse the URDF XML stream given in input and append it to the input model with the "
214  "given interfacing joint.",
215  bp::return_internal_reference<3>());
216 
217  bp::def(
218  "buildModelFromXML",
219  static_cast<Model & (*)(const std::string &, const JointModel &, const std::string &,
221  (bp::arg("urdf_xml_stream"), bp::arg("root_joint"), bp::arg("root_joint_name"),
222  bp::arg("model"), bp::arg("mimic") = false),
223  "Parse the URDF XML stream given in input and append it to the input model with the "
224  "given interfacing joint with its specified name.",
225  bp::return_internal_reference<3>());
226 
227  bp::def(
228  "buildModelFromXML",
229  static_cast<Model (*)(const std::string &, const bool)>(
231  (bp::arg("urdf_xml_stream"), bp::arg("mimic") = false),
232  "Parse the URDF XML stream given in input and return a pinocchio Model.");
233 
234  bp::def(
235  "buildModelFromXML",
236  static_cast<Model & (*)(const std::string &, Model &, const bool)>(
238  (bp::arg("urdf_xml_stream"), bp::arg("model"), bp::arg("mimic") = false),
239  "Parse the URDF XML stream given in input and append it to the input model.",
240  bp::return_internal_reference<2>());
241 #endif
242  }
243  } // namespace python
244 } // namespace pinocchio
pinocchio::mjcf::buildModelFromXML
ModelTpl< Scalar, Options, JointCollectionTpl > & buildModelFromXML(const std::string &xmlStream, ModelTpl< Scalar, Options, JointCollectionTpl > &model, const bool verbose=false)
Build the model from a MJCF file with a fixed joint as root of the model tree.
pinocchio::python::path
std::string path(const bp::object &path)
python pathlib.Path | str -> C++ std::string
Definition: path.cpp:13
boost::python
path.hpp
pinocchio::urdf::buildModelFromXML
ModelTpl< Scalar, Options, JointCollectionTpl > & buildModelFromXML(const std::string &xml_stream, const typename ModelTpl< Scalar, Options, JointCollectionTpl >::JointModel &rootJoint, const std::string &rootJointName, ModelTpl< Scalar, Options, JointCollectionTpl > &model, const bool verbose=false, const bool mimic=false)
Build the model from an XML stream with a particular joint as root of the model tree inside the model...
python
urdf.hpp
pinocchio::JointModelTpl
Definition: multibody/joint/fwd.hpp:169
pinocchio::JointModel
JointModelTpl< context::Scalar > JointModel
Definition: multibody/joint/fwd.hpp:169
pinocchio::python::exposeURDFModel
void exposeURDFModel()
Definition: bindings/python/parsers/urdf/model.cpp:128
pinocchio::ModelTpl< Scalar >
urdf.hpp
pinocchio::model
JointCollectionTpl & model
Definition: joint-configuration.hpp:1082
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:33
pinocchio::urdf::buildModel
ModelTpl< Scalar, Options, JointCollectionTpl > & buildModel(const std::string &filename, const typename ModelTpl< Scalar, Options, JointCollectionTpl >::JointModel &rootJoint, const std::string &rootJointName, ModelTpl< Scalar, Options, JointCollectionTpl > &model, const bool verbose=false, const bool mimic=false)
Build the model from a URDF file with a particular joint as root of the model tree inside the model g...


pinocchio
Author(s):
autogenerated on Wed Apr 16 2025 02:41:50