hpp-core  6.0.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 
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_PATH_PLANNER_K_PRM_STAR_HH
31 #define HPP_CORE_PATH_PLANNER_K_PRM_STAR_HH
32 
33 #include <hpp/core/path-planner.hh>
34 
35 namespace hpp {
36 namespace core {
37 namespace pathPlanner {
38 
41 
45  public:
47  enum STATE {
51  FAILURE
52  }; // enum STATE
54  static const double kPRM;
58  static kPrmStarPtr_t create(const ProblemConstPtr_t& problem);
63  const RoadmapPtr_t& roadmap);
67  virtual void startSolve();
70  virtual void tryConnectInitAndGoals();
72  virtual void oneStep();
75 
76  protected:
79  kPrmStar(const ProblemConstPtr_t& problem);
83  kPrmStar(const ProblemConstPtr_t& problem, const RoadmapPtr_t& roadmap);
85  void init(const kPrmStarWkPtr_t& weak);
86 
87  private:
88  STATE state_;
90  void generateRandomConfig();
92  void linkNodes();
94  void connectInitAndGoal();
98  bool connectNodeToClosestNeighbors(const NodePtr_t& node);
100  std::size_t numberNodes_;
102  Nodes_t::const_iterator linkingNodeIt_;
104  Nodes_t::iterator itNeighbor_;
106  size_type numberNeighbors_;
108  Nodes_t neighbors_;
110  bool reachedLastNeighbor_;
112  kPrmStarWkPtr_t weak_;
113 }; // class kPrmStar
114 
116 
117 } // namespace pathPlanner
118 } // namespace core
119 } // namespace hpp
120 
121 #endif // HPP_CORE_PATH_PLANNER_K_PRM_STAR_HH
Definition: node.hh:46
Definition: path-planner.hh:45
Definition: k-prm-star.hh:44
STATE getComputationState() const
get the computationnal state of the algorithm
PathPlanner Parent_t
Definition: k-prm-star.hh:55
virtual void oneStep()
One step of the algorithm.
static kPrmStarPtr_t create(const ProblemConstPtr_t &problem)
kPrmStar(const ProblemConstPtr_t &problem, const RoadmapPtr_t &roadmap)
void init(const kPrmStarWkPtr_t &weak)
Store weak pointer to itself.
kPrmStar(const ProblemConstPtr_t &problem)
static const double kPRM
Constant kPRM = 2 e.
Definition: k-prm-star.hh:54
static kPrmStarPtr_t createWithRoadmap(const ProblemConstPtr_t &problem, const RoadmapPtr_t &roadmap)
STATE
Computation step of the algorithm.
Definition: k-prm-star.hh:47
@ CONNECT_INIT_GOAL
Definition: k-prm-star.hh:50
@ BUILD_ROADMAP
Definition: k-prm-star.hh:48
@ LINK_NODES
Definition: k-prm-star.hh:49
#define HPP_CORE_DLLAPI
Definition: config.hh:88
shared_ptr< kPrmStar > kPrmStarPtr_t
Definition: fwd.hh:304
shared_ptr< Roadmap > RoadmapPtr_t
Definition: fwd.hh:199
pinocchio::size_type size_type
Definition: fwd.hh:173
shared_ptr< const Problem > ProblemConstPtr_t
Definition: fwd.hh:197
std::list< NodePtr_t > Nodes_t
Definition: fwd.hh:181
Definition: bi-rrt-planner.hh:35