hpp-core: include/hpp/core/path-planner/k-prm-star.hh Source File

hpp-core 9.0.2 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
33#include <hpp/core/path-planner.hh>
34
35namespace hpp {
36namespace core {
37namespace pathPlanner {
38
41
44 class HPP_CORE_DLLAPI kPrmStar : public PathPlanner {
45 public:
47 enum STATE {
48 BUILD_ROADMAP,
49 LINK_NODES,
50 CONNECT_INIT_GOAL,
51 FAILURE
52 }; // enum STATE
54 static const double kPRM;
55 typedef PathPlanner Parent_t;
58 static kPrmStarPtr_t create(const ProblemConstPtr_t& problem);
62 static kPrmStarPtr_t createWithRoadmap(const ProblemConstPtr_t& problem,
63 const RoadmapPtr_t& roadmap);
67 virtual void startSolve();
70 virtual void tryConnectInitAndGoals();
72 virtual void oneStep();
74 STATE getComputationState() const;
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
hpp::core::Node
Definition node.hh:46
hpp::core::PathPlanner
Definition path-planner.hh:45
hpp::core::pathPlanner::kPrmStar
Definition k-prm-star.hh:44
hpp::core::pathPlanner::kPrmStar::getComputationState
STATE getComputationState() const
get the computationnal state of the algorithm
hpp::core::pathPlanner::kPrmStar::tryConnectInitAndGoals
virtual void tryConnectInitAndGoals()
hpp::core::pathPlanner::kPrmStar::Parent_t
PathPlanner Parent_t
Definition k-prm-star.hh:55
hpp::core::pathPlanner::kPrmStar::oneStep
virtual void oneStep()
One step of the algorithm.
hpp::core::pathPlanner::kPrmStar::create
static kPrmStarPtr_t create(const ProblemConstPtr_t &problem)
hpp::core::pathPlanner::kPrmStar::kPrmStar
kPrmStar(const ProblemConstPtr_t &problem, const RoadmapPtr_t &roadmap)
hpp::core::pathPlanner::kPrmStar::init
void init(const kPrmStarWkPtr_t &weak)
Store weak pointer to itself.
hpp::core::pathPlanner::kPrmStar::kPrmStar
kPrmStar(const ProblemConstPtr_t &problem)
hpp::core::pathPlanner::kPrmStar::kPRM
static const double kPRM
Constant kPRM = 2 e.
Definition k-prm-star.hh:54
hpp::core::pathPlanner::kPrmStar::createWithRoadmap
static kPrmStarPtr_t createWithRoadmap(const ProblemConstPtr_t &problem, const RoadmapPtr_t &roadmap)
hpp::core::pathPlanner::kPrmStar::startSolve
virtual void startSolve()
hpp::core::pathPlanner::kPrmStar::STATE
STATE
Computation step of the algorithm.
Definition k-prm-star.hh:47
hpp::core::pathPlanner::kPrmStar::CONNECT_INIT_GOAL
@ CONNECT_INIT_GOAL
Definition k-prm-star.hh:50
hpp::core::pathPlanner::kPrmStar::BUILD_ROADMAP
@ BUILD_ROADMAP
Definition k-prm-star.hh:48
hpp::core::pathPlanner::kPrmStar::LINK_NODES
@ LINK_NODES
Definition k-prm-star.hh:49
HPP_CORE_DLLAPI
#define HPP_CORE_DLLAPI
Definition config.hh:88
hpp
hpp::core::pathPlanner::kPrmStarPtr_t
shared_ptr< kPrmStar > kPrmStarPtr_t
Definition fwd.hh:315
hpp::core::RoadmapPtr_t
shared_ptr< Roadmap > RoadmapPtr_t
Definition fwd.hh:199
hpp::core::size_type
pinocchio::size_type size_type
Definition fwd.hh:173
hpp::core::ProblemConstPtr_t
shared_ptr< const Problem > ProblemConstPtr_t
Definition fwd.hh:197
hpp::core::Nodes_t
std::list< NodePtr_t > Nodes_t
Definition fwd.hh:181
path-planner.hh