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
9 
10 #include <boost/python.hpp>
11 #include <boost/python/tuple.hpp>
12 
13 namespace pinocchio
14 {
15  namespace python
16  {
17 
18  namespace bp = boost::python;
19 
20 #ifdef PINOCCHIO_WITH_SDFORMAT
21  bp::tuple buildModelFromSdf(
22  const std::string & filename,
23  const std::string & root_link_name,
24  const std::vector<std::string> & parent_guidance)
25  {
26  Model model;
29  filename, model, contact_models, root_link_name, parent_guidance);
30  return bp::make_tuple(model, contact_models);
31  }
32 
33  bp::tuple buildModelFromSdf(
34  const std::string & filename,
35  const JointModel & root_joint,
36  const std::string & root_link_name,
37  const std::vector<std::string> & parent_guidance)
38  {
39  Model model;
42  filename, root_joint, model, contact_models, root_link_name, parent_guidance);
43  return bp::make_tuple(model, contact_models);
44  }
45 
46  bp::tuple buildModelFromSdf(
47  const std::string & filename,
48  const JointModel & root_joint,
49  const std::string & root_link_name,
50  const std::string & root_joint_name,
51  const std::vector<std::string> & parent_guidance)
52  {
53  Model model;
56  filename, root_joint, root_joint_name, model, contact_models, root_link_name,
57  parent_guidance);
58  return bp::make_tuple(model, contact_models);
59  }
60 #endif
61 
63  {
64 #ifdef PINOCCHIO_WITH_SDFORMAT
65  bp::def(
66  "buildModelFromSdf",
67  static_cast<bp::tuple (*)(
68  const std::string &, const std::string &, const std::vector<std::string> &)>(
69  pinocchio::python::buildModelFromSdf),
70  (bp::arg("sdf_filename"), bp::arg("root_link_name"),
71  bp::arg("parent_guidance") = bp::list()),
72  "Parse the SDF file given in input and return a pinocchio Model and constraint models.");
73 
74  bp::def(
75  "buildModelFromSdf",
76  static_cast<bp::tuple (*)(
77  const std::string &, const JointModel &, const std::string &,
78  const std::vector<std::string> &)>(pinocchio::python::buildModelFromSdf),
79  (bp::arg("sdf_filename"), bp::arg("root_joint"), bp::arg("root_link_name"),
80  bp::arg("parent_guidance") = bp::list()),
81  "Parse the SDF file given in input and return a pinocchio Model and constraint "
82  "models starting with the given root joint.");
83 
84  bp::def(
85  "buildModelFromSdf",
86  static_cast<bp::tuple (*)(
87  const std::string &, const JointModel &, const std::string &, const std::string &,
88  const std::vector<std::string> &)>(pinocchio::python::buildModelFromSdf),
89  (bp::arg("sdf_filename"), bp::arg("root_joint"), bp::arg("root_link_name"),
90  bp::arg("root_joint_name"), bp::arg("parent_guidance") = bp::list()),
91  "Parse the SDF file given in input and return a pinocchio Model and constraint "
92  "models starting with the given root joint and its specified name.");
93 #endif
94  }
95  } // namespace python
96 } // namespace pinocchio
boost::python
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::python::buildModel
Model buildModel(const std::string &filename, const std::string &model_name)
Load a model from a Python script.
Definition: bindings/python/parsers/python/model.cpp:23
pinocchio::JointModel
JointModelTpl< context::Scalar > JointModel
Definition: multibody/joint/fwd.hpp:155
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:62
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:1116
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:27


pinocchio
Author(s):
autogenerated on Sat Sep 28 2024 02:41:21