37 #ifndef OMPL_GEOMETRIC_PLANNERS_RRT_pRRT_
38 #define OMPL_GEOMETRIC_PLANNERS_RRT_pRRT_
40 #include "ompl/geometric/planners/PlannerIncludes.h"
41 #include "ompl/base/StateSamplerArray.h"
42 #include "ompl/datastructures/NearestNeighbors.h"
68 class pRRT :
public base::Planner
71 pRRT(
const base::SpaceInformationPtr &si);
77 base::PlannerStatus
solve(
const base::PlannerTerminationCondition &ptc)
override;
79 void clear()
override;
108 maxDistance_ = distance;
120 unsigned int getThreadCount()
const
126 template <
template <
typename T>
class NN>
129 if (nn_ && nn_->size() != 0)
130 OMPL_WARN(
"Calling setNearestNeighbors will clear all states.");
132 nn_ = std::make_shared<NN<Motion *>>();
136 void setup()
override;
144 Motion(
const base::SpaceInformationPtr &si) : state(si->allocState())
151 Motion *parent{
nullptr};
162 void threadSolve(
unsigned int tid,
const base::PlannerTerminationCondition &ptc, SolutionInfo *sol);
165 double distanceFunction(
const Motion *a,
const Motion *b)
const
167 return si_->distance(a->state, b->state);
170 base::StateSamplerArray<base::StateSampler> samplerArray_;
171 std::shared_ptr<NearestNeighbors<Motion *>> nn_;
174 unsigned int threadCount_;
176 double goalBias_{.05};
177 double maxDistance_{0.};
Definition of an abstract state.
Motion * lastGoalMotion_
The most recent goal motion. Used for PlannerData computation.
void setThreadCount(unsigned int nthreads)
Set the number of threads the planner should use. Default is 2.
void getPlannerData(base::PlannerData &data) const override
Get information about the current run of the motion planner. Repeated calls to this function will upd...
void clear() override
Clear all internal datastructures. Planner settings are not affected. Subsequent calls to solve() wil...
void setup() override
Perform extra configuration steps, if needed. This call will also issue a call to ompl::base::SpaceIn...
base::PlannerStatus solve(const base::PlannerTerminationCondition &ptc) override
Function that can solve the motion planning problem. This function can be called multiple times on th...
#define OMPL_WARN(fmt,...)
Log a formatted warning string.
double getGoalBias() const
Get the goal bias the planner is using.
void setRange(double distance)
Set the range the planner is supposed to use.
SpaceInformationPtr si_
The space information for which planning is done.
double getRange() const
Get the range the planner is using.
void setNearestNeighbors()
Set a different nearest neighbors datastructure.
void setGoalBias(double goalBias)
Set the goal bias.
Main namespace. Contains everything in this library.