BKPIECE1.h
1/*********************************************************************
2* Software License Agreement (BSD License)
3*
4* Copyright (c) 2008, Rice University,
5* All rights reserved.
6*
7* Redistribution and use in source and binary forms, with or without
8* modification, are permitted provided that the following conditions
9* are met:
10*
11* * Redistributions of source code must retain the above copyright
12* notice, this list of conditions and the following disclaimer.
13* * Redistributions in binary form must reproduce the above
14* copyright notice, this list of conditions and the following
15* disclaimer in the documentation and/or other materials provided
16* with the distribution.
17* * Neither the name of the Rice University nor the names of its
18* contributors may be used to endorse or promote products derived
19* from this software without specific prior written permission.
20*
21* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32* POSSIBILITY OF SUCH DAMAGE.
33*********************************************************************/
34
35/* Author: Ioan Sucan */
36
37#ifndef OMPL_GEOMETRIC_PLANNERS_KPIECE_BKPIECE1_
38#define OMPL_GEOMETRIC_PLANNERS_KPIECE_BKPIECE1_
39
40#include "ompl/geometric/planners/PlannerIncludes.h"
41#include "ompl/geometric/planners/kpiece/Discretization.h"
42
43namespace ompl
44{
45 namespace geometric
46 {
73 class BKPIECE1 : public base::Planner
74 {
75 public:
77 BKPIECE1(const base::SpaceInformationPtr &si);
78
79 ~BKPIECE1() override;
80
83 void setProjectionEvaluator(const base::ProjectionEvaluatorPtr &projectionEvaluator)
84 {
85 projectionEvaluator_ = projectionEvaluator;
86 }
87
90 void setProjectionEvaluator(const std::string &name)
91 {
92 projectionEvaluator_ = si_->getStateSpace()->getProjection(name);
93 }
94
96 const base::ProjectionEvaluatorPtr &getProjectionEvaluator() const
97 {
99 }
100
106 void setRange(double distance)
107 {
108 maxDistance_ = distance;
109 }
110
112 double getRange() const
113 {
114 return maxDistance_;
115 }
116
123 void setBorderFraction(double bp)
124 {
125 dStart_.setBorderFraction(bp);
126 dGoal_.setBorderFraction(bp);
127 }
128
131 double getBorderFraction() const
132 {
133 return dStart_.getBorderFraction();
134 }
135
141 {
143 }
144
148 {
150 }
151
158 void setMinValidPathFraction(double fraction)
159 {
160 minValidPathFraction_ = fraction;
161 }
162
165 {
167 }
168
169 void setup() override;
170
172 void clear() override;
173
174 void getPlannerData(base::PlannerData &data) const override;
175
176 protected:
178 class Motion
179 {
180 public:
181 Motion() = default;
182
184 Motion(const base::SpaceInformationPtr &si) : state(si->allocState())
185 {
186 }
187
188 ~Motion() = default;
189
191 const base::State *root{nullptr};
192
195
197 Motion *parent{nullptr};
198 };
199
201 void freeMotion(Motion *motion);
202
204 base::ValidStateSamplerPtr sampler_;
205
207 base::ProjectionEvaluatorPtr projectionEvaluator_;
208
211
214
219
226
228 double maxDistance_{0.};
229
232
234 std::pair<base::State *, base::State *> connectionPoint_{nullptr, nullptr};
235 };
236 }
237}
238
239#endif
Random number generation. An instance of this class cannot be used by multiple threads at once (membe...
Definition: RandomNumbers.h:58
Object containing planner generated vertex and edge data. It is assumed that all vertices are unique,...
Definition: PlannerData.h:175
Encapsulate a termination condition for a motion planner. Planners will call operator() to decide whe...
Base class for a planner.
Definition: Planner.h:223
SpaceInformationPtr si_
The space information for which planning is done.
Definition: Planner.h:417
Definition of an abstract state.
Definition: State.h:50
Representation of a motion for this algorithm.
Definition: BKPIECE1.h:179
Motion * parent
The parent motion in the exploration tree.
Definition: BKPIECE1.h:197
base::State * state
The state contained by this motion.
Definition: BKPIECE1.h:194
const base::State * root
The root state (start state) that leads to this motion.
Definition: BKPIECE1.h:191
Motion(const base::SpaceInformationPtr &si)
Constructor that allocates memory for the state.
Definition: BKPIECE1.h:184
Bi-directional KPIECE with one level of discretization.
Definition: BKPIECE1.h:74
void setFailedExpansionCellScoreFactor(double factor)
When extending a motion from a cell, the extension can be successful or it can fail....
Definition: BKPIECE1.h:140
void setProjectionEvaluator(const std::string &name)
Set the projection evaluator (select one from the ones registered with the state space).
Definition: BKPIECE1.h:90
void setProjectionEvaluator(const base::ProjectionEvaluatorPtr &projectionEvaluator)
Set the projection evaluator. This class is able to compute the projection of a given state.
Definition: BKPIECE1.h:83
void getPlannerData(base::PlannerData &data) const override
Get information about the current run of the motion planner. Repeated calls to this function will upd...
Definition: BKPIECE1.cpp:252
double maxDistance_
The maximum length of a motion to be added to a tree.
Definition: BKPIECE1.h:228
void setMinValidPathFraction(double fraction)
When extending a motion, the planner can decide to keep the first valid part of it,...
Definition: BKPIECE1.h:158
double getMinValidPathFraction() const
Get the value of the fraction set by setMinValidPathFraction()
Definition: BKPIECE1.h:164
BKPIECE1(const base::SpaceInformationPtr &si)
Constructor.
Definition: BKPIECE1.cpp:42
base::PlannerStatus solve(const base::PlannerTerminationCondition &ptc) override
Function that can solve the motion planning problem. This function can be called multiple times on th...
Definition: BKPIECE1.cpp:76
RNG rng_
The random number generator.
Definition: BKPIECE1.h:231
std::pair< base::State *, base::State * > connectionPoint_
The pair of states in each tree connected during planning. Used for PlannerData computation.
Definition: BKPIECE1.h:234
void setBorderFraction(double bp)
Set the fraction of time for focusing on the border (between 0 and 1). This is the minimum fraction u...
Definition: BKPIECE1.h:123
Discretization< Motion > dGoal_
The goal tree.
Definition: BKPIECE1.h:213
double getBorderFraction() const
Get the fraction of time to focus exploration on boundary.
Definition: BKPIECE1.h:131
const base::ProjectionEvaluatorPtr & getProjectionEvaluator() const
Get the projection evaluator.
Definition: BKPIECE1.h:96
base::ValidStateSamplerPtr sampler_
The employed state sampler.
Definition: BKPIECE1.h:204
double failedExpansionScoreFactor_
When extending a motion from a cell, the extension can fail. If it is, the score of the cell is multi...
Definition: BKPIECE1.h:218
double minValidPathFraction_
When extending a motion, the planner can decide to keep the first valid part of it,...
Definition: BKPIECE1.h:225
Discretization< Motion > dStart_
The start tree.
Definition: BKPIECE1.h:210
void setup() override
Perform extra configuration steps, if needed. This call will also issue a call to ompl::base::SpaceIn...
Definition: BKPIECE1.cpp:60
void setRange(double distance)
Set the range the planner is supposed to use.
Definition: BKPIECE1.h:106
void clear() override
Clear all internal datastructures. Planner settings are not affected. Subsequent calls to solve() wil...
Definition: BKPIECE1.cpp:242
base::ProjectionEvaluatorPtr projectionEvaluator_
The employed projection evaluator.
Definition: BKPIECE1.h:207
double getRange() const
Get the range the planner is using.
Definition: BKPIECE1.h:112
void freeMotion(Motion *motion)
Free the memory for a motion.
Definition: BKPIECE1.cpp:235
double getFailedExpansionCellScoreFactor() const
Get the factor that is multiplied to a cell's score if extending a motion from that cell failed.
Definition: BKPIECE1.h:147
One-level discretization used for KPIECE.
Main namespace. Contains everything in this library.
A class to store the exit status of Planner::solve()
Definition: PlannerStatus.h:49