hpp-core: include/hpp/core/continuous-validation/interval-validation.hh Source File

hpp-core 9.0.2 Implement basic classes for canonical path planning for kinematic chains.

Loading...
Searching...
No Matches
interval-validation.hh
Go to the documentation of this file.
1//
2// Copyright (c) 2014,2015,2016,2018 CNRS
3// Authors: Florent Lamiraux, Joseph Mirabel, Diane Bury
4//
5
6// Redistribution and use in source and binary forms, with or without
7// modification, are permitted provided that the following conditions are
8// met:
9//
10// 1. Redistributions of source code must retain the above copyright
11// notice, this list of conditions and the following disclaimer.
12//
13// 2. Redistributions in binary form must reproduce the above copyright
14// notice, this list of conditions and the following disclaimer in the
15// documentation and/or other materials provided with the distribution.
16//
17// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
28// DAMAGE.
29
30#ifndef HPP_CORE_CONTINUOUS_VALIDATION_INTERVAL_VALIDATION_HH
31#define HPP_CORE_CONTINUOUS_VALIDATION_INTERVAL_VALIDATION_HH
32
33#include <coal/collision.h>
34#include <coal/collision_data.h>
35
36#include <boost/icl/continuous_interval.hpp>
37#include <boost/icl/interval_set.hpp>
38#include <hpp/core/deprecated.hh>
39#include <hpp/core/fwd.hh>
40#include <hpp/pinocchio/body.hh>
41#include <hpp/pinocchio/collision-object.hh>
42#include <hpp/pinocchio/joint.hh>
43#include <iterator>
44#include <limits>
45
46namespace hpp {
47namespace core {
48namespace continuousValidation {
67 class IntervalValidation {
68 public:
77 virtual bool validateConfiguration(const value_type& t, interval_t& interval,
78 ValidationReportPtr_t& report,
79 const pinocchio::DeviceData& data) = 0;
80
84 void path(const PathPtr_t& path, bool reverse) {
85 path_ = path;
86 reverse_ = reverse;
87 valid_ = false;
88 validInterval_ = interval_set();
89 setupPath();
90 }
91
93 PathConstPtr_t path() const { return path_; }
94
95 value_type tolerance() const { return tolerance_; }
96
97 virtual std::string name() const = 0;
98 virtual std::ostream& print(std::ostream& os) const = 0;
99 virtual IntervalValidationPtr_t copy() const = 0;
100
101 protected:
102 typedef boost::icl::continuous_interval<value_type> continuous_interval;
103 typedef boost::icl::interval_set<value_type> interval_set;
104 PathPtr_t path_;
105 value_type tolerance_;
106 bool reverse_;
107 bool refine_;
108 bool valid_;
109 interval_set validInterval_;
113 IntervalValidation(value_type tolerance)
114 : tolerance_(tolerance), reverse_(false), refine_(true) {
115 if (tolerance < 0) {
116 throw std::runtime_error("tolerance should be non-negative.");
117 }
118 }
119
120 IntervalValidation(const IntervalValidation& other)
121 : tolerance_(other.tolerance_), refine_(true) {
122 if (tolerance_ < 0) {
123 throw std::runtime_error("tolerance should be non-negative.");
124 }
125 }
126
127 private:
128 virtual void setupPath() = 0;
129}; // class IntervalValidation
130
131 inline std::ostream& operator<<(std::ostream& os, const IntervalValidation& b) {
132 return b.print(os);
133}
134} // namespace continuousValidation
135} // namespace core
136} // namespace hpp
137#endif // HPP_CORE_CONTINUOUS_VALIDATION_INTERVAL_VALIDATION_HH
body.hh
hpp::core::continuousValidation::IntervalValidation
Definition interval-validation.hh:67
hpp::core::continuousValidation::IntervalValidation::print
virtual std::ostream & print(std::ostream &os) const =0
hpp::core::continuousValidation::IntervalValidation::path_
PathPtr_t path_
Definition interval-validation.hh:104
hpp::core::continuousValidation::IntervalValidation::interval_set
boost::icl::interval_set< value_type > interval_set
Definition interval-validation.hh:103
hpp::core::continuousValidation::IntervalValidation::reverse_
bool reverse_
Definition interval-validation.hh:106
hpp::core::continuousValidation::IntervalValidation::validateConfiguration
virtual bool validateConfiguration(const value_type &t, interval_t &interval, ValidationReportPtr_t &report, const pinocchio::DeviceData &data)=0
hpp::core::continuousValidation::IntervalValidation::continuous_interval
boost::icl::continuous_interval< value_type > continuous_interval
Definition interval-validation.hh:102
hpp::core::continuousValidation::IntervalValidation::IntervalValidation
IntervalValidation(const IntervalValidation &other)
Definition interval-validation.hh:120
hpp::core::continuousValidation::IntervalValidation::name
virtual std::string name() const =0
hpp::core::continuousValidation::IntervalValidation::IntervalValidation
IntervalValidation(value_type tolerance)
Definition interval-validation.hh:113
hpp::core::continuousValidation::IntervalValidation::copy
virtual IntervalValidationPtr_t copy() const =0
hpp::core::continuousValidation::IntervalValidation::validInterval_
interval_set validInterval_
Definition interval-validation.hh:109
hpp::core::continuousValidation::IntervalValidation::path
void path(const PathPtr_t &path, bool reverse)
Definition interval-validation.hh:84
hpp::core::continuousValidation::IntervalValidation::valid_
bool valid_
Definition interval-validation.hh:108
hpp::core::continuousValidation::IntervalValidation::tolerance_
value_type tolerance_
Definition interval-validation.hh:105
hpp::core::continuousValidation::IntervalValidation::refine_
bool refine_
Definition interval-validation.hh:107
hpp::core::continuousValidation::IntervalValidation::path
PathConstPtr_t path() const
Get path.
Definition interval-validation.hh:93
hpp::core::continuousValidation::IntervalValidation::tolerance
value_type tolerance() const
Definition interval-validation.hh:95
collision-object.hh
deprecated.hh
fwd.hh
joint.hh
hpp
hpp::core::continuousValidation::IntervalValidationPtr_t
shared_ptr< IntervalValidation > IntervalValidationPtr_t
Definition fwd.hh:269
hpp::core::continuousValidation::operator<<
std::ostream & operator<<(std::ostream &os, const BodyPairCollision &pair)
Definition body-pair-collision.hh:177
hpp::core::value_type
pinocchio::value_type value_type
Definition fwd.hh:174
hpp::core::interval_t
std::pair< value_type, value_type > interval_t
Definition fwd.hh:175
hpp::core::ValidationReportPtr_t
shared_ptr< ValidationReport > ValidationReportPtr_t
Definition fwd.hh:225
hpp::core::PathConstPtr_t
shared_ptr< const Path > PathConstPtr_t
Definition fwd.hh:188
hpp::core::PathPtr_t
shared_ptr< Path > PathPtr_t
Definition fwd.hh:187
hpp::pinocchio::DeviceData