Directory: | ./ |
---|---|
File: | bindings/python/parsers/mjcf/model.cpp |
Date: | 2024-08-27 18:20:05 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 6 | 14 | 42.9% |
Branches: | 2 | 8 | 25.0% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | // | ||
2 | // Copyright (c) 2024 INRIA | ||
3 | // | ||
4 | |||
5 | #include "pinocchio/parsers/mjcf.hpp" | ||
6 | #include "pinocchio/bindings/python/parsers/mjcf.hpp" | ||
7 | |||
8 | #include <boost/python.hpp> | ||
9 | |||
10 | namespace pinocchio | ||
11 | { | ||
12 | namespace python | ||
13 | { | ||
14 | |||
15 | namespace bp = boost::python; | ||
16 | |||
17 | ✗ | Model buildModelFromMJCF(const std::string & filename) | |
18 | { | ||
19 | ✗ | Model model; | |
20 | ✗ | ::pinocchio::mjcf::buildModel(filename, model); | |
21 | ✗ | return model; | |
22 | } | ||
23 | |||
24 | ✗ | Model buildModelFromMJCF(const std::string & filename, const JointModel & root_joint) | |
25 | { | ||
26 | ✗ | Model model; | |
27 | ✗ | ::pinocchio::mjcf::buildModel(filename, root_joint, model); | |
28 | ✗ | return model; | |
29 | } | ||
30 | |||
31 | 20 | void exposeMJCFModel() | |
32 | { | ||
33 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 | bp::def( |
34 | "buildModelFromMJCF", | ||
35 | static_cast<Model (*)(const std::string &)>(pinocchio::python::buildModelFromMJCF), | ||
36 | 40 | bp::args("mjcf_filename"), | |
37 | "Parse the MJCF file given in input and return a pinocchio Model."); | ||
38 | |||
39 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 | bp::def( |
40 | "buildModelFromMJCF", | ||
41 | static_cast<Model (*)(const std::string &, const JointModel &)>( | ||
42 | pinocchio::python::buildModelFromMJCF), | ||
43 | 40 | bp::args("mjcf_filename", "root_joint"), | |
44 | "Parse the MJCF file and return a pinocchio Model with the given root Joint."); | ||
45 | 20 | } | |
46 | } // namespace python | ||
47 | } // namespace pinocchio | ||
48 |