All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
LBKPIECE1.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_LBKPIECE1_
38 #define OMPL_GEOMETRIC_PLANNERS_KPIECE_LBKPIECE1_
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 
78  class LBKPIECE1 : public base::Planner
79  {
80  public:
81 
84 
85  virtual ~LBKPIECE1(void);
86 
89  void setProjectionEvaluator(const base::ProjectionEvaluatorPtr &projectionEvaluator)
90  {
91  projectionEvaluator_ = projectionEvaluator;
92  }
93 
96  void setProjectionEvaluator(const std::string &name)
97  {
98  projectionEvaluator_ = si_->getStateSpace()->getProjection(name);
99  }
100 
103  {
104  return projectionEvaluator_;
105  }
106 
112  void setRange(double distance)
113  {
114  maxDistance_ = distance;
115  }
116 
118  double getRange(void) const
119  {
120  return maxDistance_;
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 
147  void setMinValidPathFraction(double fraction)
148  {
149  minValidPathFraction_ = fraction;
150  }
151 
153  double getMinValidPathFraction(void) const
154  {
155  return minValidPathFraction_;
156  }
157 
158  virtual void setup(void);
159 
161  virtual void clear(void);
162 
163  virtual void getPlannerData(base::PlannerData &data) const;
164 
165  protected:
166 
168  class Motion
169  {
170  public:
171 
172  Motion(void) : root(NULL), state(NULL), parent(NULL), valid(false)
173  {
174  }
175 
177  Motion(const base::SpaceInformationPtr &si) : root(NULL), state(si->allocState()), parent(NULL), valid(false)
178  {
179  }
180 
181  ~Motion(void)
182  {
183  }
184 
187 
190 
193 
195  bool valid;
196 
198  std::vector<Motion*> children;
199  };
200 
202  void freeMotion(Motion *motion);
203 
205  void removeMotion(Discretization<Motion> &disc, Motion* motion);
206 
212  bool isPathValid(Discretization<Motion> &disc, Motion* motion, base::State *temp);
213 
216 
219 
222 
225 
232 
234  double maxDistance_;
235 
238 
240  std::pair<base::State*, base::State*> connectionPoint_;
241  };
242 
243  }
244 }
245 
246 
247 #endif