Loading...
Searching...
No Matches
ompl::control::SpaceInformation Class Reference

Space information containing necessary information for planning with controls. setup() needs to be called before use. More...

#include <ompl/control/SpaceInformation.h>

Inheritance diagram for ompl::control::SpaceInformation:

Public Member Functions

 SpaceInformation (const base::StateSpacePtr &stateSpace, ControlSpacePtr controlSpace)
 Constructor. Sets the instance of the state and control spaces to plan with. More...
 
const ControlSpacePtrgetControlSpace () const
 Get the control space. More...
 
void printSettings (std::ostream &out=std::cout) const override
 Print information about the current instance of the state space. More...
 
void setup () override
 Perform additional setup tasks (run once, before use) More...
 
Control memory management
ControlallocControl () const
 Allocate memory for a control. More...
 
void freeControl (Control *control) const
 Free the memory of a control. More...
 
void copyControl (Control *destination, const Control *source) const
 Copy a control to another. More...
 
ControlcloneControl (const Control *source) const
 Clone a control. More...
 
Topology-specific control operations (as in the control space)
void printControl (const Control *control, std::ostream &out=std::cout) const
 Print a control to a stream. More...
 
bool equalControls (const Control *control1, const Control *control2) const
 Check if two controls are the same. More...
 
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. More...
 
Sampling of controls
ControlSamplerPtr allocControlSampler () const
 Allocate a control sampler. More...
 
void setMinMaxControlDuration (unsigned int minSteps, unsigned int maxSteps)
 Set the minimum and maximum number of steps a control is propagated for. More...
 
void setMinControlDuration (unsigned int minSteps)
 Set the minimum number of steps a control is propagated for. More...
 
void setMaxControlDuration (unsigned int maxSteps)
 Set the minimum and maximum number of steps a control is propagated for. More...
 
unsigned int getMinControlDuration () const
 Get the minimum number of steps a control is propagated for. More...
 
unsigned int getMaxControlDuration () const
 Get the maximum number of steps a control is propagated for. More...
 
DirectedControlSamplerPtr allocDirectedControlSampler () const
 Allocate an instance of the DirectedControlSampler to use. This will be the default (SimpleDirectedControlSampler) unless setDirectedControlSamplerAllocator() was previously called. More...
 
void setDirectedControlSamplerAllocator (const DirectedControlSamplerAllocator &dcsa)
 Set the allocator to use for the DirectedControlSampler. More...
 
void clearDirectedSamplerAllocator ()
 Reset the DirectedControlSampler to be the default one. More...
 
Configuration of the state propagator
const StatePropagatorPtrgetStatePropagator () const
 Get the instance of StatePropagator that performs state propagation. More...
 
void setStatePropagator (const StatePropagatorFn &fn)
 Set the function that performs state propagation. More...
 
void setStatePropagator (const StatePropagatorPtr &sp)
 Set the instance of StatePropagator to perform state propagation. More...
 
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() More...
 
double getPropagationStepSize () const
 Propagation is performed at integer multiples of a specified step size. This function returns the value of this step size. More...
 
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). More...
 
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
 
SpaceInformationoperator= (const SpaceInformation &)=delete
 
 SpaceInformation (StateSpacePtr space)
 Constructor. Sets the instance of the state space to plan with. More...
 
bool isValid (const State *state) const
 Check if a given state is valid or not. More...
 
const StateSpacePtrgetStateSpace () const
 Return the instance of the used state space. More...
 
unsigned int getStateDimension () const
 Return the dimension of the state space. More...
 
double getSpaceMeasure () const
 Get a measure of the space (this can be thought of as a generalization of volume) More...
 
bool equalStates (const State *state1, const State *state2) const
 Check if two states are the same. More...
 
bool satisfiesBounds (const State *state) const
 Check if a state is inside the bounding box. More...
 
double distance (const State *state1, const State *state2) const
 Compute the distance between two states. More...
 
void enforceBounds (State *state) const
 Bring the state within the bounds of the state space. More...
 
void printState (const State *state, std::ostream &out=std::cout) const
 Print a state to a stream. More...
 
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. More...
 
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. More...
 
const StateValidityCheckerPtrgetStateValidityChecker () const
 Return the instance of the used state validity checker. More...
 
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.
More...
 
const MotionValidatorPtrgetMotionValidator () const
 Return the instance of the used state validity checker. More...
 
MotionValidatorPtrgetMotionValidator ()
 Return the non-const instance of the used state validity checker. More...
 
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. More...
 
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. More...
 
StateallocState () const
 Allocate memory for a state. More...
 
void allocStates (std::vector< State * > &states) const
 Allocate memory for each element of the array states. More...
 
void freeState (State *state) const
 Free the memory of a state. More...
 
void freeStates (std::vector< State * > &states) const
 Free the memory of an array of states. More...
 
void copyState (State *destination, const State *source) const
 Copy a state to another. More...
 
StatecloneState (const State *source) const
 Clone a state. More...
 
StateSamplerPtr allocStateSampler () const
 Allocate a uniform state sampler for the state space. More...
 
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. More...
 
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. More...
 
void clearValidStateSamplerAllocator ()
 Clear the allocator used for the valid state sampler. This will revert to using the uniform valid state sampler (the default). More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
double probabilityOfValidState (unsigned int attempts) const
 Estimate probability of sampling a valid state. setup() is assumed to have been called. More...
 
double averageValidMotionLength (unsigned int attempts) const
 Estimate the length of a valid motion. setup() is assumed to have been called. More...
 
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() More...
 
virtual void printProperties (std::ostream &out=std::cout) const
 Print properties of the current instance of the state space. More...
 
ParamSetparams ()
 Get the combined parameters for the classes that the space information manages. More...
 
const ParamSetparams () const
 Get the combined parameters for the classes that the space information manages. More...
 
bool isSetup () const
 Return true if setup was called. More...
 

Protected Member Functions

void declareParams ()
 
- Protected Member Functions inherited from ompl::base::SpaceInformation
void setDefaultMotionValidator ()
 Set default motion validator for the state space. More...
 

Protected Attributes

ControlSpacePtr controlSpace_
 The control space describing the space of controls applicable to states in the state space. More...
 
StatePropagatorPtr statePropagator_
 The state propagator used to model the motion of the system being planned for. More...
 
unsigned int minSteps_ {0}
 The minimum number of steps to apply a control for. More...
 
unsigned int maxSteps_ {0}
 The maximum number of steps to apply a control for. More...
 
DirectedControlSamplerAllocator dcsa_
 Optional allocator for the DirectedControlSampler. If not specified, the default implementation is used. More...
 
double stepSize_ {0.}
 The actual duration of each step. More...
 
- Protected Attributes inherited from ompl::base::SpaceInformation
StateSpacePtr stateSpace_
 The state space planning is to be performed in. More...
 
StateValidityCheckerPtr stateValidityChecker_
 The instance of the state validity checker used for determining the validity of states in the planning process. More...
 
MotionValidatorPtr motionValidator_
 The instance of the motion validator to use when determining the validity of motions in the planning process. More...
 
bool setup_
 Flag indicating whether setup() has been called on this instance. More...
 
ValidStateSamplerAllocator vssa_
 The optional valid state sampler allocator. More...
 
ParamSet params_
 Combined parameters for the contained classes. More...
 

Detailed Description

Space information containing necessary information for planning with controls. setup() needs to be called before use.

Definition at line 70 of file SpaceInformation.h.

Constructor & Destructor Documentation

◆ SpaceInformation()

ompl::control::SpaceInformation::SpaceInformation ( const base::StateSpacePtr &  stateSpace,
ControlSpacePtr  controlSpace 
)

Constructor. Sets the instance of the state and control spaces to plan with.

Definition at line 45 of file SpaceInformation.cpp.

◆ ~SpaceInformation()

ompl::control::SpaceInformation::~SpaceInformation ( )
overridevirtualdefault

Reimplemented from ompl::base::SpaceInformation.

Member Function Documentation

◆ allocControl()

Control * ompl::control::SpaceInformation::allocControl ( ) const
inline

Allocate memory for a control.

Definition at line 88 of file SpaceInformation.h.

◆ allocControlSampler()

ControlSamplerPtr ompl::control::SpaceInformation::allocControlSampler ( ) const
inline

Allocate a control sampler.

Definition at line 142 of file SpaceInformation.h.

◆ allocDirectedControlSampler()

ompl::control::DirectedControlSamplerPtr ompl::control::SpaceInformation::allocDirectedControlSampler ( ) const

Allocate an instance of the DirectedControlSampler to use. This will be the default (SimpleDirectedControlSampler) unless setDirectedControlSamplerAllocator() was previously called.

Definition at line 95 of file SpaceInformation.cpp.

◆ canPropagateBackward()

bool ompl::control::SpaceInformation::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).

Definition at line 144 of file SpaceInformation.cpp.

◆ clearDirectedSamplerAllocator()

void ompl::control::SpaceInformation::clearDirectedSamplerAllocator ( )

Reset the DirectedControlSampler to be the default one.

Definition at line 111 of file SpaceInformation.cpp.

◆ cloneControl()

Control * ompl::control::SpaceInformation::cloneControl ( const Control source) const
inline

Clone a control.

Definition at line 106 of file SpaceInformation.h.

◆ copyControl()

void ompl::control::SpaceInformation::copyControl ( Control destination,
const Control source 
) const
inline

Copy a control to another.

Definition at line 100 of file SpaceInformation.h.

◆ declareParams()

void ompl::control::SpaceInformation::declareParams ( )
protected

Declare parameter settings

Definition at line 52 of file SpaceInformation.cpp.

◆ equalControls()

bool ompl::control::SpaceInformation::equalControls ( const Control control1,
const Control control2 
) const
inline

Check if two controls are the same.

Definition at line 125 of file SpaceInformation.h.

◆ freeControl()

void ompl::control::SpaceInformation::freeControl ( Control control) const
inline

Free the memory of a control.

Definition at line 94 of file SpaceInformation.h.

◆ getControlSpace()

const ControlSpacePtr & ompl::control::SpaceInformation::getControlSpace ( ) const
inline

Get the control space.

Definition at line 79 of file SpaceInformation.h.

◆ getMaxControlDuration()

unsigned int ompl::control::SpaceInformation::getMaxControlDuration ( ) const
inline

Get the maximum number of steps a control is propagated for.

Definition at line 173 of file SpaceInformation.h.

◆ getMinControlDuration()

unsigned int ompl::control::SpaceInformation::getMinControlDuration ( ) const
inline

Get the minimum number of steps a control is propagated for.

Definition at line 167 of file SpaceInformation.h.

◆ getPropagationStepSize()

double ompl::control::SpaceInformation::getPropagationStepSize ( ) const
inline

Propagation is performed at integer multiples of a specified step size. This function returns the value of this step size.

Definition at line 215 of file SpaceInformation.h.

◆ getStatePropagator()

const StatePropagatorPtr & ompl::control::SpaceInformation::getStatePropagator ( ) const
inline

Get the instance of StatePropagator that performs state propagation.

Definition at line 195 of file SpaceInformation.h.

◆ nullControl()

void ompl::control::SpaceInformation::nullControl ( Control control) const
inline

Make the control have no effect if it were to be applied to a state for any amount of time.

Definition at line 131 of file SpaceInformation.h.

◆ printControl()

void ompl::control::SpaceInformation::printControl ( const Control control,
std::ostream &  out = std::cout 
) const
inline

Print a control to a stream.

Definition at line 119 of file SpaceInformation.h.

◆ printSettings()

void ompl::control::SpaceInformation::printSettings ( std::ostream &  out = std::cout) const
overridevirtual

Print information about the current instance of the state space.

Reimplemented from ompl::base::SpaceInformation.

Definition at line 315 of file SpaceInformation.cpp.

◆ 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
statethe state to start at
controlthe control to apply
stepsthe number of time steps to apply the control for. Each time step is of length getPropagationStepSize()
resultthe state at the end of the propagation

Definition at line 149 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
statethe state to start at
controlthe control to apply
stepsthe 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.
resultthe set of states along the propagated motion
allocflag indicating whether memory for the states in result should be allocated
Note
Start state state is not included in result

Definition at line 223 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
statethe state to start at
controlthe control to apply
stepsthe 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.
resultthe state at the end of the propagation or the last valid state if a collision is found

Definition at line 168 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
statethe state to start at
controlthe control to apply
stepsthe 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.
resultthe set of states along the propagated motion (only valid states included)
allocflag indicating whether memory for the states in result should be allocated

Definition at line 257 of file SpaceInformation.cpp.

◆ setDirectedControlSamplerAllocator()

void ompl::control::SpaceInformation::setDirectedControlSamplerAllocator ( const DirectedControlSamplerAllocator dcsa)

Set the allocator to use for the DirectedControlSampler.

Definition at line 105 of file SpaceInformation.cpp.

◆ setMaxControlDuration()

void ompl::control::SpaceInformation::setMaxControlDuration ( unsigned int  maxSteps)
inline

Set the minimum and maximum number of steps a control is propagated for.

Definition at line 161 of file SpaceInformation.h.

◆ setMinControlDuration()

void ompl::control::SpaceInformation::setMinControlDuration ( unsigned int  minSteps)
inline

Set the minimum number of steps a control is propagated for.

Definition at line 155 of file SpaceInformation.h.

◆ setMinMaxControlDuration()

void ompl::control::SpaceInformation::setMinMaxControlDuration ( unsigned int  minSteps,
unsigned int  maxSteps 
)
inline

Set the minimum and maximum number of steps a control is propagated for.

Definition at line 148 of file SpaceInformation.h.

◆ setPropagationStepSize()

void ompl::control::SpaceInformation::setPropagationStepSize ( double  stepSize)
inline

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()

Definition at line 208 of file SpaceInformation.h.

◆ setStatePropagator() [1/2]

void ompl::control::SpaceInformation::setStatePropagator ( const StatePropagatorFn fn)

Set the function that performs state propagation.

Definition at line 117 of file SpaceInformation.cpp.

◆ setStatePropagator() [2/2]

void ompl::control::SpaceInformation::setStatePropagator ( const StatePropagatorPtr sp)

Set the instance of StatePropagator to perform state propagation.

Definition at line 139 of file SpaceInformation.cpp.

◆ setup()

void ompl::control::SpaceInformation::setup ( )
overridevirtual

Perform additional setup tasks (run once, before use)

Reimplemented from ompl::base::SpaceInformation.

Definition at line 65 of file SpaceInformation.cpp.

Member Data Documentation

◆ controlSpace_

ControlSpacePtr ompl::control::SpaceInformation::controlSpace_
protected

The control space describing the space of controls applicable to states in the state space.

Definition at line 300 of file SpaceInformation.h.

◆ dcsa_

DirectedControlSamplerAllocator ompl::control::SpaceInformation::dcsa_
protected

Optional allocator for the DirectedControlSampler. If not specified, the default implementation is used.

Definition at line 313 of file SpaceInformation.h.

◆ maxSteps_

unsigned int ompl::control::SpaceInformation::maxSteps_ {0}
protected

The maximum number of steps to apply a control for.

Definition at line 309 of file SpaceInformation.h.

◆ minSteps_

unsigned int ompl::control::SpaceInformation::minSteps_ {0}
protected

The minimum number of steps to apply a control for.

Definition at line 306 of file SpaceInformation.h.

◆ statePropagator_

StatePropagatorPtr ompl::control::SpaceInformation::statePropagator_
protected

The state propagator used to model the motion of the system being planned for.

Definition at line 303 of file SpaceInformation.h.

◆ stepSize_

double ompl::control::SpaceInformation::stepSize_ {0.}
protected

The actual duration of each step.

Definition at line 316 of file SpaceInformation.h.


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