| Directory: | ./ |
|---|---|
| File: | include/hpp/pinocchio/extra-config-space.hh |
| Date: | 2025-05-04 12:09:19 |
| Exec | Total | Coverage | |
|---|---|---|---|
| Lines: | 14 | 18 | 77.8% |
| Branches: | 5 | 10 | 50.0% |
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // | ||
| 2 | // Copyright (c) 2013, 2014 CNRS | ||
| 3 | // Author: Florent Lamiraux | ||
| 4 | // | ||
| 5 | // | ||
| 6 | |||
| 7 | // Redistribution and use in source and binary forms, with or without | ||
| 8 | // modification, are permitted provided that the following conditions are | ||
| 9 | // met: | ||
| 10 | // | ||
| 11 | // 1. Redistributions of source code must retain the above copyright | ||
| 12 | // notice, this list of conditions and the following disclaimer. | ||
| 13 | // | ||
| 14 | // 2. Redistributions in binary form must reproduce the above copyright | ||
| 15 | // notice, this list of conditions and the following disclaimer in the | ||
| 16 | // documentation and/or other materials provided with the distribution. | ||
| 17 | // | ||
| 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| 22 | // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||
| 29 | // DAMAGE. | ||
| 30 | |||
| 31 | #ifndef HPP_PINOCCHIO_EXTRA_CONFIG_SPACE_HH | ||
| 32 | #define HPP_PINOCCHIO_EXTRA_CONFIG_SPACE_HH | ||
| 33 | |||
| 34 | #include <hpp/pinocchio/fwd.hh> | ||
| 35 | |||
| 36 | namespace hpp { | ||
| 37 | namespace pinocchio { | ||
| 38 | /// Extra degrees of freedom to store internal values in configurations | ||
| 39 | /// | ||
| 40 | /// In some applications, it is useful to store extra variables | ||
| 41 | /// with the configuration vector of a robot. For instance, when | ||
| 42 | /// planning motions in state space using roadmap based methods, | ||
| 43 | /// the velocity of the robot is stored in the nodes of the | ||
| 44 | /// roadmap. | ||
| 45 | class ExtraConfigSpace { | ||
| 46 | public: | ||
| 47 |
1/2✓ Branch 2 taken 31 times.
✗ Branch 3 not taken.
|
31 | ExtraConfigSpace() : dimension_(0), lowerBounds_(), upperBounds_() { |
| 48 |
1/2✓ Branch 1 taken 31 times.
✗ Branch 2 not taken.
|
31 | lowerBounds_.resize(0); |
| 49 |
1/2✓ Branch 1 taken 31 times.
✗ Branch 2 not taken.
|
31 | upperBounds_.resize(0); |
| 50 | 31 | } | |
| 51 | value_type& lower(const size_type& index) { return lowerBounds_[index]; } | ||
| 52 | value_type& upper(const size_type& index) { return upperBounds_[index]; } | ||
| 53 | ✗ | const value_type& lower(const size_type& index) const { | |
| 54 | ✗ | return lowerBounds_[index]; | |
| 55 | } | ||
| 56 | ✗ | const value_type& upper(const size_type& index) const { | |
| 57 | ✗ | return upperBounds_[index]; | |
| 58 | } | ||
| 59 | 24029 | const vector_t& lower() const { return lowerBounds_; } | |
| 60 | 24030 | const vector_t& upper() const { return upperBounds_; } | |
| 61 | /// Get dimension | ||
| 62 | 72865 | size_type dimension() const { return dimension_; } | |
| 63 | |||
| 64 | private: | ||
| 65 | /// Set dimension of extra configuration space | ||
| 66 | /// | ||
| 67 | /// resize lowerBounds and upperBounds, set bounds to -infinity, +infinity | ||
| 68 | 2 | void setDimension(const size_type& dimension) { | |
| 69 | 2 | dimension_ = dimension; | |
| 70 | 2 | lowerBounds_.resize(dimension); | |
| 71 | 2 | upperBounds_.resize(dimension); | |
| 72 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | lowerBounds_.setConstant(-std::numeric_limits<value_type>::infinity()); |
| 73 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | upperBounds_.setConstant(+std::numeric_limits<value_type>::infinity()); |
| 74 | 2 | } | |
| 75 | size_type dimension_; | ||
| 76 | vector_t lowerBounds_; | ||
| 77 | vector_t upperBounds_; | ||
| 78 | friend class Device; | ||
| 79 | }; // class ExtraConfigSpace | ||
| 80 | } // namespace pinocchio | ||
| 81 | } // namespace hpp | ||
| 82 | |||
| 83 | #endif // HPP_PINOCCHIO_EXTRA_CONFIG_SPACE_HH | ||
| 84 |