PathLengthDirectInfSampler.cpp
67 // The foci of the PHSs as a std::vector of states. Goals must be nonconst, as we need to allocate them
74 throw Exception("PathLengthDirectInfSampler: The direct path-length informed sampler currently only "
89 throw Exception("PathLengthDirectInfSampler: There must be at least 1 start and and 1 goal state when "
107 OMPL_WARN("PathLengthDirectInfSampler: Treating the StateSpace of type \"STATE_SPACE_UNKNOWN\" as "
165 // Case where we have a compound state space with only one subspace, and said subspace being R^N
202 informedSubSpace_ = InformedSampler::space_->as<CompoundStateSpace>()->getSubspace(informedIdx_);
205 uninformedSubSpace_ = InformedSampler::space_->as<CompoundStateSpace>()->getSubspace(uninformedIdx_);
257 OMPL_WARN("PathLengthDirectInfSampler: Rejection sampling is used in order to maintain uniform density "
276 bool PathLengthDirectInfSampler::sampleUniform(State *statePtr, const Cost &minCost, const Cost &maxCost)
279 // Since volume in a sphere/spheroid is proportionately concentrated near the surface, this isn't horribly
323 // The informed measure is then the sum of the measure of the individual PHSs for the given cost:
326 // It is nonsensical for a PHS to have a transverse diameter less than the distance between its foci, so
330 informedMeasure = informedMeasure + phsPtr->getPhsMeasure(currentCost.value());
367 bool PathLengthDirectInfSampler::sampleUniform(State *statePtr, const Cost &maxCost, unsigned int *iters)
376 {
381 ++(*iters);
393 // When the summed measure of the PHSes are suitably large, it makes more sense to just sample from the
395 // Check if the average measure is greater than half the domain's measure. Half is an arbitrary number.
396 if (informedSubSpace_->getMeasure() < summedMeasure_ / static_cast<double>(listPhsPtrs_.size()))
445 // Due to the possibility of overlap between multiple PHSs, we keep a sample with a probability of 1/K,
480 std::vector<double> PathLengthDirectInfSampler::getInformedSubstate(const State *statePtr) const
493 informedSubSpace_->copyToReals(rawData, statePtr->as<CompoundState>()->components[informedIdx_]);
499 void PathLengthDirectInfSampler::createFullState(State *statePtr, const std::vector<double> &informedVector)
501 // If there is an extra "uninformed" subspace, we need to add that to the state before converting the raw
543 // Check if the specific PHS can ever be better than the given maxCost, i.e., if the distance between
606 // The probability of using each PHS is weighted by it's measure. Therefore, if we iterate up the list
A space to allow the composition of state spaces.
Definition: StateSpace.h:637
ProblemDefinitionPtr probDefn_
A copy of the problem definition.
Definition: InformedStateSampler.h:177
const StateSpacePtr & getSubspace(unsigned int index) const
Get a specific subspace from the compound state space.
Definition: StateSpace.cpp:909
unsigned int getSubspaceCount() const
Get the number of state spaces that make up the compound state space.
Definition: StateSpace.cpp:904
Definition of a cost value. Can represent the cost of a motion or the cost of a state.
Definition: Cost.h:111
PathLengthDirectInfSampler(const ProblemDefinitionPtr &probDefn, unsigned int maxNumberCalls)
Construct a sampler that only generates states with a heuristic solution estimate that is less than t...
Definition: PathLengthDirectInfSampler.cpp:122
double getInformedMeasure(const Cost ¤tCost) const override
The measure of the subset of the state space defined by the current solution cost that is being searc...
Definition: PathLengthDirectInfSampler.cpp:381
Cost heuristicSolnCost(const State *statePtr) const override
A helper function to calculate the heuristic estimate of the solution cost for the informed subset of...
Definition: PathLengthDirectInfSampler.cpp:409
A shared pointer wrapper for ompl::base::ProblemDefinition.
OptimizationObjectivePtr opt_
A copy of the optimization objective.
Definition: InformedStateSampler.h:179
@ GOAL_SAMPLEABLE_REGION
This bit is set if casting to sampleable goal regions (ompl::base::GoalSampleableRegion) is possible.
Definition: GoalTypes.h:152
void uniformProlateHyperspheroid(const std::shared_ptr< const ProlateHyperspheroid > &phsPtr, double value[])
Uniform random sampling of a prolate hyperspheroid, a special symmetric type of n-dimensional ellipse...
Definition: RandomNumbers.cpp:321
unsigned int numIters_
The number of iterations I'm allowed to attempt.
Definition: InformedStateSampler.h:183
bool hasInformedMeasure() const override
Whether the sampler can provide a measure of the informed subset.
Definition: PathLengthDirectInfSampler.cpp:376
A shared pointer wrapper for ompl::base::StateSpace.
A shared pointer wrapper for ompl::base::StateSampler.
Abstract definition of a goal region that can be sampled.
Definition: GoalSampleableRegion.h:111
bool sampleUniform(State *statePtr, const Cost &maxCost) override
Sample uniformly in the subset of the state space whose heuristic solution estimates are less than th...
Definition: PathLengthDirectInfSampler.cpp:330
Main namespace. Contains everything in this library.
Definition: MultiLevelPlanarManipulatorDemo.cpp:65