All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
EST.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_EST_EST_
38 #define OMPL_GEOMETRIC_PLANNERS_EST_EST_
39 
40 #include "ompl/datastructures/Grid.h"
41 #include "ompl/geometric/planners/PlannerIncludes.h"
42 #include "ompl/base/ProjectionEvaluator.h"
43 #include "ompl/datastructures/PDF.h"
44 #include <vector>
45 
46 namespace ompl
47 {
48 
49  namespace geometric
50  {
51 
73  class EST : public base::Planner
74  {
75  public:
76 
78  EST(const base::SpaceInformationPtr &si);
79 
80  virtual ~EST(void);
81 
83 
84  virtual void clear(void);
85 
93  void setGoalBias(double goalBias)
94  {
95  goalBias_ = goalBias;
96  }
97 
99  double getGoalBias(void) const
100  {
101  return goalBias_;
102  }
103 
109  void setRange(double distance)
110  {
111  maxDistance_ = distance;
112  }
113 
115  double getRange(void) const
116  {
117  return maxDistance_;
118  }
119 
122  void setProjectionEvaluator(const base::ProjectionEvaluatorPtr &projectionEvaluator)
123  {
124  projectionEvaluator_ = projectionEvaluator;
125  }
126 
129  void setProjectionEvaluator(const std::string &name)
130  {
131  projectionEvaluator_ = si_->getStateSpace()->getProjection(name);
132  }
133 
136  {
137  return projectionEvaluator_;
138  }
139 
140  virtual void setup(void);
141 
142  virtual void getPlannerData(base::PlannerData &data) const;
143 
144  protected:
145 
147  class Motion
148  {
149  public:
150 
151  Motion(void) : state(NULL), parent(NULL)
152  {
153  }
154 
156  Motion(const base::SpaceInformationPtr &si) : state(si->allocState()), parent(NULL)
157  {
158  }
159 
160  ~Motion(void)
161  {
162  }
163 
166 
169  };
170 
171  struct MotionInfo;
172 
175 
178 
180  struct MotionInfo
181  {
182  Motion* operator[](unsigned int i)
183  {
184  return motions_[i];
185  }
186  const Motion* operator[](unsigned int i) const
187  {
188  return motions_[i];
189  }
190  void push_back(Motion* m)
191  {
192  motions_.push_back(m);
193  }
194  unsigned int size(void) const
195  {
196  return motions_.size();
197  }
198  bool empty(void) const
199  {
200  return motions_.empty();
201  }
202  std::vector<Motion*> motions_;
203  CellPDF::Element* elem_;
204  };
205 
206 
208  struct TreeData
209  {
210  TreeData(void) : grid(0), size(0)
211  {
212  }
213 
216 
218  unsigned int size;
219  };
220 
222  void freeMemory(void);
223 
225  void addMotion(Motion *motion);
226 
228  Motion* selectMotion(void);
229 
232 
235 
238 
240  double goalBias_;
241 
243  double maxDistance_;
244 
247 
250 
253  };
254 
255  }
256 }
257 
258 #endif
RNG rng_
The random number generator.
Definition: EST.h:246
void setProjectionEvaluator(const std::string &name)
Set the projection evaluator (select one from the ones registered with the state space).
Definition: EST.h:129
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: EST.h:252
Representation of a simple grid.
Definition: Grid.h:51
A boost shared pointer wrapper for ompl::base::ValidStateSampler.
The data contained by a tree of exploration.
Definition: EST.h:208
double maxDistance_
The maximum length of a motion to be added to a tree.
Definition: EST.h:243
PDF< GridCell * > CellPDF
A PDF of grid cells.
Definition: EST.h:177
base::ProjectionEvaluatorPtr projectionEvaluator_
This algorithm uses a discretization (a grid) to guide the exploration. The exploration is imposed on...
Definition: EST.h:237
base::ValidStateSamplerPtr sampler_
Valid state sampler.
Definition: EST.h:231
Encapsulate a termination condition for a motion planner. Planners will call operator() to decide whe...
Grid< MotionInfo >::Cell GridCell
A grid cell.
Definition: EST.h:171
base::State * state
The state contained by the motion.
Definition: EST.h:165
Grid< MotionInfo > grid
A grid where each cell contains an array of motions.
Definition: EST.h:215
The definition of a motion.
Definition: EST.h:147
virtual void clear(void)
Clear all internal datastructures. Planner settings are not affected. Subsequent calls to solve() wil...
Definition: EST.cpp:70
unsigned int size
The total number of motions in the grid.
Definition: EST.h:218
const base::ProjectionEvaluatorPtr & getProjectionEvaluator(void) const
Get the projection evaluator.
Definition: EST.h:135
Random number generation. An instance of this class cannot be used by multiple threads at once (membe...
Definition: RandomNumbers.h:54
double getRange(void) const
Get the range the planner is using.
Definition: EST.h:115
Base class for a planner.
Definition: Planner.h:227
Motion(const base::SpaceInformationPtr &si)
Constructor that allocates memory for the state.
Definition: EST.h:156
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: EST.cpp:221
double getGoalBias(void) const
Get the goal bias the planner is using.
Definition: EST.h:99
A boost shared pointer wrapper for ompl::base::ProjectionEvaluator.
A class to store the exit status of Planner::solve()
Definition: PlannerStatus.h:48
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: EST.cpp:94
void freeMemory(void)
Free the memory allocated by this planner.
Definition: EST.cpp:81
A boost shared pointer wrapper for ompl::base::SpaceInformation.
Definition of an abstract state.
Definition: State.h:50
void setRange(double distance)
Set the range the planner is supposed to use.
Definition: EST.h:109
Definition of a cell in this grid.
Definition: Grid.h:59
virtual void setup(void)
Perform extra configuration steps, if needed. This call will also issue a call to ompl::base::SpaceIn...
Definition: EST.cpp:60
void setGoalBias(double goalBias)
In the process of randomly selecting states in the state space to attempt to go towards, the algorithm may in fact choose the actual goal state, if it knows it, with some probability. This probability is a real number between 0.0 and 1.0; its value should usually be around 0.05 and should not be too large. It is probably a good idea to use the default value.
Definition: EST.h:93
EST(const base::SpaceInformationPtr &si)
Constructor.
Definition: EST.cpp:43
CellPDF pdf_
The PDF used for selecting a cell from which to sample a motion.
Definition: EST.h:249
Motion * parent
The parent motion in the exploration tree.
Definition: EST.h:168
void addMotion(Motion *motion)
Add a motion to the exploration tree.
Definition: EST.cpp:201
Motion * selectMotion(void)
Select a motion to continue the expansion of the tree from.
Definition: EST.cpp:195
void setProjectionEvaluator(const base::ProjectionEvaluatorPtr &projectionEvaluator)
Set the projection evaluator. This class is able to compute the projection of a given state...
Definition: EST.h:122
SpaceInformationPtr si_
The space information for which planning is done.
Definition: Planner.h:392
Expansive Space Trees.
Definition: EST.h:73
A struct containing an array of motions and a corresponding PDF element.
Definition: EST.h:180
TreeData tree_
The exploration tree constructed by this algorithm.
Definition: EST.h:234
double goalBias_
The fraction of time the goal is picked as the state to expand towards (if such a state is available)...
Definition: EST.h:240