| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // | ||
| 2 | // Software License Agreement (BSD License) | ||
| 3 | // | ||
| 4 | // Copyright (c) 2024 INRIA | ||
| 5 | // Author: Louis Montaut | ||
| 6 | // All rights reserved. | ||
| 7 | // | ||
| 8 | // Redistribution and use in source and binary forms, with or without | ||
| 9 | // modification, are permitted provided that the following conditions | ||
| 10 | // are met: | ||
| 11 | // | ||
| 12 | // * Redistributions of source code must retain the above copyright | ||
| 13 | // notice, this list of conditions and the following disclaimer. | ||
| 14 | // * Redistributions in binary form must reproduce the above | ||
| 15 | // copyright notice, this list of conditions and the following | ||
| 16 | // disclaimer in the documentation and/or other materials provided | ||
| 17 | // with the distribution. | ||
| 18 | // * Neither the name of INRIA nor the names of its | ||
| 19 | // contributors may be used to endorse or promote products derived | ||
| 20 | // from this software without specific prior written permission. | ||
| 21 | // | ||
| 22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
| 25 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
| 26 | // COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| 27 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
| 28 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 29 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
| 30 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 31 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
| 32 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| 33 | // POSSIBILITY OF SUCH DAMAGE. | ||
| 34 | |||
| 35 | #include <eigenpy/eigenpy.hpp> | ||
| 36 | |||
| 37 | #include "coal/fwd.hh" | ||
| 38 | #include "coal/contact_patch.h" | ||
| 39 | #include "coal/serialization/collision_data.h" | ||
| 40 | |||
| 41 | #include "coal.hh" | ||
| 42 | #include "deprecation.hh" | ||
| 43 | #include "serializable.hh" | ||
| 44 | |||
| 45 | #ifdef COAL_HAS_DOXYGEN_AUTODOC | ||
| 46 | #include "doxygen_autodoc/functions.h" | ||
| 47 | #include "doxygen_autodoc/coal/collision_data.h" | ||
| 48 | #endif | ||
| 49 | |||
| 50 | #include "../doc/python/doxygen.hh" | ||
| 51 | #include "../doc/python/doxygen-boost.hh" | ||
| 52 | |||
| 53 | using namespace boost::python; | ||
| 54 | using namespace coal; | ||
| 55 | using namespace coal::python; | ||
| 56 | |||
| 57 | namespace dv = doxygen::visitor; | ||
| 58 | |||
| 59 | 5 | void exposeContactPatchAPI() { | |
| 60 | 5 | if (!eigenpy::register_symbolic_link_to_registered_type< | |
| 61 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | ContactPatch::PatchDirection>()) { |
| 62 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
10 | enum_<ContactPatch::PatchDirection>("ContactPatchDirection") |
| 63 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .value("DEFAULT", ContactPatch::PatchDirection::DEFAULT) |
| 64 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .value("INVERTED", ContactPatch::PatchDirection::INVERTED) |
| 65 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .export_values(); |
| 66 | } | ||
| 67 | |||
| 68 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | if (!eigenpy::register_symbolic_link_to_registered_type<ContactPatch>()) { |
| 69 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | class_<ContactPatch>( |
| 70 | "ContactPatch", doxygen::class_doc<ContactPatch>(), | ||
| 71 |
4/8✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 5 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 5 times.
✗ Branch 11 not taken.
|
10 | init<optional<size_t>>((arg("self"), arg("preallocated_size")), |
| 72 | "ContactPatch constructor.")) | ||
| 73 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .DEF_RW_CLASS_ATTRIB(ContactPatch, tf) |
| 74 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .DEF_RW_CLASS_ATTRIB(ContactPatch, direction) |
| 75 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .DEF_RW_CLASS_ATTRIB(ContactPatch, penetration_depth) |
| 76 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
5 | .DEF_CLASS_FUNC(ContactPatch, size) |
| 77 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
5 | .DEF_CLASS_FUNC(ContactPatch, getNormal) |
| 78 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
5 | .DEF_CLASS_FUNC(ContactPatch, addPoint) |
| 79 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
5 | .DEF_CLASS_FUNC(ContactPatch, getPoint) |
| 80 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
5 | .DEF_CLASS_FUNC(ContactPatch, getPointShape1) |
| 81 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
5 | .DEF_CLASS_FUNC(ContactPatch, getPointShape2) |
| 82 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
5 | .DEF_CLASS_FUNC(ContactPatch, clear) |
| 83 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
5 | .DEF_CLASS_FUNC(ContactPatch, isSame); |
| 84 | } | ||
| 85 | |||
| 86 | 5 | if (!eigenpy::register_symbolic_link_to_registered_type< | |
| 87 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | std::vector<ContactPatch>>()) { |
| 88 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
10 | class_<std::vector<ContactPatch>>("StdVec_ContactPatch") |
| 89 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def(vector_indexing_suite<std::vector<ContactPatch>>()); |
| 90 | } | ||
| 91 | |||
| 92 | 5 | if (!eigenpy::register_symbolic_link_to_registered_type< | |
| 93 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | ContactPatchRequest>()) { |
| 94 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | class_<ContactPatchRequest>( |
| 95 | "ContactPatchRequest", doxygen::class_doc<ContactPatchRequest>(), | ||
| 96 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | init<optional<size_t, size_t, Scalar>>( |
| 97 |
4/8✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 5 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 5 times.
✗ Branch 11 not taken.
|
15 | (arg("self"), arg("max_num_patch"), |
| 98 |
3/6✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 5 times.
✗ Branch 8 not taken.
|
20 | arg("num_samples_curved_shapes"), arg("patch_tolerance")), |
| 99 | "ContactPatchRequest constructor.")) | ||
| 100 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def(dv::init<ContactPatchRequest, const CollisionRequest&, |
| 101 | 5 | bp::optional<size_t, Scalar>>()) | |
| 102 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .DEF_RW_CLASS_ATTRIB(ContactPatchRequest, max_num_patch) |
| 103 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
5 | .DEF_CLASS_FUNC(ContactPatchRequest, getNumSamplesCurvedShapes) |
| 104 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
5 | .DEF_CLASS_FUNC(ContactPatchRequest, setNumSamplesCurvedShapes) |
| 105 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
5 | .DEF_CLASS_FUNC(ContactPatchRequest, getPatchTolerance) |
| 106 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
5 | .DEF_CLASS_FUNC(ContactPatchRequest, setPatchTolerance); |
| 107 | } | ||
| 108 | |||
| 109 | 5 | if (!eigenpy::register_symbolic_link_to_registered_type< | |
| 110 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | std::vector<ContactPatchRequest>>()) { |
| 111 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
10 | class_<std::vector<ContactPatchRequest>>("StdVec_ContactPatchRequest") |
| 112 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def(vector_indexing_suite<std::vector<ContactPatchRequest>>()); |
| 113 | } | ||
| 114 | |||
| 115 | 5 | if (!eigenpy::register_symbolic_link_to_registered_type< | |
| 116 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | ContactPatchResult>()) { |
| 117 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | class_<ContactPatchResult>("ContactPatchResult", |
| 118 | doxygen::class_doc<ContactPatchResult>(), | ||
| 119 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
10 | init<>(arg("self"), "Default constructor.")) |
| 120 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def(dv::init<ContactPatchResult, ContactPatchRequest>()) |
| 121 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
5 | .DEF_CLASS_FUNC(ContactPatchResult, numContactPatches) |
| 122 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
5 | .DEF_CLASS_FUNC(ContactPatchResult, getUnusedContactPatch) |
| 123 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .DEF_CLASS_FUNC2(ContactPatchResult, getContactPatch, |
| 124 | return_value_policy<copy_const_reference>()) | ||
| 125 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
5 | .DEF_CLASS_FUNC(ContactPatchResult, clear) |
| 126 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
5 | .DEF_CLASS_FUNC(ContactPatchResult, set) |
| 127 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
5 | .DEF_CLASS_FUNC(ContactPatchResult, check); |
| 128 | } | ||
| 129 | |||
| 130 | 5 | if (!eigenpy::register_symbolic_link_to_registered_type< | |
| 131 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | std::vector<ContactPatchResult>>()) { |
| 132 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
10 | class_<std::vector<ContactPatchResult>>("StdVec_ContactPatchResult") |
| 133 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def(vector_indexing_suite<std::vector<ContactPatchResult>>()); |
| 134 | } | ||
| 135 | |||
| 136 | 5 | doxygen::def( | |
| 137 | "computeContactPatch", | ||
| 138 | static_cast<void (*)(const CollisionObject*, const CollisionObject*, | ||
| 139 | const CollisionResult&, const ContactPatchRequest&, | ||
| 140 | ContactPatchResult&)>(&computeContactPatch)); | ||
| 141 | 5 | doxygen::def( | |
| 142 | "computeContactPatch", | ||
| 143 | static_cast<void (*)(const CollisionGeometry*, const Transform3s&, | ||
| 144 | const CollisionGeometry*, const Transform3s&, | ||
| 145 | const CollisionResult&, const ContactPatchRequest&, | ||
| 146 | ContactPatchResult&)>(&computeContactPatch)); | ||
| 147 | |||
| 148 | 5 | if (!eigenpy::register_symbolic_link_to_registered_type< | |
| 149 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | ComputeContactPatch>()) { |
| 150 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
10 | class_<ComputeContactPatch>("ComputeContactPatch", |
| 151 | doxygen::class_doc<ComputeContactPatch>(), | ||
| 152 | no_init) | ||
| 153 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def(dv::init<ComputeContactPatch, const CollisionGeometry*, |
| 154 | 10 | const CollisionGeometry*>()) | |
| 155 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def("__call__", |
| 156 | static_cast<void (ComputeContactPatch::*)( | ||
| 157 | const Transform3s&, const Transform3s&, const CollisionResult&, | ||
| 158 | const ContactPatchRequest&, ContactPatchResult&) const>( | ||
| 159 | &ComputeContactPatch::operator())); | ||
| 160 | } | ||
| 161 | 5 | } | |
| 162 |