Space information containing necessary information for planning with controls. setup() needs to be called before use. More...
#include <ompl/control/SpaceInformation.h>
Public Member Functions  
SpaceInformation (const base::StateSpacePtr &stateSpace, ControlSpacePtr controlSpace)  
Constructor. Sets the instance of the state and control spaces to plan with.  
const ControlSpacePtr &  getControlSpace () const 
Get the control space.  
void  printSettings (std::ostream &out=std::cout) const override 
Print information about the current instance of the state space.  
void  setup () override 
Perform additional setup tasks (run once, before use)  
Control memory management  
Control *  allocControl () const 
Allocate memory for a control.  
void  freeControl (Control *control) const 
Free the memory of a control.  
void  copyControl (Control *destination, const Control *source) const 
Copy a control to another.  
Control *  cloneControl (const Control *source) const 
Clone a control.  
Topologyspecific control operations (as in the control space)  
void  printControl (const Control *control, std::ostream &out=std::cout) const 
Print a control to a stream.  
bool  equalControls (const Control *control1, const Control *control2) const 
Check if two controls are the same.  
void  nullControl (Control *control) const 
Make the control have no effect if it were to be applied to a state for any amount of time.  
Sampling of controls  
ControlSamplerPtr  allocControlSampler () const 
Allocate a control sampler.  
void  setMinMaxControlDuration (unsigned int minSteps, unsigned int maxSteps) 
Set the minimum and maximum number of steps a control is propagated for.  
unsigned int  getMinControlDuration () const 
Get the minimum number of steps a control is propagated for.  
unsigned int  getMaxControlDuration () const 
Get the maximum number of steps a control is propagated for.  
DirectedControlSamplerPtr  allocDirectedControlSampler () const 
Allocate an instance of the DirectedControlSampler to use. This will be the default (SimpleDirectedControlSampler) unless setDirectedControlSamplerAllocator() was previously called.  
void  setDirectedControlSamplerAllocator (const DirectedControlSamplerAllocator &dcsa) 
Set the allocator to use for the DirectedControlSampler.  
void  clearDirectedSamplerAllocator () 
Reset the DirectedControlSampler to be the default one.  
Configuration of the state propagator  
const StatePropagatorPtr &  getStatePropagator () const 
Get the instance of StatePropagator that performs state propagation.  
void  setStatePropagator (const StatePropagatorFn &fn) 
Set the function that performs state propagation.  
void  setStatePropagator (const StatePropagatorPtr &sp) 
Set the instance of StatePropagator to perform state propagation.  
void  setPropagationStepSize (double stepSize) 
When controls are applied to states, they are applied for a time duration that is an integer multiple of the stepSize, within the bounds specified by setMinMaxControlDuration()  
double  getPropagationStepSize () const 
Propagation is performed at integer multiples of a specified step size. This function returns the value of this step size.  
Primitives for propagating the model of the system  
void  propagate (const base::State *state, const Control *control, int steps, base::State *result) const 
Propagate the model of the system forward, starting a a given state, with a given control, for a given number of steps. More...  
bool  canPropagateBackward () const 
Some systems can only propagate forward in time (i.e., the steps argument for the propagate() function is always positive). If this is the case, this function will return false. Planners that need backward propagation (negative steps) will call this function to check. If backward propagation is possible, this function will return true (this is the default).  
unsigned int  propagateWhileValid (const base::State *state, const Control *control, int steps, base::State *result) const 
Propagate the model of the system forward, starting at a given state, with a given control, for a given number of steps. Stop if a collision is found and return the number of steps actually performed without collision. If no collision is found, the returned value is equal to the steps argument. If a collision is found after the first step, the return value is 0 and result = state. More...  
void  propagate (const base::State *state, const Control *control, int steps, std::vector< base::State * > &result, bool alloc) const 
Propagate the model of the system forward, starting a a given state, with a given control, for a given number of steps. More...  
unsigned int  propagateWhileValid (const base::State *state, const Control *control, int steps, std::vector< base::State * > &result, bool alloc) const 
Propagate the model of the system forward, starting at a given state, with a given control, for a given number of steps. Stop if a collision is found and return the number of steps actually performed without collision. If no collision is found, the returned value is equal to the steps argument. If a collision is found after the first step, the return value is 0 and no states are added to result. If alloc is false and result cannot store all the generated states, propagation is stopped prematurely (when result is full). The starting state (state) is not included in result. The return value of the function indicates how many states have been written to result. More...  
Public Member Functions inherited from ompl::base::SpaceInformation  
SpaceInformation (const SpaceInformation &)=delete  
SpaceInformation &  operator= (const SpaceInformation &)=delete 
SpaceInformation (StateSpacePtr space)  
Constructor. Sets the instance of the state space to plan with.  
bool  isValid (const State *state) const 
Check if a given state is valid or not.  
const StateSpacePtr &  getStateSpace () const 
Return the instance of the used state space.  
unsigned int  getStateDimension () const 
Return the dimension of the state space.  
double  getSpaceMeasure () const 
Get a measure of the space (this can be thought of as a generalization of volume)  
bool  equalStates (const State *state1, const State *state2) const 
Check if two states are the same.  
bool  satisfiesBounds (const State *state) const 
Check if a state is inside the bounding box.  
double  distance (const State *state1, const State *state2) const 
Compute the distance between two states.  
void  enforceBounds (State *state) const 
Bring the state within the bounds of the state space.  
void  printState (const State *state, std::ostream &out=std::cout) const 
Print a state to a stream.  
void  setStateValidityChecker (const StateValidityCheckerPtr &svc) 
Set the instance of the state validity checker to use. Parallel implementations of planners assume this validity checker is thread safe.  
void  setStateValidityChecker (const StateValidityCheckerFn &svc) 
If no state validity checking class is specified (StateValidityChecker), a function can be specified instead. This version however incurs a small additional overhead when calling the function, since there is one more level of indirection.  
const StateValidityCheckerPtr &  getStateValidityChecker () const 
Return the instance of the used state validity checker.  
void  setMotionValidator (const MotionValidatorPtr &mv) 
Set the instance of the motion validity checker to use. Parallel implementations of planners assume this validity checker is thread safe.  
const MotionValidatorPtr &  getMotionValidator () const 
Return the instance of the used state validity checker.  
MotionValidatorPtr &  getMotionValidator () 
Return the nonconst instance of the used state validity checker.  
void  setStateValidityCheckingResolution (double resolution) 
Set the resolution at which state validity needs to be verified in order for a motion between two states to be considered valid. This value is specified as a fraction of the space's extent. This call is only applicable if a ompl::base::DiscreteMotionValidator is used. See State Validity Checking.  
double  getStateValidityCheckingResolution () const 
Get the resolution at which state validity is verified. This call is only applicable if a ompl::base::DiscreteMotionValidator is used. See State Validity Checking.  
State *  allocState () const 
Allocate memory for a state.  
void  allocStates (std::vector< State * > &states) const 
Allocate memory for each element of the array states.  
void  freeState (State *state) const 
Free the memory of a state.  
void  freeStates (std::vector< State * > &states) const 
Free the memory of an array of states.  
void  copyState (State *destination, const State *source) const 
Copy a state to another.  
State *  cloneState (const State *source) const 
Clone a state.  
StateSamplerPtr  allocStateSampler () const 
Allocate a uniform state sampler for the state space.  
ValidStateSamplerPtr  allocValidStateSampler () const 
Allocate an instance of a valid state sampler for this space. If setValidStateSamplerAllocator() was previously called, the specified allocator is used to produce the state sampler. Otherwise, a ompl::base::UniformValidStateSampler() is allocated.  
void  setValidStateSamplerAllocator (const ValidStateSamplerAllocator &vssa) 
Set the allocator to use for a valid state sampler. This replaces the default uniform valid state sampler. This call can be made at any time, but it should not be changed while ompl::base::Planner::solve() is executing.  
void  clearValidStateSamplerAllocator () 
Clear the allocator used for the valid state sampler. This will revert to using the uniform valid state sampler (the default).  
double  getMaximumExtent () const 
Get the maximum extent of the space we are planning in. This is the maximum distance that could be reported between any two given states.  
bool  searchValidNearby (State *state, const State *near, double distance, unsigned int attempts) const 
Find a valid state near a given one. If the given state is valid, it will be returned itself. The two passed state pointers need not point to different memory. Returns true on success. More...  
bool  searchValidNearby (const ValidStateSamplerPtr &sampler, State *state, const State *near, double distance) const 
Find a valid state near a given one. If the given state is valid, it will be returned itself. The two passed state pointers need not point to different memory. Returns true on success. More...  
unsigned int  randomBounceMotion (const StateSamplerPtr &sss, const State *start, unsigned int steps, std::vector< State * > &states, bool alloc) const 
Produce a valid motion starting at start by randomly bouncing off of invalid states. The start state start is not included in the computed motion (states). Returns the number of elements written to states (less or equal to steps). More...  
virtual bool  checkMotion (const State *s1, const State *s2, std::pair< State *, double > &lastValid) const 
Incrementally check if the path between two motions is valid. Also compute the last state that was valid and the time of that state. The time is used to parametrize the motion from s1 to s2, s1 being at t = 0 and s2 being at t = 1. This function assumes s1 is valid. More...  
virtual bool  checkMotion (const State *s1, const State *s2) const 
Check if the path between two states (from s1 to s2) is valid, using the MotionValidator. This function assumes s1 is valid.  
bool  checkMotion (const std::vector< State * > &states, unsigned int count, unsigned int &firstInvalidStateIndex) const 
Incrementally check if a sequence of states is valid. Given a vector of states, this routine only checks the first count elements and marks the index of the first invalid state. More...  
bool  checkMotion (const std::vector< State * > &states, unsigned int count) const 
Check if a sequence of states is valid using subdivision.  
virtual unsigned int  getMotionStates (const State *s1, const State *s2, std::vector< State * > &states, unsigned int count, bool endpoints, bool alloc) const 
Get count states that make up a motion between s1 and s2. Returns the number of states that were added to states. These states are not checked for validity. If states.size() >= count or alloc is true, the returned value is equal to count (or count + 2, if endpoints is true). Otherwise, fewer states can be returned. More...  
unsigned int  getCheckedMotionCount () const 
Get the total number of motion segments checked by the MotionValidator so far.  
double  probabilityOfValidState (unsigned int attempts) const 
Estimate probability of sampling a valid state. setup() is assumed to have been called.  
double  averageValidMotionLength (unsigned int attempts) const 
Estimate the length of a valid motion. setup() is assumed to have been called.  
void  samplesPerSecond (double &uniform, double &near, double &gaussian, unsigned int attempts) const 
Estimate the number of samples that can be drawn per second, using the sampler returned by allocStateSampler()  
virtual void  printProperties (std::ostream &out=std::cout) const 
Print properties of the current instance of the state space.  
ParamSet &  params () 
Get the combined parameters for the classes that the space information manages.  
const ParamSet &  params () const 
Get the combined parameters for the classes that the space information manages.  
bool  isSetup () const 
Return true if setup was called.  
Protected Attributes  
ControlSpacePtr  controlSpace_ 
The control space describing the space of controls applicable to states in the state space.  
StatePropagatorPtr  statePropagator_ 
The state propagator used to model the motion of the system being planned for.  
unsigned int  minSteps_ 
The minimum number of steps to apply a control for.  
unsigned int  maxSteps_ 
The maximum number of steps to apply a control for.  
DirectedControlSamplerAllocator  dcsa_ 
Optional allocator for the DirectedControlSampler. If not specified, the default implementation is used.  
double  stepSize_ 
The actual duration of each step.  
Protected Attributes inherited from ompl::base::SpaceInformation  
StateSpacePtr  stateSpace_ 
The state space planning is to be performed in.  
StateValidityCheckerPtr  stateValidityChecker_ 
The instance of the state validity checker used for determining the validity of states in the planning process.  
MotionValidatorPtr  motionValidator_ 
The instance of the motion validator to use when determining the validity of motions in the planning process.  
bool  setup_ 
Flag indicating whether setup() has been called on this instance.  
ValidStateSamplerAllocator  vssa_ 
The optional valid state sampler allocator.  
ParamSet  params_ 
Combined parameters for the contained classes.  
Additional Inherited Members  
Protected Member Functions inherited from ompl::base::SpaceInformation  
void  setDefaultMotionValidator () 
Set default motion validator for the state space.  
Detailed Description
Space information containing necessary information for planning with controls. setup() needs to be called before use.
Definition at line 131 of file SpaceInformation.h.
Member Function Documentation
◆ propagate() [1/2]
void ompl::control::SpaceInformation::propagate  (  const base::State *  state, 
const Control *  control,  
int  steps,  
base::State *  result  
)  const 
Propagate the model of the system forward, starting a a given state, with a given control, for a given number of steps.
 Parameters

state the state to start at control the control to apply steps the number of time steps to apply the control for. Each time step is of length getPropagationStepSize() result the state at the end of the propagation
Definition at line 127 of file SpaceInformation.cpp.
◆ propagate() [2/2]
void ompl::control::SpaceInformation::propagate  (  const base::State *  state, 
const Control *  control,  
int  steps,  
std::vector< base::State * > &  result,  
bool  alloc  
)  const 
Propagate the model of the system forward, starting a a given state, with a given control, for a given number of steps.
 Parameters

state the state to start at control the control to apply steps the number of time steps to apply the control for. Each time step is of length getPropagationStepSize(). If steps is negative, backward propagation will be performed. result the set of states along the propagated motion alloc flag indicating whether memory for the states in result should be allocated
 Note
 Start state state is not included in result
Definition at line 201 of file SpaceInformation.cpp.
◆ propagateWhileValid() [1/2]
unsigned int ompl::control::SpaceInformation::propagateWhileValid  (  const base::State *  state, 
const Control *  control,  
int  steps,  
base::State *  result  
)  const 
Propagate the model of the system forward, starting at a given state, with a given control, for a given number of steps. Stop if a collision is found and return the number of steps actually performed without collision. If no collision is found, the returned value is equal to the steps argument. If a collision is found after the first step, the return value is 0 and result = state.
 Parameters

state the state to start at control the control to apply steps the maximum number of time steps to apply the control for. Each time step is of length getPropagationStepSize(). If steps is negative, backward propagation will be performed. result the state at the end of the propagation or the last valid state if a collision is found
Definition at line 146 of file SpaceInformation.cpp.
◆ propagateWhileValid() [2/2]
unsigned int ompl::control::SpaceInformation::propagateWhileValid  (  const base::State *  state, 
const Control *  control,  
int  steps,  
std::vector< base::State * > &  result,  
bool  alloc  
)  const 
Propagate the model of the system forward, starting at a given state, with a given control, for a given number of steps. Stop if a collision is found and return the number of steps actually performed without collision. If no collision is found, the returned value is equal to the steps argument. If a collision is found after the first step, the return value is 0 and no states are added to result. If alloc is false and result cannot store all the generated states, propagation is stopped prematurely (when result is full). The starting state (state) is not included in result. The return value of the function indicates how many states have been written to result.
 Parameters

state the state to start at control the control to apply steps the maximum number of time steps to apply the control for. Each time step is of length getPropagationStepSize(). If steps is negative, backward propagation will be performed. result the set of states along the propagated motion (only valid states included) alloc flag indicating whether memory for the states in result should be allocated
Definition at line 235 of file SpaceInformation.cpp.
The documentation for this class was generated from the following files:
 ompl/control/SpaceInformation.h
 ompl/control/src/SpaceInformation.cpp