KPIECE1.h
1 /*********************************************************************
2 * Software License Agreement (BSD License)
3 *
4 * Copyright (c) 2008, Willow Garage, Inc.
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 Willow Garage 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_KPIECE1_
38 #define OMPL_GEOMETRIC_PLANNERS_KPIECE_KPIECE1_
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 
49 
74  class KPIECE1 : public base::Planner
75  {
76  public:
77 
80 
81  virtual ~KPIECE1();
82 
84 
85  virtual void clear();
86 
96  void setGoalBias(double goalBias)
97  {
98  goalBias_ = goalBias;
99  }
100 
102  double getGoalBias() const
103  {
104  return goalBias_;
105  }
106 
112  void setRange(double distance)
113  {
114  maxDistance_ = distance;
115  }
116 
118  double getRange() const
119  {
120  return maxDistance_;
121  }
122 
129  void setBorderFraction(double bp)
130  {
131  disc_.setBorderFraction(bp);
132  }
133 
136  double getBorderFraction() const
137  {
138  return disc_.getBorderFraction();
139  }
140 
147  void setMinValidPathFraction(double fraction)
148  {
149  minValidPathFraction_ = fraction;
150  }
151 
153  double getMinValidPathFraction() const
154  {
155  return minValidPathFraction_;
156  }
157 
163  {
165  }
166 
170  {
172  }
173 
176  void setProjectionEvaluator(const base::ProjectionEvaluatorPtr &projectionEvaluator)
177  {
178  projectionEvaluator_ = projectionEvaluator;
179  }
180 
183  void setProjectionEvaluator(const std::string &name)
184  {
185  projectionEvaluator_ = si_->getStateSpace()->getProjection(name);
186  }
187 
190  {
191  return projectionEvaluator_;
192  }
193 
194  virtual void setup();
195 
196  virtual void getPlannerData(base::PlannerData &data) const;
197 
198  protected:
199 
201  class Motion
202  {
203  public:
204 
205  Motion() : state(NULL), parent(NULL)
206  {
207  }
208 
210  Motion(const base::SpaceInformationPtr &si) : state(si->allocState()), parent(NULL)
211  {
212  }
213 
214  ~Motion()
215  {
216  }
217 
220 
223  };
224 
226  void freeMotion(Motion *motion);
227 
230 
233 
238 
243 
245  double goalBias_;
246 
253 
255  double maxDistance_;
256 
259 
262  };
263 
264  }
265 }
266 
267 #endif
double failedExpansionScoreFactor_
When extending a motion from a cell, the extension can fail. If it is, the score of the cell is multi...
Definition: KPIECE1.h:242
Object containing planner generated vertex and edge data. It is assumed that all vertices are unique...
Definition: PlannerData.h:164
Motion * lastGoalMotion_
The most recent goal motion. Used for PlannerData computation.
Definition: KPIECE1.h:261
RNG rng_
The random number generator.
Definition: KPIECE1.h:258
base::State * state
The state contained by this motion.
Definition: KPIECE1.h:219
Representation of a motion for this algorithm.
Definition: KPIECE1.h:201
void freeMotion(Motion *motion)
Free the memory for a motion.
Definition: KPIECE1.cpp:89
A boost shared pointer wrapper for ompl::base::StateSampler.
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: KPIECE1.h:252
Encapsulate a termination condition for a motion planner. Planners will call operator() to decide whe...
Discretization< Motion > disc_
The tree datastructure and the grid that covers it.
Definition: KPIECE1.h:232
void setProjectionEvaluator(const std::string &name)
Set the projection evaluator (select one from the ones registered with the state space).
Definition: KPIECE1.h:183
double goalBias_
The fraction of time the goal is picked as the state to expand towards (if such a state is available)...
Definition: KPIECE1.h:245
void setGoalBias(double goalBias)
Set the goal bias.
Definition: KPIECE1.h:96
const base::ProjectionEvaluatorPtr & getProjectionEvaluator() const
Get the projection evaluator.
Definition: KPIECE1.h:189
void setProjectionEvaluator(const base::ProjectionEvaluatorPtr &projectionEvaluator)
Set the projection evaluator. This class is able to compute the projection of a given state...
Definition: KPIECE1.h:176
double getBorderFraction() const
Get the fraction of time to focus exploration on boundary.
Definition: KPIECE1.h:136
double maxDistance_
The maximum length of a motion to be added to a tree.
Definition: KPIECE1.h:255
Main namespace. Contains everything in this library.
Definition: Cost.h:42
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: KPIECE1.cpp:216
Random number generation. An instance of this class cannot be used by multiple threads at once (membe...
Definition: RandomNumbers.h:54
One-level discretization used for KPIECE.
Kinematic Planning by Interior-Exterior Cell Exploration.
Definition: KPIECE1.h:74
Base class for a planner.
Definition: Planner.h:232
void setRange(double distance)
Set the range the planner is supposed to use.
Definition: KPIECE1.h:112
virtual void clear()
Clear all internal datastructures. Planner settings are not affected. Subsequent calls to solve() wil...
Definition: KPIECE1.cpp:81
A boost shared pointer wrapper for ompl::base::ProjectionEvaluator.
A class to store the exit status of Planner::solve()
Definition: PlannerStatus.h:48
Motion(const base::SpaceInformationPtr &si)
Constructor that allocates memory for the state.
Definition: KPIECE1.h:210
A boost shared pointer wrapper for ompl::base::SpaceInformation.
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: KPIECE1.h:129
KPIECE1(const base::SpaceInformationPtr &si)
Constructor.
Definition: KPIECE1.cpp:43
Definition of an abstract state.
Definition: State.h:50
Motion * parent
The parent motion in the exploration tree.
Definition: KPIECE1.h:222
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 (between 0 and 1).
Definition: KPIECE1.h:147
double getFailedExpansionCellScoreFactor() const
Get the factor that is multiplied to a cell's score if extending a motion from that cell failed...
Definition: KPIECE1.h:169
double getGoalBias() const
Get the goal bias the planner is using.
Definition: KPIECE1.h:102
virtual void setup()
Perform extra configuration steps, if needed. This call will also issue a call to ompl::base::SpaceIn...
Definition: KPIECE1.cpp:66
base::ProjectionEvaluatorPtr projectionEvaluator_
This algorithm uses a discretization (a grid) to guide the exploration. The exploration is imposed on...
Definition: KPIECE1.h:237
base::StateSamplerPtr sampler_
A state space sampler.
Definition: KPIECE1.h:229
SpaceInformationPtr si_
The space information for which planning is done.
Definition: Planner.h:397
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: KPIECE1.cpp:96
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: KPIECE1.h:162
double getRange() const
Get the range the planner is using.
Definition: KPIECE1.h:118
double getMinValidPathFraction() const
Get the value of the fraction set by setMinValidPathFraction()
Definition: KPIECE1.h:153