Class SpaceInformation

Inheritance Relationships

Base Type

Derived Type

Class Documentation

class SpaceInformation : public ompl::base::SpaceInformation

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

Subclassed by ompl::control::LTLSpaceInformation

Control memory management

inline Control *allocControl() const

Allocate memory for a control.

inline void freeControl(Control *control) const

Free the memory of a control.

inline void copyControl(Control *destination, const Control *source) const

Copy a control to another.

inline Control *cloneControl(const Control *source) const

Clone a control.

Topology-specific control operations (as in the control space)

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

Print a control to a stream.

inline bool equalControls(const Control *control1, const Control *control2) const

Check if two controls are the same.

inline 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

inline ControlSamplerPtr allocControlSampler() const

Allocate a control sampler.

inline void setMinMaxControlDuration(unsigned int minSteps, unsigned int maxSteps)

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

inline void setMinControlDuration(unsigned int minSteps)

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

inline void setMaxControlDuration(unsigned int maxSteps)

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

inline unsigned int getMinControlDuration() const

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

inline 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

inline 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.

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

inline 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.

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

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.

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

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.

Note

Start state state is not included in result

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

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.

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

Public Functions

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

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

virtual ~SpaceInformation() override = default
inline const ControlSpacePtr &getControlSpace() const

Get the control space.

virtual void printSettings(std::ostream &out = std::cout) const override

Print information about the current instance of the state space.

virtual void setup() override

Perform additional setup tasks (run once, before use)

Protected Functions

void declareParams()

Declare parameter settings

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_ = {0}

The minimum number of steps to apply a control for.

unsigned int maxSteps_ = {0}

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_ = {0.}

The actual duration of each step.