42 const constraint_samplers::ConstraintSamplerPtr& cs)
43 : ob::StateSampler(pc->getOMPLStateSpace().
get())
44 , planning_context_(pc)
45 , default_(space_->allocDefaultStateSampler())
46 , constraint_sampler_(cs)
47 , work_state_(pc->getCompleteInitialRobotState())
48 , constrained_success_(0)
49 , constrained_failure_(0)
51 inv_dim_ = space_->getDimension() > 0 ? 1.0 / (double)space_->getDimension() : 1.0;
70 if (space_->satisfiesBounds(state))
87 const double distance)
91 double total_d = space_->distance(state, near);
92 if (total_d > distance)
94 double dist =
pow(rng_.uniform01(),
inv_dim_) * distance;
95 space_->interpolate(near, state, dist / total_d, state);
99 default_->sampleUniformNear(state, near, distance);
106 double total_d = space_->distance(state, mean);
107 double distance = rng_.gaussian(0.0, stdDev);
108 if (total_d > distance)
110 double dist =
pow(rng_.uniform01(),
inv_dim_) * distance;
111 space_->interpolate(mean, state, dist / total_d, state);
115 default_->sampleGaussian(state, mean, stdDev);
constraint_samplers::ConstraintSamplerPtr constraint_sampler_
ompl::base::StateSamplerPtr default_
double getConstrainedSamplingRate() const
ConstrainedSampler(const ModelBasedPlanningContext *pc, const constraint_samplers::ConstraintSamplerPtr &cs)
Default constructor.
const robot_state::RobotState & getCompleteInitialRobotState() const
virtual void sampleGaussian(ompl::base::State *state, const ompl::base::State *mean, const double stdDev)
Sample a state using the specified Gaussian.
virtual void sampleUniformNear(ompl::base::State *state, const ompl::base::State *near, const double distance)
Sample a state (uniformly) within a certain distance of another state.
unsigned int constrained_failure_
unsigned int getMaximumStateSamplingAttempts() const
unsigned int constrained_success_
INLINE Rall1d< T, V, S > pow(const Rall1d< T, V, S > &arg, double m)
bool sampleC(ompl::base::State *state)
virtual void sampleUniform(ompl::base::State *state)
Sample a state (uniformly)
double distance(const urdf::Pose &transform)
const ModelBasedPlanningContext * planning_context_
robot_state::RobotState work_state_
const ModelBasedStateSpacePtr & getOMPLStateSpace() const