37 #include "ompl/base/samplers/GaussianValidStateSampler.h"
38 #include "ompl/base/SpaceInformation.h"
39 #include "ompl/tools/config/MagicConstants.h"
42 ValidStateSampler(si), sampler_(si->allocStateSampler()), stddev_(si->getMaximumExtent() * magic::STD_DEV_AS_SPACE_EXTENT_FRACTION)
53 unsigned int attempts = 0;
54 State *temp = si_->allocState();
57 sampler_->sampleUniform(state);
58 bool v1 = si_->isValid(state);
59 sampler_->sampleGaussian(temp, state, stddev_);
60 bool v2 = si_->isValid(temp);
64 si_->copyState(state, temp);
68 }
while (!result && attempts < attempts_);
76 unsigned int attempts = 0;
77 State *temp = si_->allocState();
80 sampler_->sampleUniformNear(state, near, distance);
81 bool v1 = si_->isValid(state);
82 sampler_->sampleGaussian(temp, state, distance);
83 bool v2 = si_->isValid(temp);
87 si_->copyState(state, temp);
91 }
while (!result && attempts < attempts_);
virtual bool sample(State *state)
Sample a state. Return false in case of failure.
double getStdDev(void) const
Get the standard deviation used when sampling.
Abstract definition of a state sampler.
virtual bool sampleNear(State *state, const State *near, const double distance)
Sample a state near another, within specified distance. Return false, in case of failure.
Definition of an abstract state.
GaussianValidStateSampler(const SpaceInformation *si)
Constructor.
void declareParam(const std::string &name, const typename SpecificParam< T >::SetterFn &setter, const typename SpecificParam< T >::GetterFn &getter=typename SpecificParam< T >::GetterFn())
This function declares a parameter name, and specifies the setter and getter functions.
void setStdDev(double stddev)
Set the standard deviation to use when sampling.
ParamSet params_
The parameters for this instance of the valid state sampler.
std::string name_
The name of the sampler.