hpp-core  4.13.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 {
41  public:
43  enum STATE {
47  FAILURE
48  }; // enum STATE
50  static const double kPRM;
54  static kPrmStarPtr_t create(const ProblemConstPtr_t& problem);
58  static kPrmStarPtr_t createWithRoadmap(const ProblemConstPtr_t& problem,
59  const RoadmapPtr_t& roadmap);
63  virtual void startSolve();
66  virtual void tryConnectInitAndGoals();
68  virtual void oneStep();
70  STATE getComputationState() const;
71 
72  protected:
75  kPrmStar(const ProblemConstPtr_t& problem);
79  kPrmStar(const ProblemConstPtr_t& problem, const RoadmapPtr_t& roadmap);
81  void init(const kPrmStarWkPtr_t& weak);
82 
83  private:
84  STATE state_;
86  void generateRandomConfig();
88  void linkNodes();
90  void connectInitAndGoal();
94  bool connectNodeToClosestNeighbors(const NodePtr_t& node);
96  std::size_t numberNodes_;
98  Nodes_t::const_iterator linkingNodeIt_;
100  Nodes_t::iterator itNeighbor_;
102  size_type numberNeighbors_;
104  Nodes_t neighbors_;
106  bool reachedLastNeighbor_;
108  kPrmStarWkPtr_t weak_;
109 }; // class kPrmStar
110 } // namespace pathPlanner
111 } // namespace core
112 } // namespace hpp
113 
114 #endif // HPP_CORE_PATH_PLANNER_K_PRM_STAR_HH
Definition: bi-rrt-planner.hh:35
pinocchio::size_type size_type
Definition: fwd.hh:162
Definition: path-planner.hh:45
shared_ptr< const Problem > ProblemConstPtr_t
Definition: fwd.hh:186
Definition: node.hh:46
static const double kPRM
Constant kPRM = 2 e.
Definition: k-prm-star.hh:50
shared_ptr< kPrmStar > kPrmStarPtr_t
Definition: fwd.hh:291
std::list< NodePtr_t > Nodes_t
Definition: fwd.hh:170
STATE
Computation step of the algorithm.
Definition: k-prm-star.hh:43
PathPlanner Parent_t
Definition: k-prm-star.hh:51
shared_ptr< Roadmap > RoadmapPtr_t
Definition: fwd.hh:188
#define HPP_CORE_DLLAPI
Definition: config.hh:64
Definition: k-prm-star.hh:40