hpp-core 4.15.1
Implement basic classes for canonical path planning for kinematic chains.
Loading...
Searching...
No Matches
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
34
35namespace hpp {
36namespace core {
37namespace 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);
59 const RoadmapPtr_t& roadmap);
63 virtual void startSolve();
66 virtual void tryConnectInitAndGoals();
68 virtual void oneStep();
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: node.hh:46
Definition: path-planner.hh:45
Definition: k-prm-star.hh:40
STATE getComputationState() const
get the computationnal state of the algorithm
PathPlanner Parent_t
Definition: k-prm-star.hh:51
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:50
static kPrmStarPtr_t createWithRoadmap(const ProblemConstPtr_t &problem, const RoadmapPtr_t &roadmap)
STATE
Computation step of the algorithm.
Definition: k-prm-star.hh:43
@ CONNECT_INIT_GOAL
Definition: k-prm-star.hh:46
@ BUILD_ROADMAP
Definition: k-prm-star.hh:44
@ LINK_NODES
Definition: k-prm-star.hh:45
#define HPP_CORE_DLLAPI
Definition: config.hh:64
shared_ptr< kPrmStar > kPrmStarPtr_t
Definition: fwd.hh:302
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