All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
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 
43 namespace ompl
44 {
45 
46  namespace geometric
47  {
48 
77  class BKPIECE1 : public base::Planner
78  {
79  public:
80 
83 
84  virtual ~BKPIECE1(void);
85 
88  void setProjectionEvaluator(const base::ProjectionEvaluatorPtr &projectionEvaluator)
89  {
90  projectionEvaluator_ = projectionEvaluator;
91  }
92 
95  void setProjectionEvaluator(const std::string &name)
96  {
97  projectionEvaluator_ = si_->getStateSpace()->getProjection(name);
98  }
99 
102  {
103  return projectionEvaluator_;
104  }
105 
111  void setRange(double distance)
112  {
113  maxDistance_ = distance;
114  }
115 
117  double getRange(void) const
118  {
119  return maxDistance_;
120  }
121 
128  void setBorderFraction(double bp)
129  {
130  dStart_.setBorderFraction(bp);
131  dGoal_.setBorderFraction(bp);
132  }
133 
136  double getBorderFraction(void) const
137  {
138  return dStart_.getBorderFraction();
139  }
140 
146  {
148  }
149 
153  {
155  }
156 
163  void setMinValidPathFraction(double fraction)
164  {
165  minValidPathFraction_ = fraction;
166  }
167 
169  double getMinValidPathFraction(void) const
170  {
171  return minValidPathFraction_;
172  }
173 
174  virtual void setup(void);
175 
177  virtual void clear(void);
178 
179  virtual void getPlannerData(base::PlannerData &data) const;
180 
181  protected:
182 
184  class Motion
185  {
186  public:
187 
188  Motion(void) : root(NULL), state(NULL), parent(NULL)
189  {
190  }
191 
193  Motion(const base::SpaceInformationPtr &si) : root(NULL), state(si->allocState()), parent(NULL)
194  {
195  }
196 
197  ~Motion(void)
198  {
199  }
200 
203 
206 
209  };
210 
212  void freeMotion(Motion *motion);
213 
216 
219 
222 
225 
230 
237 
239  double maxDistance_;
240 
243 
245  std::pair<base::State*, base::State*> connectionPoint_;
246  };
247 
248  }
249 }
250 
251 
252 #endif
virtual void getPlannerData(base::PlannerData &data) const
Get information about the current run of the motion planner. Repeated calls to this function will upd...
Definition: BKPIECE1.cpp:253
void setRange(double distance)
Set the range the planner is supposed to use.
Definition: BKPIECE1.h:111
Object containing planner generated vertex and edge data. It is assumed that all vertices are unique...
Definition: PlannerData.h:164
Discretization< Motion > dGoal_
The goal tree.
Definition: BKPIECE1.h:224
const base::State * root
The root state (start state) that leads to this motion.
Definition: BKPIECE1.h:202
A boost shared pointer wrapper for ompl::base::ValidStateSampler.
Bi-directional KPIECE with one level of discretization.
Definition: BKPIECE1.h:77
void setProjectionEvaluator(const std::string &name)
Set the projection evaluator (select one from the ones registered with the state space).
Definition: BKPIECE1.h:95
void freeMotion(Motion *motion)
Free the memory for a motion.
Definition: BKPIECE1.cpp:236
base::ProjectionEvaluatorPtr projectionEvaluator_
The employed projection evaluator.
Definition: BKPIECE1.h:218
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:88
virtual void setup(void)
Perform extra configuration steps, if needed. This call will also issue a call to ompl::base::SpaceIn...
Definition: BKPIECE1.cpp:63
std::pair< base::State *, base::State * > connectionPoint_
The pair of states in each tree connected during planning. Used for PlannerData computation.
Definition: BKPIECE1.h:245
Encapsulate a termination condition for a motion planner. Planners will call operator() to decide whe...
virtual base::PlannerStatus solve(const base::PlannerTerminationCondition &ptc)
Function that can solve the motion planning problem. This function can be called multiple times on th...
Definition: BKPIECE1.cpp:79
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:229
double getRange(void) const
Get the range the planner is using.
Definition: BKPIECE1.h:117
Discretization< Motion > dStart_
The start tree.
Definition: BKPIECE1.h:221
virtual void clear(void)
Clear all internal datastructures. Planner settings are not affected. Subsequent calls to solve() wil...
Definition: BKPIECE1.cpp:243
RNG rng_
The random number generator.
Definition: BKPIECE1.h:242
const base::ProjectionEvaluatorPtr & getProjectionEvaluator(void) const
Get the projection evaluator.
Definition: BKPIECE1.h:101
Motion(const base::SpaceInformationPtr &si)
Constructor that allocates memory for the state.
Definition: BKPIECE1.h:193
Random number generation. An instance of this class cannot be used by multiple threads at once (membe...
Definition: RandomNumbers.h:54
double maxDistance_
The maximum length of a motion to be added to a tree.
Definition: BKPIECE1.h:239
One-level discretization used for KPIECE.
Base class for a planner.
Definition: Planner.h:227
Representation of a motion for this algorithm.
Definition: BKPIECE1.h:184
A boost shared pointer wrapper for ompl::base::ProjectionEvaluator.
double getMinValidPathFraction(void) const
Get the value of the fraction set by setMinValidPathFraction()
Definition: BKPIECE1.h:169
A class to store the exit status of Planner::solve()
Definition: PlannerStatus.h:48
A boost shared pointer wrapper for ompl::base::SpaceInformation.
void setMinValidPathFraction(double fraction)
When extending a motion, the planner can decide to keep the first valid part of it, even if invalid states are found, as long as the valid part represents a sufficiently large fraction from the original motion. This function sets the minimum acceptable fraction.
Definition: BKPIECE1.h:163
Definition of an abstract state.
Definition: State.h:50
void setFailedExpansionCellScoreFactor(double factor)
When extending a motion from a cell, the extension can be successful or it can fail. If the extension fails, the score of the cell is multiplied by factor. These number should be in the range (0, 1].
Definition: BKPIECE1.h:145
base::State * state
The state contained by this motion.
Definition: BKPIECE1.h:205
Motion * parent
The parent motion in the exploration tree.
Definition: BKPIECE1.h:208
double getFailedExpansionCellScoreFactor(void) const
Get the factor that is multiplied to a cell's score if extending a motion from that cell failed...
Definition: BKPIECE1.h:152
double getBorderFraction(void) const
Get the fraction of time to focus exploration on boundary.
Definition: BKPIECE1.h:136
double minValidPathFraction_
When extending a motion, the planner can decide to keep the first valid part of it, even if invalid states are found, as long as the valid part represents a sufficiently large fraction from the original motion.
Definition: BKPIECE1.h:236
BKPIECE1(const base::SpaceInformationPtr &si)
Constructor.
Definition: BKPIECE1.cpp:42
SpaceInformationPtr si_
The space information for which planning is done.
Definition: Planner.h:392
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:128
base::ValidStateSamplerPtr sampler_
The employed state sampler.
Definition: BKPIECE1.h:215