hpp-core 6.0.0
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>
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 {
68 public:
77 virtual bool validateConfiguration(const value_type &t, interval_t &interval,
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;
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;
108 bool valid_;
114 : tolerance_(tolerance), reverse_(false), refine_(true) {
115 if (tolerance < 0) {
116 throw std::runtime_error("tolerance should be non-negative.");
117 }
118 }
119
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
131inline 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
Definition interval-validation.hh:67
virtual std::ostream & print(std::ostream &os) const =0
PathPtr_t path_
Definition interval-validation.hh:104
boost::icl::interval_set< value_type > interval_set
Definition interval-validation.hh:103
bool reverse_
Definition interval-validation.hh:106
virtual bool validateConfiguration(const value_type &t, interval_t &interval, ValidationReportPtr_t &report, const pinocchio::DeviceData &data)=0
boost::icl::continuous_interval< value_type > continuous_interval
Definition interval-validation.hh:102
IntervalValidation(const IntervalValidation &other)
Definition interval-validation.hh:120
IntervalValidation(value_type tolerance)
Definition interval-validation.hh:113
virtual IntervalValidationPtr_t copy() const =0
interval_set validInterval_
Definition interval-validation.hh:109
void path(const PathPtr_t &path, bool reverse)
Definition interval-validation.hh:84
bool valid_
Definition interval-validation.hh:108
value_type tolerance_
Definition interval-validation.hh:105
bool refine_
Definition interval-validation.hh:107
PathConstPtr_t path() const
Get path.
Definition interval-validation.hh:93
value_type tolerance() const
Definition interval-validation.hh:95
shared_ptr< IntervalValidation > IntervalValidationPtr_t
Definition fwd.hh:269
std::ostream & operator<<(std::ostream &os, const BodyPairCollision &pair)
Definition body-pair-collision.hh:177
pinocchio::value_type value_type
Definition fwd.hh:174
std::pair< value_type, value_type > interval_t
Definition fwd.hh:175
shared_ptr< ValidationReport > ValidationReportPtr_t
Definition fwd.hh:225
shared_ptr< const Path > PathConstPtr_t
Definition fwd.hh:188
shared_ptr< Path > PathPtr_t
Definition fwd.hh:187
Definition bi-rrt-planner.hh:35