| Directory: | ./ |
|---|---|
| File: | bindings/python/multibody/sample-models.cpp |
| Date: | 2025-02-12 21:03:38 |
| Exec | Total | Coverage | |
|---|---|---|---|
| Lines: | 41 | 41 | 100.0% |
| Branches: | 11 | 22 | 50.0% |
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // | ||
| 2 | // Copyright (c) 2015-2020 CNRS INRIA | ||
| 3 | // | ||
| 4 | |||
| 5 | #include "pinocchio/multibody/sample-models.hpp" | ||
| 6 | |||
| 7 | #include <boost/python.hpp> | ||
| 8 | |||
| 9 | namespace pinocchio | ||
| 10 | { | ||
| 11 | namespace python | ||
| 12 | { | ||
| 13 | namespace bp = boost::python; | ||
| 14 | |||
| 15 | 75 | Model buildSampleModelHumanoidRandom() | |
| 16 | { | ||
| 17 | 75 | Model model; | |
| 18 |
1/2✓ Branch 1 taken 75 times.
✗ Branch 2 not taken.
|
75 | buildModels::humanoidRandom(model); |
| 19 | 75 | return model; | |
| 20 | } | ||
| 21 | |||
| 22 | 2 | Model buildSampleModelHumanoidRandom(bool usingFF) | |
| 23 | { | ||
| 24 | 2 | Model model; | |
| 25 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | buildModels::humanoidRandom(model, usingFF); |
| 26 | 2 | return model; | |
| 27 | } | ||
| 28 | |||
| 29 | 6 | Model buildSampleModelManipulator() | |
| 30 | { | ||
| 31 | 6 | Model model; | |
| 32 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
6 | buildModels::manipulator(model); |
| 33 | 6 | return model; | |
| 34 | } | ||
| 35 | |||
| 36 | #ifdef PINOCCHIO_WITH_HPP_FCL | ||
| 37 | 1 | GeometryModel buildSampleGeometryModelManipulator(const Model & model) | |
| 38 | { | ||
| 39 | 1 | GeometryModel geom; | |
| 40 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | buildModels::manipulatorGeometries(model, geom); |
| 41 | 1 | return geom; | |
| 42 | } | ||
| 43 | #endif | ||
| 44 | |||
| 45 | 11 | Model buildSampleModelHumanoid() | |
| 46 | { | ||
| 47 | 11 | Model model; | |
| 48 |
1/2✓ Branch 1 taken 11 times.
✗ Branch 2 not taken.
|
11 | buildModels::humanoid(model); |
| 49 | 11 | return model; | |
| 50 | } | ||
| 51 | |||
| 52 | 2 | Model buildSampleModelHumanoid(bool usingFF) | |
| 53 | { | ||
| 54 | 2 | Model model; | |
| 55 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | buildModels::humanoid(model, usingFF); |
| 56 | 2 | return model; | |
| 57 | } | ||
| 58 | |||
| 59 | #ifdef PINOCCHIO_WITH_HPP_FCL | ||
| 60 | 10 | GeometryModel buildSampleGeometryModelHumanoid(const Model & model) | |
| 61 | { | ||
| 62 | 10 | GeometryModel geom; | |
| 63 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | buildModels::humanoidGeometries(model, geom); |
| 64 | 10 | return geom; | |
| 65 | } | ||
| 66 | #endif | ||
| 67 | |||
| 68 | 69 | void exposeSampleModels() | |
| 69 | { | ||
| 70 | 69 | bp::def( | |
| 71 | "buildSampleModelHumanoidRandom", | ||
| 72 | static_cast<Model (*)()>(pinocchio::python::buildSampleModelHumanoidRandom), | ||
| 73 | "Generate a (hard-coded) model of a humanoid robot with 6-DOF limbs and random joint " | ||
| 74 | "placements.\nOnly meant for unit tests."); | ||
| 75 | |||
| 76 |
1/2✓ Branch 1 taken 69 times.
✗ Branch 2 not taken.
|
69 | bp::def( |
| 77 | "buildSampleModelHumanoidRandom", | ||
| 78 | static_cast<Model (*)(bool)>(pinocchio::python::buildSampleModelHumanoidRandom), | ||
| 79 | 138 | bp::args("using_free_flyer"), | |
| 80 | "Generate a (hard-coded) model of a humanoid robot with 6-DOF limbs and random joint " | ||
| 81 | "placements.\nOnly meant for unit tests."); | ||
| 82 | |||
| 83 | 69 | bp::def( | |
| 84 | "buildSampleModelManipulator", | ||
| 85 | static_cast<Model (*)()>(pinocchio::python::buildSampleModelManipulator), | ||
| 86 | "Generate a (hard-coded) model of a simple manipulator."); | ||
| 87 | |||
| 88 | #ifdef PINOCCHIO_WITH_HPP_FCL | ||
| 89 |
1/2✓ Branch 1 taken 69 times.
✗ Branch 2 not taken.
|
69 | bp::def( |
| 90 | "buildSampleGeometryModelManipulator", | ||
| 91 | static_cast<GeometryModel (*)(const Model &)>( | ||
| 92 | pinocchio::python::buildSampleGeometryModelManipulator), | ||
| 93 | 138 | bp::args("model"), "Generate a (hard-coded) geometry model of a simple manipulator."); | |
| 94 | #endif | ||
| 95 | |||
| 96 | 69 | bp::def( | |
| 97 | "buildSampleModelHumanoid", | ||
| 98 | static_cast<Model (*)()>(pinocchio::python::buildSampleModelHumanoid), | ||
| 99 | "Generate a (hard-coded) model of a simple humanoid."); | ||
| 100 | |||
| 101 |
1/2✓ Branch 1 taken 69 times.
✗ Branch 2 not taken.
|
69 | bp::def( |
| 102 | "buildSampleModelHumanoid", | ||
| 103 | static_cast<Model (*)(bool)>(pinocchio::python::buildSampleModelHumanoid), | ||
| 104 | 138 | bp::args("using_free_flyer"), "Generate a (hard-coded) model of a simple humanoid."); | |
| 105 | |||
| 106 | #ifdef PINOCCHIO_WITH_HPP_FCL | ||
| 107 |
1/2✓ Branch 1 taken 69 times.
✗ Branch 2 not taken.
|
69 | bp::def( |
| 108 | "buildSampleGeometryModelHumanoid", | ||
| 109 | static_cast<GeometryModel (*)(const Model &)>( | ||
| 110 | pinocchio::python::buildSampleGeometryModelHumanoid), | ||
| 111 | 138 | bp::args("model"), "Generate a (hard-coded) geometry model of a simple humanoid."); | |
| 112 | #endif | ||
| 113 | 69 | } | |
| 114 | } // namespace python | ||
| 115 | |||
| 116 | } // namespace pinocchio | ||
| 117 |