| Directory: | ./ |
|---|---|
| File: | tests/reeds-and-shepp.cc |
| Date: | 2025-03-10 11:18:21 |
| Exec | Total | Coverage | |
|---|---|---|---|
| Lines: | 20 | 20 | 100.0% |
| Branches: | 77 | 182 | 42.3% |
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // Copyright (c) 2020, CNRS | ||
| 2 | // Authors: Florent Lamiraux | ||
| 3 | // | ||
| 4 | |||
| 5 | // Redistribution and use in source and binary forms, with or without | ||
| 6 | // modification, are permitted provided that the following conditions are | ||
| 7 | // met: | ||
| 8 | // | ||
| 9 | // 1. Redistributions of source code must retain the above copyright | ||
| 10 | // notice, this list of conditions and the following disclaimer. | ||
| 11 | // | ||
| 12 | // 2. Redistributions in binary form must reproduce the above copyright | ||
| 13 | // notice, this list of conditions and the following disclaimer in the | ||
| 14 | // documentation and/or other materials provided with the distribution. | ||
| 15 | // | ||
| 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 17 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 18 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| 19 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| 20 | // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 21 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| 22 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| 23 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| 24 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| 26 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||
| 27 | // DAMAGE. | ||
| 28 | |||
| 29 | #define HPP_DEBUG | ||
| 30 | #define BOOST_TEST_MODULE ReedsAndShepp | ||
| 31 | #include <boost/test/included/unit_test.hpp> | ||
| 32 | #include <hpp/core/distance/reeds-shepp.hh> | ||
| 33 | #include <hpp/core/problem.hh> | ||
| 34 | #include <hpp/core/steering-method/reeds-shepp.hh> | ||
| 35 | #include <hpp/pinocchio/joint.hh> | ||
| 36 | #include <hpp/pinocchio/simple-device.hh> | ||
| 37 | |||
| 38 | using hpp::core::Parameter; | ||
| 39 | using hpp::core::PathPtr_t; | ||
| 40 | using hpp::core::Problem; | ||
| 41 | using hpp::core::ProblemPtr_t; | ||
| 42 | using hpp::core::size_type; | ||
| 43 | using hpp::core::value_type; | ||
| 44 | using hpp::pinocchio::Configuration_t; | ||
| 45 | using hpp::pinocchio::DevicePtr_t; | ||
| 46 | |||
| 47 | typedef hpp::core::distance::ReedsShepp Distance; | ||
| 48 | typedef hpp::core::distance::ReedsSheppPtr_t DistancePtr_t; | ||
| 49 | typedef hpp::core::steeringMethod::ReedsShepp SteeringMethod; | ||
| 50 | typedef hpp::core::steeringMethod::ReedsSheppPtr_t SteeringMethodPtr_t; | ||
| 51 | |||
| 52 |
33/66✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
✓ Branch 23 taken 1 times.
✗ Branch 24 not taken.
✓ Branch 27 taken 1 times.
✗ Branch 28 not taken.
✓ Branch 30 taken 1 times.
✗ Branch 31 not taken.
✓ Branch 33 taken 1 times.
✗ Branch 34 not taken.
✓ Branch 36 taken 1 times.
✗ Branch 37 not taken.
✓ Branch 41 taken 1 times.
✗ Branch 42 not taken.
✓ Branch 45 taken 1 times.
✗ Branch 46 not taken.
✓ Branch 48 taken 1 times.
✗ Branch 49 not taken.
✓ Branch 52 taken 1 times.
✗ Branch 53 not taken.
✓ Branch 55 taken 1 times.
✗ Branch 56 not taken.
✓ Branch 58 taken 1 times.
✗ Branch 59 not taken.
✓ Branch 61 taken 1 times.
✗ Branch 62 not taken.
✓ Branch 66 taken 1 times.
✗ Branch 67 not taken.
✓ Branch 70 taken 1 times.
✗ Branch 71 not taken.
✓ Branch 73 taken 1 times.
✗ Branch 74 not taken.
✓ Branch 77 taken 1 times.
✗ Branch 78 not taken.
✓ Branch 80 taken 1 times.
✗ Branch 81 not taken.
✓ Branch 83 taken 1 times.
✗ Branch 84 not taken.
✓ Branch 86 taken 1 times.
✗ Branch 87 not taken.
✓ Branch 91 taken 1 times.
✗ Branch 92 not taken.
✓ Branch 95 taken 1 times.
✗ Branch 96 not taken.
✓ Branch 98 taken 1 times.
✗ Branch 99 not taken.
✓ Branch 102 taken 1 times.
✗ Branch 103 not taken.
✓ Branch 105 taken 1 times.
✗ Branch 106 not taken.
✓ Branch 108 taken 1 times.
✗ Branch 109 not taken.
✓ Branch 111 taken 1 times.
✗ Branch 112 not taken.
✓ Branch 116 taken 1 times.
✗ Branch 117 not taken.
|
4 | BOOST_AUTO_TEST_CASE(ReedsAndShepp) { |
| 53 | DevicePtr_t robot = | ||
| 54 |
2/4✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
|
4 | hpp::pinocchio::unittest::makeDevice(hpp::pinocchio::unittest::CarLike); |
| 55 |
6/12✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 9 taken 1 times.
✗ Branch 10 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 1 times.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✓ Branch 22 taken 1 times.
|
2 | BOOST_REQUIRE_EQUAL(robot->configSize(), 6); |
| 56 | // Set bounds | ||
| 57 |
2/4✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
|
2 | robot->rootJoint()->lowerBound(0, -10); |
| 58 |
2/4✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
|
2 | robot->rootJoint()->lowerBound(1, -10); |
| 59 |
2/4✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
|
2 | robot->rootJoint()->upperBound(0, 10); |
| 60 |
2/4✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
|
2 | robot->rootJoint()->upperBound(1, 10); |
| 61 | |||
| 62 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
2 | ProblemPtr_t problem(Problem::create(robot)); |
| 63 | // problem->setParameter("SteeringMethod/Carlike/turningRadius", | ||
| 64 | // Parameter(2.)); | ||
| 65 |
2/4✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
|
4 | problem->setParameter( |
| 66 | "SteeringMethod/Carlike/wheels", | ||
| 67 |
2/4✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
|
4 | Parameter(std::string("wheel_frontright_joint,wheel_frontleft_joint"))); |
| 68 | // Rank of the wheels in the configuration vector | ||
| 69 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
2 | SteeringMethodPtr_t sm(SteeringMethod::createWithGuess(problem)); |
| 70 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
2 | DistancePtr_t dist(Distance::create(problem)); |
| 71 | |||
| 72 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
2 | Configuration_t q1(robot->neutralConfiguration()); |
| 73 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
2 | Configuration_t q2(robot->neutralConfiguration()); |
| 74 | |||
| 75 |
6/12✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
|
2 | q1 << -2, 0, -1, 0, 0, 0; |
| 76 |
6/12✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
|
2 | q1 << 2, 0, 1, 0, 0, 0; |
| 77 | |||
| 78 |
2/20✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
|
2 | hppDout(info, "dist = " << (*dist)(q1, q2)); |
| 79 |
3/6✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
|
4 | PathPtr_t path((*sm)(q1, q2)); |
| 80 |
2/16✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
|
2 | hppDout(info, "path length = " << path->length()); |
| 81 | 2 | } | |
| 82 |