hpp-core  6.0.0
Implement basic classes for canonical path planning for kinematic chains.
global.hh
Go to the documentation of this file.
1 
2 // Copyright (c) 2014, LAAS-CNRS
3 // Authors: Joseph Mirabel (joseph.mirabel@laas.fr)
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_PATHPROJECTOR_GLOBAL_HH
31 #define HPP_CORE_PATHPROJECTOR_GLOBAL_HH
32 
33 // lineSearch::FixedSequence
34 #include <hpp/constraints/solver/hierarchical-iterative.hh>
37 
38 namespace hpp {
39 namespace core {
40 namespace pathProjector {
42  public:
45 
51  static GlobalPtr_t create(const DistancePtr_t& distance,
52  const SteeringMethodPtr_t& steeringMethod,
53  value_type step);
54 
55  static GlobalPtr_t create(const ProblemConstPtr_t& problem,
56  const value_type& step);
57 
58  protected:
59  bool impl_apply(const PathPtr_t& path, PathPtr_t& projection) const;
60 
61  Global(const DistancePtr_t& distance,
62  const SteeringMethodPtr_t& steeringMethod, value_type step,
63  value_type threshold, value_type hessianBound);
64 
65  private:
66  value_type step_;
67 
68  const value_type hessianBound_;
69  const value_type thresholdMin_;
70 
71  typedef constraints::solver::lineSearch::FixedSequence LineSearch_t;
72  struct Data {
74  value_type length; // Length between this config and the previous one
75  LineSearch_t alpha;
76  std::size_t Niter;
77  value_type sigma;
78  bool projected;
79  };
80 
81  typedef std::list<Configuration_t, Eigen::aligned_allocator<Configuration_t> >
82  Configs_t;
83  typedef std::list<value_type> Lengths_t;
84  typedef std::list<LineSearch_t> Alphas_t;
85  typedef std::vector<bool> Bools_t;
86  typedef std::list<Data> Datas_t;
87 
88  bool projectOneStep(ConfigProjector& p, Configs_t& q,
89  Configs_t::iterator& last, Bools_t& b, Lengths_t& l,
90  Alphas_t& alpha) const;
91 
92  bool projectOneStep(ConfigProjector& p, Datas_t& ds,
93  const Datas_t::iterator& last) const;
94 
96  size_type reinterpolate(const DevicePtr_t& robot, Configs_t& q,
97  const Configs_t::iterator& last, Bools_t& b,
98  Lengths_t& l, Alphas_t& alpha,
99  const value_type& maxDist) const;
100 
102  size_type reinterpolate(const DevicePtr_t& robot, ConfigProjector& p,
103  Datas_t& q, Datas_t::iterator& last) const;
104 
105  bool createPath(const DevicePtr_t& robot,
106  const ConstraintSetPtr_t& constraint, const Configs_t& q,
107  const Configs_t::iterator& last, const Bools_t& b,
108  const Lengths_t& l, PathPtr_t& result) const;
109 
110  bool createPath(const DevicePtr_t& robot,
111  const ConstraintSetPtr_t& constraint, const Datas_t& ds,
112  const Datas_t::iterator& last, PathPtr_t& result) const;
113 
114  bool project(const PathPtr_t& path, PathPtr_t& projection) const;
115 
116  bool project2(const PathPtr_t& path, PathPtr_t& projection) const;
117 
118  void initialConfigList(const PathPtr_t& path, Configs_t& cfgs) const;
119 
120  void initialConfigList(const PathPtr_t& path, ConfigProjector& p,
121  Datas_t& cfgs) const;
122 
123  void initData(Data& data, const Configuration_t& q, ConfigProjector& p,
124  bool computeSigma = false, bool projected = false,
125  const Configuration_t& distTo = Configuration_t()) const;
126 
127  mutable Configuration_t q_;
128  mutable vector_t dq_;
129 };
130 } // namespace pathProjector
131 } // namespace core
132 } // namespace hpp
133 
134 #endif // HPP_CORE_PATHPROJECTOR_GLOBAL_HH
Definition: config-projector.hh:66
This class projects a path using constraints.
Definition: path-projector.hh:38
hpp::core::PathPtr_t PathPtr_t
Definition: path-projector.hh:41
Definition: straight-path.hh:52
Definition: global.hh:41
static GlobalPtr_t create(const ProblemConstPtr_t &problem, const value_type &step)
static GlobalPtr_t create(const DistancePtr_t &distance, const SteeringMethodPtr_t &steeringMethod, value_type step)
hpp::core::StraightPath StraightPath
Definition: global.hh:43
Global(const DistancePtr_t &distance, const SteeringMethodPtr_t &steeringMethod, value_type step, value_type threshold, value_type hessianBound)
hpp::core::StraightPathPtr_t StraightPathPtr_t
Definition: global.hh:44
bool impl_apply(const PathPtr_t &path, PathPtr_t &projection) const
Method to be reimplemented by inherited class.
#define HPP_CORE_DLLAPI
Definition: config.hh:88
shared_ptr< Global > GlobalPtr_t
Definition: fwd.hh:328
pinocchio::value_type value_type
Definition: fwd.hh:174
shared_ptr< StraightPath > StraightPathPtr_t
Definition: fwd.hh:200
shared_ptr< Distance > DistancePtr_t
Definition: fwd.hh:141
shared_ptr< SteeringMethod > SteeringMethodPtr_t
Definition: fwd.hh:213
pinocchio::vector_t vector_t
Definition: fwd.hh:220
pinocchio::size_type size_type
Definition: fwd.hh:173
shared_ptr< const Problem > ProblemConstPtr_t
Definition: fwd.hh:197
pinocchio::Configuration_t Configuration_t
Definition: fwd.hh:107
pinocchio::DevicePtr_t DevicePtr_t
Definition: fwd.hh:134
shared_ptr< ConstraintSet > ConstraintSetPtr_t
Definition: fwd.hh:130
shared_ptr< Path > PathPtr_t
Definition: fwd.hh:187
Definition: bi-rrt-planner.hh:35