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)
24  {
25  Model model;
27  return model;
28  }
29 
30  Model & buildModelFromUrdf(const bp::object & filename, Model & model)
31  {
32  return pinocchio::urdf::buildModel(path(filename), model);
33  }
34 
35  Model buildModelFromUrdf(const bp::object & filename, const JointModel & root_joint)
36  {
37  Model model;
38  pinocchio::urdf::buildModel(path(filename), root_joint, model);
39  return model;
40  }
41 
42  Model buildModelFromUrdf(
43  const bp::object & filename,
44  const JointModel & root_joint,
45  const std::string & root_joint_name)
46  {
47  Model model;
48  pinocchio::urdf::buildModel(path(filename), root_joint, root_joint_name, model);
49  return model;
50  }
51 
52  Model &
53  buildModelFromUrdf(const bp::object & filename, const JointModel & root_joint, Model & model)
54  {
55  return pinocchio::urdf::buildModel(path(filename), root_joint, model);
56  }
57 
58  Model & buildModelFromUrdf(
59  const bp::object & filename,
60  const JointModel & root_joint,
61  const std::string & root_joint_name,
62  Model & model)
63  {
64  return pinocchio::urdf::buildModel(path(filename), root_joint, root_joint_name, model);
65  }
66 
67  Model buildModelFromXML(const std::string & xml_stream, const JointModel & root_joint)
68  {
69  Model model;
70  pinocchio::urdf::buildModelFromXML(xml_stream, root_joint, model);
71  return model;
72  }
73 
75  const std::string & xml_stream,
76  const JointModel & root_joint,
77  const std::string & root_joint_name)
78  {
79  Model model;
80  pinocchio::urdf::buildModelFromXML(xml_stream, root_joint, root_joint_name, model);
81  return model;
82  }
83 
84  Model &
85  buildModelFromXML(const std::string & xml_stream, const JointModel & root_joint, Model & model)
86  {
87  pinocchio::urdf::buildModelFromXML(xml_stream, root_joint, model);
88  return model;
89  }
90 
92  const std::string & xml_stream,
93  const JointModel & root_joint,
94  const std::string & root_joint_name,
95  Model & model)
96  {
97  pinocchio::urdf::buildModelFromXML(xml_stream, root_joint, root_joint_name, model);
98  return model;
99  }
100 
101  Model buildModelFromXML(const std::string & xml_stream)
102  {
103  Model model;
105  return model;
106  }
107 
108  Model & buildModelFromXML(const std::string & xml_stream, Model & model)
109  {
111  return model;
112  }
113 
114 #endif
115 
117  {
118 
119 #ifdef PINOCCHIO_WITH_URDFDOM
120 
121  bp::def(
122  "buildModelFromUrdf",
123  static_cast<Model (*)(const bp::object &, const JointModel &)>(
124  pinocchio::python::buildModelFromUrdf),
125  bp::args("urdf_filename", "root_joint"),
126  "Parse the URDF file given in input and return a pinocchio Model starting with the "
127  "given root joint.");
128 
129  bp::def(
130  "buildModelFromUrdf",
131  static_cast<Model (*)(const bp::object &, const JointModel &, const std::string &)>(
132  pinocchio::python::buildModelFromUrdf),
133  bp::args("urdf_filename", "root_joint", "root_joint_name"),
134  "Parse the URDF file given in input and return a pinocchio Model starting with the "
135  "given root joint with its specified name.");
136 
137  bp::def(
138  "buildModelFromUrdf",
139  static_cast<Model (*)(const bp::object &)>(pinocchio::python::buildModelFromUrdf),
140  bp::args("urdf_filename"),
141  "Parse the URDF file given in input and return a pinocchio Model.");
142 
143  bp::def(
144  "buildModelFromUrdf",
145  static_cast<Model & (*)(const bp::object &, Model &)>(
146  pinocchio::python::buildModelFromUrdf),
147  bp::args("urdf_filename", "model"),
148  "Append to a given model a URDF structure given by its filename.",
149  bp::return_internal_reference<2>());
150 
151  bp::def(
152  "buildModelFromUrdf",
153  static_cast<Model & (*)(const bp::object &, const JointModel &, Model &)>(
154  pinocchio::python::buildModelFromUrdf),
155  bp::args("urdf_filename", "root_joint", "model"),
156  "Append to a given model a URDF structure given by its filename and the root joint.\n"
157  "Remark: In the URDF format, a joint of type fixed can be defined. For efficiency reasons,"
158  "it is treated as operational frame and not as a joint of the model.",
159  bp::return_internal_reference<3>());
160 
161  bp::def(
162  "buildModelFromUrdf",
163  static_cast<Model & (*)(const bp::object &, const JointModel &, const std::string &,
164  Model &)>(pinocchio::python::buildModelFromUrdf),
165  bp::args("urdf_filename", "root_joint", "root_joint_name", "model"),
166  "Append to a given model a URDF structure given by its filename and the root joint with "
167  "its specified name.\n"
168  "Remark: In the URDF format, a joint of type fixed can be defined. For efficiency reasons,"
169  "it is treated as operational frame and not as a joint of the model.",
170  bp::return_internal_reference<3>());
171 
172  bp::def(
173  "buildModelFromXML",
174  static_cast<Model (*)(const std::string &, const JointModel &)>(
176  bp::args("urdf_xml_stream", "root_joint"),
177  "Parse the URDF XML stream given in input and return a pinocchio Model starting with "
178  "the given root joint.");
179 
180  bp::def(
181  "buildModelFromXML",
182  static_cast<Model (*)(const std::string &, const JointModel &, const std::string &)>(
184  bp::args("urdf_xml_stream", "root_joint", "root_joint_name"),
185  "Parse the URDF XML stream given in input and return a pinocchio Model starting with "
186  "the given root joint with its specified name.");
187 
188  bp::def(
189  "buildModelFromXML",
190  static_cast<Model & (*)(const std::string &, const JointModel &, Model &)>(
192  bp::args("urdf_xml_stream", "root_joint", "model"),
193  "Parse the URDF XML stream given in input and append it to the input model with the "
194  "given interfacing joint.",
195  bp::return_internal_reference<3>());
196 
197  bp::def(
198  "buildModelFromXML",
199  static_cast<Model & (*)(const std::string &, const JointModel &, const std::string &,
201  bp::args("urdf_xml_stream", "root_joint", "root_joint_name", "model"),
202  "Parse the URDF XML stream given in input and append it to the input model with the "
203  "given interfacing joint with its specified name.",
204  bp::return_internal_reference<3>());
205 
206  bp::def(
207  "buildModelFromXML",
208  static_cast<Model (*)(const std::string &)>(pinocchio::python::buildModelFromXML),
209  bp::args("urdf_xml_stream"),
210  "Parse the URDF XML stream given in input and return a pinocchio Model.");
211 
212  bp::def(
213  "buildModelFromXML",
214  static_cast<Model & (*)(const std::string &, Model &)>(
216  bp::args("urdf_xml_stream", "model"),
217  "Parse the URDF XML stream given in input and append it to the input model.",
218  bp::return_internal_reference<2>());
219 #endif
220  }
221  } // namespace python
222 } // 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)
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< context::Scalar >
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)
Build the model from a URDF file with a particular joint as root of the model tree inside the model g...
pinocchio::JointModel
JointModelTpl< context::Scalar > JointModel
Definition: multibody/joint/fwd.hpp:155
pinocchio::python::exposeURDFModel
void exposeURDFModel()
Definition: bindings/python/parsers/urdf/model.cpp:116
pinocchio::ModelTpl
Definition: context/generic.hpp:20
urdf.hpp
pinocchio::Model
ModelTpl< context::Scalar, context::Options > Model
Definition: multibody/fwd.hpp:33
pinocchio::model
JointCollectionTpl & model
Definition: joint-configuration.hpp:1082
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:27


pinocchio
Author(s):
autogenerated on Fri Nov 1 2024 02:41:47