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


pinocchio
Author(s):
autogenerated on Sat Jun 1 2024 02:40:37