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 #endif
46 
48  {
49 #ifdef PINOCCHIO_WITH_SDFORMAT
50  bp::def(
51  "buildModelFromSdf",
52  static_cast<bp::tuple (*)(
53  const std::string &, const std::string &, const std::vector<std::string> &)>(
54  pinocchio::python::buildModelFromSdf),
55  (bp::arg("sdf_filename"), bp::arg("root_link_name"),
56  bp::arg("parent_guidance") = bp::list()),
57  "Parse the SDF file given in input and return a pinocchio Model and constraint models.");
58 
59  bp::def(
60  "buildModelFromSdf",
61  static_cast<bp::tuple (*)(
62  const std::string &, const JointModel &, const std::string &,
63  const std::vector<std::string> &)>(pinocchio::python::buildModelFromSdf),
64  (bp::arg("sdf_filename"), bp::arg("root_joint"), bp::arg("root_link_name"),
65  bp::arg("parent_guidance") = bp::list()),
66  "Parse the SDF file given in input and return a pinocchio Model and constraint "
67  "models starting with the given root joint.");
68 #endif
69  }
70  } // namespace python
71 } // namespace pinocchio
boost::python
pinocchio::sdf::buildModel
ModelTpl< Scalar, Options, JointCollectionTpl > & buildModel(const std::string &filename, const typename ModelTpl< Scalar, Options, JointCollectionTpl >::JointModel &rootJoint, 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
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:47
contact-cholesky.contact_models
list contact_models
Definition: contact-cholesky.py:25
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 Wed Jun 19 2024 02:41:15