hpp-core  4.9.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 {
29  class HPP_CORE_DLLAPI kPrmStar : public PathPlanner
30  {
31  public:
33  enum STATE {
37  FAILURE
38  }; // enum STATE
40  static const double kPRM;
44  static kPrmStarPtr_t create (const Problem& problem);
48  static kPrmStarPtr_t createWithRoadmap (const Problem& problem,
49  const RoadmapPtr_t& roadmap);
53  virtual void startSolve ();
55  virtual void oneStep ();
57  STATE getComputationState () const;
58 
59  protected:
62  kPrmStar (const Problem& problem);
66  kPrmStar (const Problem& problem, const RoadmapPtr_t& roadmap);
68  void init (const kPrmStarWkPtr_t& weak);
69 
70  private:
71  STATE state_;
73  void generateRandomConfig ();
75  void linkNodes ();
77  void connectInitAndGoal ();
81  bool connectNodeToClosestNeighbors (const NodePtr_t& node);
83  std::size_t numberNodes_;
85  Nodes_t::const_iterator linkingNodeIt_;
87  Nodes_t::iterator itNeighbor_;
89  size_type numberNeighbors_;
91  Nodes_t neighbors_;
93  bool reachedLastNeighbor_;
95  kPrmStarWkPtr_t weak_;
96  }; // class kPrmStar
97  } // namespace pathPlanner
98  } // namespace core
99 } // namespace hpp
100 
101 #endif // HPP_CORE_PATH_PLANNER_K_PRM_STAR_HH
Definition: problem.hh:48
ObjectFactory * create(ObjectFactory *parent=NULL, const XMLElement *element=NULL)
pinocchio::size_type size_type
Definition: fwd.hh:156
Definition: path-planner.hh:34
boost::shared_ptr< kPrmStar > kPrmStarPtr_t
Definition: fwd.hh:285
Definition: node.hh:34
static const double kPRM
Constant kPRM = 2 e.
Definition: k-prm-star.hh:40
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
boost::shared_ptr< Roadmap > RoadmapPtr_t
Definition: fwd.hh:181
Definition: k-prm-star.hh:29