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.",
107  bp::return_internal_reference<3>()
108  );
109 
110  bp::def("buildModelFromXML",
111  static_cast <Model (*) (const std::string &, const JointModel &)> (pinocchio::python::buildModelFromXML),
112  bp::args("urdf_xml_stream","root_joint"),
113  "Parse the URDF XML stream given in input and return a pinocchio Model starting with the given root joint."
114  );
115 
116  bp::def("buildModelFromXML",
117  static_cast <Model & (*) (const std::string &, const JointModel &, Model &)> (pinocchio::python::buildModelFromXML),
118  bp::args("urdf_xml_stream","root_joint","model"),
119  "Parse the URDF XML stream given in input and append it to the input model with the given interfacing joint.",
120  bp::return_internal_reference<3>()
121  );
122 
123  bp::def("buildModelFromXML",
124  static_cast <Model (*) (const std::string &)> (pinocchio::python::buildModelFromXML),
125  bp::args("urdf_xml_stream"),
126  "Parse the URDF XML stream given in input and return a pinocchio Model."
127  );
128 
129  bp::def("buildModelFromXML",
130  static_cast <Model & (*) (const std::string &, Model &)> (pinocchio::python::buildModelFromXML),
131  bp::args("urdf_xml_stream","model"),
132  "Parse the URDF XML stream given in input and append it to the input model.",
133  bp::return_internal_reference<2>()
134  );
135 #endif
136  }
137  }
138 }
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:30
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 Tue Jun 1 2021 02:45:04