Class PlannerInputStates

Class Documentation

class PlannerInputStates

Helper class to extract valid start & goal states. Usually used internally by planners.

This class is meant to behave correctly if the user updates the problem definition between subsequent calls to ompl::base::Planner::solve() without calling ompl::base::Planner::clear() in between. Only allowed changes to the problem definition are accounted for: adding of starring states or adding of goal states for instances inherited from ompl::base::GoalSampleableRegion.

Public Functions

inline PlannerInputStates(const PlannerPtr &planner)

Default constructor. No work is performed.

inline PlannerInputStates(const Planner *planner)

Default constructor. No work is performed.

inline PlannerInputStates()

Default constructor. No work is performed. A call to use() needs to be made, before making any calls to nextStart() or nextGoal().

inline ~PlannerInputStates()

Destructor. Clear allocated memory.

void clear()

Clear all stored information.

void restart()

Forget how many states were returned by nextStart() and nextGoal() and return all states again.

bool update()

Set the space information and problem definition this class operates on, based on the available planner instance. Returns true if changes were found (different problem definition) and clear() was called.

bool use(const ProblemDefinitionPtr &pdef)

Set the problem definition this class operates on. If a planner is not set in the constructor argument, a call to this function is needed before any calls to nextStart() or nextGoal() are made. Returns true if changes were found (different problem definition) and clear() was called.

void checkValidity() const

Check if the problem definition was set, start state are available and goal was set.

const State *nextStart()

Return the next valid start state or nullptr if no more valid start states are available.

const State *nextGoal(const PlannerTerminationCondition &ptc)

Return the next valid goal state or nullptr if no more valid goal states are available. Because sampling of goal states may also produce invalid goals, this function takes an argument that specifies whether a termination condition has been reached. If the termination condition evaluates to true the function terminates even if no valid goal has been found.

const State *nextGoal()

Same as above but only one attempt is made to find a valid goal.

bool haveMoreStartStates() const

Check if there are more potential start states.

bool haveMoreGoalStates() const

Check if there are more potential goal states.

inline unsigned int getSeenStartStatesCount() const

Get the number of start states from the problem definition that were already seen, including invalid ones.

inline unsigned int getSampledGoalsCount() const

Get the number of sampled goal states, including invalid ones.