Loading...
Searching...
No Matches
ompl::base::SubspaceStateSampler Class Reference

Construct a sampler that samples only within a subspace of the space. More...

#include <ompl/base/StateSampler.h>

Inheritance diagram for ompl::base::SubspaceStateSampler:

Public Member Functions

 SubspaceStateSampler (const StateSpace *space, const StateSpace *subspace, double weight)
 Construct a sampler for space but only sample components common to subspace. Use weight as a multiplicative factor for distance and stdDev in the sampleUniformNear() and sampleGaussian() functions. More...
 
void sampleUniform (State *state) override
 Sample a state. More...
 
void sampleUniformNear (State *state, const State *near, double distance) override
 Sample a state near another, within a neighborhood controlled by a distance parameter. More...
 
void sampleGaussian (State *state, const State *mean, double stdDev) override
 Sample a state using a Gaussian distribution with given mean and standard deviation (stdDev). More...
 
- Public Member Functions inherited from ompl::base::StateSampler
 StateSampler (const StateSampler &)=delete
 
StateSampleroperator= (const StateSampler &)=delete
 
 StateSampler (const StateSpace *space)
 Constructor. More...
 
virtual void sampleUniform (State *state)=0
 Sample a state. More...
 
virtual void sampleUniformNear (State *state, const State *near, double distance)=0
 Sample a state near another, within a neighborhood controlled by a distance parameter. More...
 
virtual void sampleGaussian (State *state, const State *mean, double stdDev)=0
 Sample a state using a Gaussian distribution with given mean and standard deviation (stdDev). More...
 

Protected Attributes

const StateSpacesubspace_
 The subspace to sample. More...
 
StateSamplerPtr subspaceSampler_
 The sampler for the subspace. More...
 
double weight_
 The weigth factor to multiply distance and stdDev when sampling in the vicinity of a state. More...
 
std::vector< std::string > subspaces_
 The names of common subspaces between space_ and subspace_; these are the ones copied after sampling a state. More...
 
- Protected Attributes inherited from ompl::base::StateSampler
const StateSpacespace_
 The state space this sampler samples. More...
 
RNG rng_
 An instance of a random number generator. More...
 

Detailed Description

Construct a sampler that samples only within a subspace of the space.

Definition at line 153 of file StateSampler.h.

Constructor & Destructor Documentation

◆ SubspaceStateSampler()

ompl::base::SubspaceStateSampler::SubspaceStateSampler ( const StateSpace space,
const StateSpace subspace,
double  weight 
)

Construct a sampler for space but only sample components common to subspace. Use weight as a multiplicative factor for distance and stdDev in the sampleUniformNear() and sampleGaussian() functions.

Definition at line 73 of file StateSampler.cpp.

◆ ~SubspaceStateSampler()

ompl::base::SubspaceStateSampler::~SubspaceStateSampler ( )
override

Definition at line 85 of file StateSampler.cpp.

Member Function Documentation

◆ sampleGaussian()

void ompl::base::SubspaceStateSampler::sampleGaussian ( State state,
const State mean,
double  stdDev 
)
overridevirtual

Sample a state using a Gaussian distribution with given mean and standard deviation (stdDev).

As with sampleUniform, the implementation of sampleGaussian is specific to the derived class and few assumptions can be made about the distance between state and mean.

Implements ompl::base::StateSampler.

Definition at line 104 of file StateSampler.cpp.

◆ sampleUniform()

void ompl::base::SubspaceStateSampler::sampleUniform ( State state)
overridevirtual

Sample a state.

Implements ompl::base::StateSampler.

Definition at line 91 of file StateSampler.cpp.

◆ sampleUniformNear()

void ompl::base::SubspaceStateSampler::sampleUniformNear ( State state,
const State near,
double  distance 
)
overridevirtual

Sample a state near another, within a neighborhood controlled by a distance parameter.

Typically, StateSampler-derived classes will return in state a state that is uniformly distributed within a ball with radius distance defined by the distance function from the corresponding state space. However, this is not guaranteed. For example, the default state sampler for the RealVectorStateSpace returns samples uniformly distributed using L_inf distance, while the default distance function is L_2 distance.

Implements ompl::base::StateSampler.

Definition at line 97 of file StateSampler.cpp.

Member Data Documentation

◆ subspace_

const StateSpace* ompl::base::SubspaceStateSampler::subspace_
protected

The subspace to sample.

Definition at line 170 of file StateSampler.h.

◆ subspaces_

std::vector<std::string> ompl::base::SubspaceStateSampler::subspaces_
protected

The names of common subspaces between space_ and subspace_; these are the ones copied after sampling a state.

Definition at line 180 of file StateSampler.h.

◆ subspaceSampler_

StateSamplerPtr ompl::base::SubspaceStateSampler::subspaceSampler_
protected

The sampler for the subspace.

Definition at line 173 of file StateSampler.h.

◆ weight_

double ompl::base::SubspaceStateSampler::weight_
protected

The weigth factor to multiply distance and stdDev when sampling in the vicinity of a state.

Definition at line 176 of file StateSampler.h.


The documentation for this class was generated from the following files: