hpp-core  4.11.0
Implement basic classes for canonical path planning for kinematic chains.
path-optimizer.hh
Go to the documentation of this file.
1 //
2 // Copyright (c) 2014 CNRS
3 // Authors: Florent Lamiraux
4 //
5 // This file is part of hpp-core
6 // hpp-core is free software: you can redistribute it
7 // and/or modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation, either version
9 // 3 of the License, or (at your option) any later version.
10 //
11 // hpp-core is distributed in the hope that it will be
12 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
13 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // General Lesser Public License for more details. You should have
15 // received a copy of the GNU Lesser General Public License along with
16 // hpp-core If not, see
17 // <http://www.gnu.org/licenses/>.
18 
19 #ifndef HPP_CORE_PATH_OPTIMIZER_HH
20 # define HPP_CORE_PATH_OPTIMIZER_HH
21 
22 # include <hpp/core/config.hh>
23 # include <hpp/core/fwd.hh>
24 
25 # include <boost/date_time/posix_time/ptime.hpp>
26 
27 namespace hpp {
28  namespace core {
31 
35  {
36  public:
37  virtual ~PathOptimizer () {};
38 
41  {
42  return problem_;
43  }
44 
46  virtual PathVectorPtr_t optimize (const PathVectorPtr_t& path) = 0;
47 
49  void interrupt () { interrupt_ = true; }
51  void maxIterations (const unsigned long int& n);
53  void timeOut(const double& timeOut);
54 
55  protected:
59  bool interrupt_;
60 
61  PathOptimizer (const ProblemConstPtr_t& problem);
62 
63  PathPtr_t steer (ConfigurationIn_t q1, ConfigurationIn_t q2) const;
64 
65  void monitorExecution();
66 
67  void endIteration() { ++monitor_.iteration; }
68 
69  bool shouldStop() const;
70 
71  void initFromParameters ();
72 
73  private:
74  ProblemConstPtr_t problem_;
75 
78  size_type maxIterations_;
80  double timeOut_;
81 
87  struct {
88  bool enabled;
90  boost::posix_time::ptime timeStart;
91  } monitor_;
92  }; // class PathOptimizer;
94  } // namespace core
95 } // namespace hpp
96 #endif // HPP_CORE_PATH_OPTIMIZER_HH
pinocchio::ConfigurationIn_t ConfigurationIn_t
Definition: fwd.hh:97
size_type iteration
Definition: path-optimizer.hh:89
ProblemConstPtr_t problem() const
Get problem.
Definition: path-optimizer.hh:40
shared_ptr< PathVector > PathVectorPtr_t
Definition: fwd.hh:176
Definition: bi-rrt-planner.hh:24
pinocchio::size_type size_type
Definition: fwd.hh:156
shared_ptr< const Problem > ProblemConstPtr_t
Definition: fwd.hh:180
void endIteration()
Definition: path-optimizer.hh:67
bool interrupt_
Definition: path-optimizer.hh:59
virtual ~PathOptimizer()
Definition: path-optimizer.hh:37
void interrupt()
Interrupt path optimization.
Definition: path-optimizer.hh:49
Definition: path-optimizer.hh:34
boost::posix_time::ptime timeStart
Definition: path-optimizer.hh:90
bool enabled
Definition: path-optimizer.hh:88
#define HPP_CORE_DLLAPI
Definition: config.hh:64
shared_ptr< Path > PathPtr_t
Definition: fwd.hh:170