GoalLazySamples.h
101 GoalLazySamples(const SpaceInformationPtr &si, GoalSamplingFn samplerFunc, bool autoStart = true,
187 };
bool couldSample() const override
Return true if GoalStates::couldSample() is true or if the sampling thread is active,...
Definition: GoalLazySamples.cpp:146
bool isSampling() const
Return true if the sampling thread is active.
Definition: GoalLazySamples.cpp:140
A shared pointer wrapper for ompl::base::SpaceInformation.
GoalLazySamples(const SpaceInformationPtr &si, GoalSamplingFn samplerFunc, bool autoStart=true, double minDist=std::numeric_limits< double >::epsilon())
Create a goal region that can be sampled in a lazy fashion. A function (samplerFunc) that produces sa...
Definition: GoalLazySamples.cpp:43
bool hasStates() const override
Check if there are any states in this goal region.
Definition: GoalLazySamples.cpp:186
std::size_t getStateCount() const override
Return the number of valid goal states.
Definition: GoalLazySamples.cpp:192
unsigned int samplingAttempts_
The number of times the sampling function was called and it returned true.
Definition: GoalLazySamples.h:243
const State * getState(unsigned int index) const override
Return a pointer to the indexth state in the state list.
Definition: GoalLazySamples.cpp:180
bool terminateSamplingThread_
Flag used to notify the sampling thread to terminate sampling.
Definition: GoalLazySamples.h:237
double distanceGoal(const State *st) const override
Compute the distance to the goal (heuristic). This function is the one used in computing the distance...
Definition: GoalLazySamples.cpp:157
double getMinNewSampleDistance() const
Get the minimum distance that a new state returned by the sampling thread needs to be away from previ...
Definition: GoalLazySamples.h:194
double minDist_
Samples returned by the sampling thread are added to the list of states only if they are at least min...
Definition: GoalLazySamples.h:247
void setNewStateCallback(const NewStateCallbackFn &callback)
Set the callback function to be called when a new state is added to the list of possible samples....
Definition: GoalLazySamples.cpp:169
void sampleGoal(State *st) const override
Sample a state in the goal region.
Definition: GoalLazySamples.cpp:163
void goalSamplingThread()
The function that samples goals by calling samplerFunc_ in a separate thread.
Definition: GoalLazySamples.cpp:94
void setMinNewSampleDistance(double dist)
Set the minimum distance that a new state returned by the sampling thread needs to be away from previ...
Definition: GoalLazySamples.h:187
NewStateCallbackFn callback_
If defined, this function is called when a new state is added to the list of possible samples.
Definition: GoalLazySamples.h:250
bool addStateIfDifferent(const State *st, double minDistance)
Add a state st if it further away that minDistance from previously added states. Return true if the s...
Definition: GoalLazySamples.cpp:204
std::function< void(const base::State *)> NewStateCallbackFn
When new samples are generated and added to the list of possible samples, a callback can be called....
Definition: GoalLazySamples.h:140
unsigned int maxSampleCount() const override
Return the maximum number of samples that can be asked for before repeating.
Definition: GoalLazySamples.cpp:198
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...
Definition: GoalLazySamples.h:119
std::thread * samplingThread_
Additional thread for sampling goal states.
Definition: GoalLazySamples.h:240
unsigned int samplingAttemptsCount() const
The number of times the sampling function was called and it returned true.
Definition: GoalLazySamples.h:200