bindings/python/parsers/urdf/model.cpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2015-2020 CNRS INRIA
3 //
4 
5 #include "pinocchio/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  Model buildModelFromUrdf(const std::string & filename)
20  {
21  Model model;
22  pinocchio::urdf::buildModel(filename, model);
23  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  Model buildModelFromUrdf(const std::string & filename,
33  const JointModel & root_joint)
34  {
35  Model model;
36  pinocchio::urdf::buildModel(filename, root_joint, model);
37  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 
80  {
81 
82 #ifdef PINOCCHIO_WITH_URDFDOM
83 
84  bp::def("buildModelFromUrdf",
85  static_cast <Model (*) (const std::string &, const JointModel &)> (pinocchio::python::buildModelFromUrdf),
86  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  bp::def("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 
96  bp::def("buildModelFromUrdf",
97  static_cast <Model & (*) (const std::string &, Model &)> (pinocchio::python::buildModelFromUrdf),
98  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  bp::def("buildModelFromUrdf",
104  static_cast <Model & (*) (const std::string &, const JointModel &, Model &)> (pinocchio::python::buildModelFromUrdf),
105  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  bp::def("buildModelFromXML",
113  static_cast <Model (*) (const std::string &, const JointModel &)> (pinocchio::python::buildModelFromXML),
114  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  bp::def("buildModelFromXML",
119  static_cast <Model & (*) (const std::string &, const JointModel &, Model &)> (pinocchio::python::buildModelFromXML),
120  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  bp::def("buildModelFromXML",
126  static_cast <Model (*) (const std::string &)> (pinocchio::python::buildModelFromXML),
127  bp::args("urdf_xml_stream"),
128  "Parse the URDF XML stream given in input and return a pinocchio Model."
129  );
130 
131  bp::def("buildModelFromXML",
132  static_cast <Model & (*) (const std::string &, Model &)> (pinocchio::python::buildModelFromXML),
133  bp::args("urdf_xml_stream","model"),
134  "Parse the URDF XML stream given in input and append it to the input model.",
135  bp::return_internal_reference<2>()
136  );
137 #endif
138  }
139  }
140 }
ModelTpl< double > Model
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...
Main pinocchio namespace.
Definition: timings.cpp:28
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...
JointModelTpl< double > JointModel
JointCollectionTpl & model


pinocchio
Author(s):
autogenerated on Fri Jun 23 2023 02:38:32