00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #ifndef OMPL_GEOMETRIC_PLANNERS_KPIECE_BKPIECE1_
00038 #define OMPL_GEOMETRIC_PLANNERS_KPIECE_BKPIECE1_
00039
00040 #include "ompl/geometric/planners/PlannerIncludes.h"
00041 #include "ompl/geometric/planners/kpiece/Discretization.h"
00042
00043 namespace ompl
00044 {
00045
00046 namespace geometric
00047 {
00048
00080 class BKPIECE1 : public base::Planner
00081 {
00082 public:
00083
00085 BKPIECE1(const base::SpaceInformationPtr &si) : base::Planner(si, "BKPIECE1"),
00086 dStart_(boost::bind(&BKPIECE1::freeMotion, this, _1)),
00087 dGoal_(boost::bind(&BKPIECE1::freeMotion, this, _1))
00088 {
00089 type_ = base::PLAN_TO_GOAL_SAMPLEABLE_REGION;
00090
00091 minValidPathFraction_ = 0.5;
00092 badScoreFactor_ = 0.5;
00093 goodScoreFactor_ = 0.9;
00094 maxDistance_ = 0.0;
00095 }
00096
00097 virtual ~BKPIECE1(void)
00098 {
00099 }
00100
00103 void setProjectionEvaluator(const base::ProjectionEvaluatorPtr &projectionEvaluator)
00104 {
00105 projectionEvaluator_ = projectionEvaluator;
00106 }
00107
00110 void setProjectionEvaluator(const std::string &name)
00111 {
00112 projectionEvaluator_ = si_->getStateSpace()->getProjection(name);
00113 }
00114
00116 const base::ProjectionEvaluatorPtr& getProjectionEvaluator(void) const
00117 {
00118 return projectionEvaluator_;
00119 }
00120
00126 void setRange(double distance)
00127 {
00128 maxDistance_ = distance;
00129 }
00130
00132 double getRange(void) const
00133 {
00134 return maxDistance_;
00135 }
00136
00143 void setBorderFraction(double bp)
00144 {
00145 dStart_.setBorderFraction(bp);
00146 dGoal_.setBorderFraction(bp);
00147 }
00148
00151 double getBorderFraction(void) const
00152 {
00153 return dStart_.getBorderFraction();
00154 }
00155
00162 void setCellScoreFactor(double good, double bad)
00163 {
00164 goodScoreFactor_ = good;
00165 badScoreFactor_ = bad;
00166 }
00167
00170 double getGoodCellScoreFactor(void) const
00171 {
00172 return goodScoreFactor_;
00173 }
00174
00177 double getBadCellScoreFactor(void) const
00178 {
00179 return badScoreFactor_;
00180 }
00181
00188 void setMinValidPathFraction(double fraction)
00189 {
00190 minValidPathFraction_ = fraction;
00191 }
00192
00194 double getMinValidPathFraction(void) const
00195 {
00196 return minValidPathFraction_;
00197 }
00198
00199 virtual void setup(void);
00200
00201 virtual bool solve(const base::PlannerTerminationCondition &ptc);
00202 virtual void clear(void);
00203
00204 virtual void getPlannerData(base::PlannerData &data) const;
00205
00206 protected:
00207
00209 class Motion
00210 {
00211 public:
00212
00213 Motion(void) : root(NULL), state(NULL), parent(NULL)
00214 {
00215 }
00216
00218 Motion(const base::SpaceInformationPtr &si) : root(NULL), state(si->allocState()), parent(NULL)
00219 {
00220 }
00221
00222 ~Motion(void)
00223 {
00224 }
00225
00227 const base::State *root;
00228
00230 base::State *state;
00231
00233 Motion *parent;
00234 };
00235
00237 void freeMotion(Motion *motion);
00238
00240 base::ValidStateSamplerPtr sampler_;
00241
00243 base::ProjectionEvaluatorPtr projectionEvaluator_;
00244
00246 Discretization<Motion> dStart_;
00247
00249 Discretization<Motion> dGoal_;
00250
00254 double goodScoreFactor_;
00255
00259 double badScoreFactor_;
00260
00266 double minValidPathFraction_;
00267
00269 double maxDistance_;
00270
00272 RNG rng_;
00273 };
00274
00275 }
00276 }
00277
00278
00279 #endif