Directory: | ./ |
---|---|
File: | bindings/python/parsers/mjcf/geometry.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) 2015-2022 CNRS 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 | GeometryModel | ||
18 | ✗ | buildGeomFromMJCF(Model & model, const std::string & filename, const GeometryType & type) | |
19 | { | ||
20 | ✗ | GeometryModel geometry_model; | |
21 | ✗ | ::pinocchio::mjcf::buildGeom(model, filename, type, geometry_model); | |
22 | ✗ | return geometry_model; | |
23 | } | ||
24 | |||
25 | ✗ | GeometryModel buildGeomFromMJCF( | |
26 | Model & model, | ||
27 | const std::string & filename, | ||
28 | const GeometryType & type, | ||
29 | ::hpp::fcl::MeshLoaderPtr & meshLoader) | ||
30 | { | ||
31 | ✗ | GeometryModel geometry_model; | |
32 | ✗ | ::pinocchio::mjcf::buildGeom(model, filename, type, geometry_model, meshLoader); | |
33 | ✗ | return geometry_model; | |
34 | } | ||
35 | |||
36 | 20 | void exposeMJCFGeom() | |
37 | { | ||
38 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 | bp::def( |
39 | "buildGeomFromMJCF", | ||
40 | static_cast<GeometryModel (*)(Model &, const std::string &, const GeometryType &)>( | ||
41 | pinocchio::python::buildGeomFromMJCF), | ||
42 | 40 | bp::args("model", "mjcf_filename", "geom_type"), | |
43 | "Parse the Mjcf file given as input looking for the geometry of the given input model and\n" | ||
44 | "return a GeometryModel containing either the collision geometries " | ||
45 | "(GeometryType.COLLISION) or the visual geometries (GeometryType.VISUAL).\n" | ||
46 | "Parameters:\n" | ||
47 | "\tmodel: model of the robot\n" | ||
48 | "\tfilename: path to the mjcf file containing the model of the robot\n" | ||
49 | "\tgeom_type: type of geometry to extract from the mjcf file (either the VISUAL for " | ||
50 | "display or the COLLISION for collision detection).\n"); | ||
51 | |||
52 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 | bp::def( |
53 | "buildGeomFromMJCF", | ||
54 | static_cast<GeometryModel (*)( | ||
55 | Model &, const std::string &, const GeometryType &, ::hpp::fcl::MeshLoaderPtr &)>( | ||
56 | pinocchio::python::buildGeomFromMJCF), | ||
57 | 40 | bp::args("model", "mjcf_filename", "geom_type", "mesh_loader"), | |
58 | "Parse the Mjcf file given as input looking for the geometry of the given input model and\n" | ||
59 | "return a GeometryModel containing either the collision geometries " | ||
60 | "(GeometryType.COLLISION) or the visual geometries (GeometryType.VISUAL).\n" | ||
61 | "Parameters:\n" | ||
62 | "\tmodel: model of the robot\n" | ||
63 | "\tfilename: path to the mjcf file containing the model of the robot\n" | ||
64 | "\tgeom_type: type of geometry to extract from the mjcf file (either the VISUAL for " | ||
65 | "display or the COLLISION for collision detection).\n" | ||
66 | "\tmesh_loader: an hpp-fcl mesh loader (to load only once the related geometries).\n"); | ||
67 | 20 | } | |
68 | } // namespace python | ||
69 | } // namespace pinocchio | ||
70 |