hpp-core  4.12.0
Implement basic classes for canonical path planning for kinematic chains.
k-prm-star.hh
Go to the documentation of this file.
1 //
2 // Copyright (c) 2018 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_PLANNER_K_PRM_STAR_HH
20 # define HPP_CORE_PATH_PLANNER_K_PRM_STAR_HH
21 
22 # include <hpp/core/path-planner.hh>
23 
24 namespace hpp {
25  namespace core {
26  namespace pathPlanner {
30  {
31  public:
33  enum STATE {
37  FAILURE
38  }; // enum STATE
40  static const double kPRM;
44  static kPrmStarPtr_t create (const ProblemConstPtr_t& problem);
48  static kPrmStarPtr_t createWithRoadmap
49  (const ProblemConstPtr_t& problem, const RoadmapPtr_t& roadmap);
53  virtual void startSolve ();
56  virtual void tryConnectInitAndGoals ();
58  virtual void oneStep ();
60  STATE getComputationState () const;
61 
62  protected:
65  kPrmStar (const ProblemConstPtr_t& problem);
69  kPrmStar (const ProblemConstPtr_t& problem, const RoadmapPtr_t& roadmap);
71  void init (const kPrmStarWkPtr_t& weak);
72 
73  private:
74  STATE state_;
76  void generateRandomConfig ();
78  void linkNodes ();
80  void connectInitAndGoal ();
84  bool connectNodeToClosestNeighbors (const NodePtr_t& node);
86  std::size_t numberNodes_;
88  Nodes_t::const_iterator linkingNodeIt_;
90  Nodes_t::iterator itNeighbor_;
92  size_type numberNeighbors_;
94  Nodes_t neighbors_;
96  bool reachedLastNeighbor_;
98  kPrmStarWkPtr_t weak_;
99  }; // class kPrmStar
100  } // namespace pathPlanner
101  } // namespace core
102 } // namespace hpp
103 
104 #endif // HPP_CORE_PATH_PLANNER_K_PRM_STAR_HH
Definition: bi-rrt-planner.hh:24
pinocchio::size_type size_type
Definition: fwd.hh:156
Definition: path-planner.hh:34
shared_ptr< const Problem > ProblemConstPtr_t
Definition: fwd.hh:180
Definition: node.hh:35
static const double kPRM
Constant kPRM = 2 e.
Definition: k-prm-star.hh:40
shared_ptr< kPrmStar > kPrmStarPtr_t
Definition: fwd.hh:286
std::list< NodePtr_t > Nodes_t
Definition: fwd.hh:164
STATE
Computation step of the algorithm.
Definition: k-prm-star.hh:33
PathPlanner Parent_t
Definition: k-prm-star.hh:41
shared_ptr< Roadmap > RoadmapPtr_t
Definition: fwd.hh:182
#define HPP_CORE_DLLAPI
Definition: config.hh:64
Definition: k-prm-star.hh:29