bindings
python
parsers
mjcf
bindings/python/parsers/mjcf/model.cpp
Go to the documentation of this file.
1
//
2
// Copyright (c) 2024 INRIA
3
//
4
5
#include "
pinocchio/parsers/mjcf.hpp
"
6
#include "
pinocchio/bindings/python/parsers/mjcf.hpp
"
7
#include "
pinocchio/bindings/python/utils/path.hpp
"
8
9
#include <boost/python.hpp>
10
11
namespace
pinocchio
12
{
13
namespace
python
14
{
15
16
namespace
bp
=
boost::python
;
17
18
Model
buildModelFromMJCF
(
const
bp::object & filename)
19
{
20
Model
model
;
21
::pinocchio::mjcf::buildModel
(
path
(
filename
),
model
);
22
return
model
;
23
}
24
25
Model
buildModelFromMJCF
(
const
bp::object & filename,
const
JointModel
& root_joint)
26
{
27
Model
model
;
28
::pinocchio::mjcf::buildModel
(
path
(
filename
), root_joint,
model
);
29
return
model
;
30
}
31
32
bp::tuple
buildModelFromMJCF
(
33
const
bp::object & filename,
34
const
JointModel
& root_joint,
35
const
std::string & root_joint_name)
36
{
37
Model
model
;
38
PINOCCHIO_STD_VECTOR_WITH_EIGEN_ALLOCATOR
(
RigidConstraintModel
)
contact_models
;
39
::pinocchio::mjcf::buildModel
(
40
path
(
filename
), root_joint, root_joint_name,
model
,
contact_models
);
41
return
bp::make_tuple(
model
,
contact_models
);
42
}
43
44
void
exposeMJCFModel
()
45
{
46
bp::def(
47
"buildModelFromMJCF"
,
48
static_cast<
Model
(*)(
const
bp::object &)
>
(
pinocchio::python::buildModelFromMJCF
),
49
bp::args(
"mjcf_filename"
),
50
"Parse the MJCF file given in input and return a pinocchio Model."
);
51
52
bp::def(
53
"buildModelFromMJCF"
,
54
static_cast<
Model
(*)(
const
bp::object &,
const
JointModel
&)
>
(
55
pinocchio::python::buildModelFromMJCF
),
56
bp::args(
"mjcf_filename"
,
"root_joint"
),
57
"Parse the MJCF file and return a pinocchio Model with the given root Joint."
);
58
59
bp::def(
60
"buildModelFromMJCF"
,
61
static_cast<
bp::tuple (*)(
const
bp::object &,
const
JointModel
&,
const
std::string &)
>
(
62
pinocchio::python::buildModelFromMJCF
),
63
bp::args(
"mjcf_filename"
,
"root_joint"
,
"root_joint_name"
),
64
"Parse the MJCF file and return a pinocchio Model with the given root Joint and its "
65
"specified name as well as a constraint list if some are present in the MJCF file."
);
66
}
67
}
// namespace python
68
}
// 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
mjcf.hpp
pinocchio::RigidConstraintModelTpl
Definition:
algorithm/constraints/fwd.hpp:14
filename
filename
python
pinocchio::JointModelTpl< context::Scalar >
mjcf.hpp
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::python::buildModelFromMJCF
Model buildModelFromMJCF(const bp::object &filename)
Definition:
bindings/python/parsers/mjcf/model.cpp:18
pinocchio::python::exposeMJCFModel
void exposeMJCFModel()
Definition:
bindings/python/parsers/mjcf/model.cpp:44
pinocchio::python::PINOCCHIO_STD_VECTOR_WITH_EIGEN_ALLOCATOR
typedef PINOCCHIO_STD_VECTOR_WITH_EIGEN_ALLOCATOR(context::RigidConstraintModel) RigidConstraintModelVector
contact-cholesky.contact_models
list contact_models
Definition:
contact-cholesky.py:22
pinocchio::ModelTpl
Definition:
context/generic.hpp:20
pinocchio::model
JointCollectionTpl & model
Definition:
joint-configuration.hpp:1082
pinocchio
Main pinocchio namespace.
Definition:
timings.cpp:27
pinocchio
Author(s):
autogenerated on Fri Nov 1 2024 02:41:47