bindings/python/parsers/sdf/model.cpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2021 CNRS INRIA
3 //
4 
5 #ifdef PINOCCHIO_WITH_SDFORMAT
7 #endif
10 
11 #include <boost/python.hpp>
12 #include <boost/python/tuple.hpp>
13 
14 namespace pinocchio
15 {
16  namespace python
17  {
18 
19  namespace bp = boost::python;
20 
21 #ifdef PINOCCHIO_WITH_SDFORMAT
22  bp::tuple buildModelFromSdf(
23  const bp::object & filename,
24  const std::string & root_link_name,
25  const std::vector<std::string> & parent_guidance)
26  {
27  Model model;
30  path(filename), model, contact_models, root_link_name, parent_guidance);
31  return bp::make_tuple(model, contact_models);
32  }
33 
34  bp::tuple buildModelFromSdf(
35  const bp::object & filename,
36  const JointModel & root_joint,
37  const std::string & root_link_name,
38  const std::vector<std::string> & parent_guidance)
39  {
40  Model model;
43  path(filename), root_joint, model, contact_models, root_link_name, parent_guidance);
44  return bp::make_tuple(model, contact_models);
45  }
46 
47  bp::tuple buildModelFromSdf(
48  const bp::object & filename,
49  const JointModel & root_joint,
50  const std::string & root_link_name,
51  const std::string & root_joint_name,
52  const std::vector<std::string> & parent_guidance)
53  {
54  Model model;
57  path(filename), root_joint, root_joint_name, model, contact_models, root_link_name,
58  parent_guidance);
59  return bp::make_tuple(model, contact_models);
60  }
61 #endif
62 
64  {
65 #ifdef PINOCCHIO_WITH_SDFORMAT
66  bp::def(
67  "buildModelFromSdf",
68  static_cast<bp::tuple (*)(
69  const bp::object &, const std::string &, const std::vector<std::string> &)>(
70  pinocchio::python::buildModelFromSdf),
71  (bp::arg("sdf_filename"), bp::arg("root_link_name"),
72  bp::arg("parent_guidance") = bp::list()),
73  "Parse the SDF file given in input and return a pinocchio Model and constraint models.");
74 
75  bp::def(
76  "buildModelFromSdf",
77  static_cast<bp::tuple (*)(
78  const bp::object &, const JointModel &, const std::string &,
79  const std::vector<std::string> &)>(pinocchio::python::buildModelFromSdf),
80  (bp::arg("sdf_filename"), bp::arg("root_joint"), bp::arg("root_link_name"),
81  bp::arg("parent_guidance") = bp::list()),
82  "Parse the SDF file given in input and return a pinocchio Model and constraint "
83  "models starting with the given root joint.");
84 
85  bp::def(
86  "buildModelFromSdf",
87  static_cast<bp::tuple (*)(
88  const bp::object &, const JointModel &, const std::string &, const std::string &,
89  const std::vector<std::string> &)>(pinocchio::python::buildModelFromSdf),
90  (bp::arg("sdf_filename"), bp::arg("root_joint"), bp::arg("root_link_name"),
91  bp::arg("root_joint_name"), bp::arg("parent_guidance") = bp::list()),
92  "Parse the SDF file given in input and return a pinocchio Model and constraint "
93  "models starting with the given root joint and its specified name.");
94 #endif
95  }
96  } // namespace python
97 } // namespace pinocchio
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
sdf.hpp
pinocchio::sdf::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, PINOCCHIO_STD_VECTOR_WITH_EIGEN_ALLOCATOR(RigidConstraintModel) &contact_models, const std::string &rootLinkName="", const std::vector< std::string > &parentGuidance={}, const bool verbose=false)
Build the model from a SDF file with a particular joint as root of the model tree inside the model gi...
sdf.hpp
python
pinocchio::JointModelTpl< context::Scalar >
pinocchio::JointModel
JointModelTpl< context::Scalar > JointModel
Definition: multibody/joint/fwd.hpp:155
pinocchio::mjcf::buildModel
ModelTpl< Scalar, Options, JointCollectionTpl > & buildModel(const std::string &filename, 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::PINOCCHIO_STD_VECTOR_WITH_EIGEN_ALLOCATOR
typedef PINOCCHIO_STD_VECTOR_WITH_EIGEN_ALLOCATOR(context::RigidConstraintModel) RigidConstraintModelVector
pinocchio::RigidConstraintModel
RigidConstraintModelTpl< context::Scalar, context::Options > RigidConstraintModel
Definition: algorithm/fwd.hpp:24
pinocchio::python::exposeSDFModel
void exposeSDFModel()
Definition: bindings/python/parsers/sdf/model.cpp:63
contact-cholesky.contact_models
list contact_models
Definition: contact-cholesky.py:22
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 Thu Dec 19 2024 03:41:31