50 class MyGoalRegion : public ob::GoalRegion
78 bool regionSamplingWithGS(const ob::SpaceInformationPtr &si, const ob::ProblemDefinitionPtr &pd, const ob::GoalRegion *region, const ob::GoalLazySamples *gls, ob::State *result)
80 og::GeneticSearch g(si);
98 // we continue sampling while we are able to find solutions, we have found not more than 2 previous solutions and we have not yet solved the problem
99 return cont && gls->maxSampleCount() < 3 && !pd->hasSolution();
108 ob::RealVectorBounds bounds(3);
115 og::SimpleSetup ss(space);
118 ob::ScopedState<ob::SE3StateSpace> start(space);
130 ob::GoalSamplingFn samplingFunction = [&ss, ®ion](const ob::GoalLazySamples *gls, ob::State *result)
139 // we set a goal that is sampleable, but it in fact corresponds to a region that is not sampleable by default
143 ob::PlannerStatus solved = ss.solve(3.0);
155 // the region variable will now go out of scope. To make sure it is not used in the sampling function any more
Definition of a goal region that can be sampled, but the sampling process can be slow. This class allows sampling the happen in a separate thread, and the number of goals may increase, as the planner is running, in a thread-safe manner.
A shared pointer wrapper for ompl::base::ProblemDefinition.
virtual double distanceGoal(const State *st) const =0
Compute the distance to the goal (heuristic). This function is the one used in computing the distance...
unsigned int maxSampleCount() const override
Return the maximum number of samples that can be asked for before repeating.
std::function< bool(const GoalLazySamples *, State *)> GoalSamplingFn
Goal sampling function. Returns false when no further calls should be made to it. Fills its second ar...
Create the set of classes typically needed to solve a geometric problem.
const T * as() const
Cast this instance to a desired type.
Define the type of state allocated by this state space.
A class to store the exit status of Planner::solve()
A shared pointer wrapper for ompl::base::SpaceInformation.
This namespace contains sampling based planning routines shared by both planning under geometric cons...
The lower and upper bounds for an Rn space.
void setThreshold(double threshold)
Set the distance to the goal that is allowed for a state to be considered in the goal region...
Genetic Algorithm for searching valid states.