ompl::tools::Thunder Class Reference

Built off of SimpleSetup but provides support for planning from experience. More...

#include <ompl/tools/thunder/Thunder.h>

Inheritance diagram for ompl::tools::Thunder:

Public Member Functions

 Thunder (const base::SpaceInformationPtr &si)
 Constructor needs the state space used for planning.
 
 Thunder (const base::StateSpacePtr &space)
 Constructor needs the state space used for planning. More...
 
void printResultsInfo (std::ostream &out=std::cout) const override
 Display debug data about potential available solutions.
 
void printLogs (std::ostream &out=std::cout) const override
 Display debug data about overall results from Thunder since being loaded.
 
ompl::base::PlannerPtrgetPlanner ()
 Get the current planner.
 
ompl::geometric::ThunderRetrieveRepairgetRetrieveRepairPlanner () const
 Get a pointer to the retrieve repair planner.
 
void setRepairPlanner (const base::PlannerPtr &planner) override
 Set the planner to use for repairing experience paths inside the ThunderRetrieveRepair planner. If the planner is not set, a default planner is set.
 
void setPlannerAllocator (const base::PlannerAllocator &pa)
 Set the planner allocator to use. This is only used if no planner has been set. This is optional – a default planner will be used if no planner is otherwise specified.
 
base::PlannerStatus solve (double time=1.0) override
 Run the planner for up to a specified amount of time (default is 1 second)
 
base::PlannerStatus solve (const base::PlannerTerminationCondition &ptc) override
 Run the planner until ptc becomes true (at most)
 
bool save () override
 Save the experience database to file.
 
bool saveIfChanged () override
 Save the experience database to file if there has been a change.
 
void clear () override
 Clear all planning data. This only includes data generated by motion plan computation. Planner settings, start & goal states are not affected.
 
void print (std::ostream &out=std::cout) const override
 Print information about the current setup.
 
void setup () override
 This method will create the necessary classes for planning. The solve() method will call this function automatically.
 
void getAllPlannerDatas (std::vector< ompl::base::PlannerDataPtr > &plannerDatas) const override
 Get a vector of all the planning data in the database.
 
std::size_t getExperiencesCount () const override
 Get the total number of paths stored in the database.
 
void convertPlannerData (const ompl::base::PlannerDataPtr &plannerData, ompl::geometric::PathGeometric &path)
 Convert PlannerData to PathGeometric. Assume ordering of vertices is order of path.
 
bool reversePathIfNecessary (ompl::geometric::PathGeometric &path1, ompl::geometric::PathGeometric &path2)
 If path1 and path2 have a better start/goal match when reverse, then reverse path2. More...
 
ompl::tools::ThunderDBPtr getExperienceDB ()
 Hook for getting access to debug data.
 
bool doPostProcessing () override
 Allow accumlated experiences to be processed.
 
- Public Member Functions inherited from ompl::tools::ExperienceSetup
 ExperienceSetup (const base::SpaceInformationPtr &si)
 Constructor needs the state space used for planning.
 
 ExperienceSetup (const base::StateSpacePtr &space)
 Constructor needs the state space used for planning.
 
void logInitialize ()
 Load the header (first row) of the csv file.
 
void convertLogToString (const ExperienceLog &log)
 Move data to string format and put in buffer.
 
virtual void saveDataLog (std::ostream &out=std::cout)
 Save debug data about overall results since being loaded.
 
void enablePlanningFromRecall (bool enable)
 Optionally disable the ability to use previous plans in solutions (but will still save them)
 
void enablePlanningFromScratch (bool enable)
 Optionally disable the ability to plan from scratch Note: Lightning can still save modified experiences if they are different enough.
 
virtual const std::string & getFilePath () const
 After setFile() is called, access the generated file path for loading and saving the experience database.
 
virtual bool setFilePath (const std::string &filePath)
 Set the database file to load. Actual loading occurs when setup() is called. More...
 
const ExperienceStatsgetStats () const
 Getter for logging data.
 
- Public Member Functions inherited from ompl::geometric::SimpleSetup
 SimpleSetup (const base::SpaceInformationPtr &si)
 Constructor needs the state space used for planning.
 
 SimpleSetup (const base::StateSpacePtr &space)
 Constructor needs the state space used for planning.
 
const base::SpaceInformationPtr & getSpaceInformation () const
 Get the current instance of the space information.
 
const base::ProblemDefinitionPtr & getProblemDefinition () const
 Get the current instance of the problem definition.
 
base::ProblemDefinitionPtr & getProblemDefinition ()
 Get the current instance of the problem definition.
 
const base::StateSpacePtr & getStateSpace () const
 Get the current instance of the state space.
 
const base::StateValidityCheckerPtr & getStateValidityChecker () const
 Get the current instance of the state validity checker.
 
const base::GoalPtr & getGoal () const
 Get the current goal definition.
 
const base::PlannerPtr & getPlanner () const
 Get the current planner.
 
const base::PlannerAllocatorgetPlannerAllocator () const
 Get the planner allocator.
 
const PathSimplifierPtrgetPathSimplifier () const
 Get the path simplifier.
 
PathSimplifierPtrgetPathSimplifier ()
 Get the path simplifier.
 
const base::OptimizationObjectivePtr & getOptimizationObjective () const
 Get the optimization objective to use.
 
bool haveExactSolutionPath () const
 Return true if a solution path is available (previous call to solve() was successful) and the solution is exact (not approximate)
 
bool haveSolutionPath () const
 Return true if a solution path is available (previous call to solve() was successful). The solution may be approximate.
 
const std::string getSolutionPlannerName () const
 Get the best solution's planer name. Throw an exception if no solution is available.
 
PathGeometricgetSolutionPath () const
 Get the solution path. Throw an exception if no solution is available.
 
void getPlannerData (base::PlannerData &pd) const
 Get information about the exploration data structure the motion planner used.
 
void setStateValidityChecker (const base::StateValidityCheckerPtr &svc)
 Set the state validity checker to use.
 
void setStateValidityChecker (const base::StateValidityCheckerFn &svc)
 Set the state validity checker to use.
 
void setOptimizationObjective (const base::OptimizationObjectivePtr &optimizationObjective)
 Set the optimization objective to use.
 
void setStartAndGoalStates (const base::ScopedState<> &start, const base::ScopedState<> &goal, double threshold=std::numeric_limits< double >::epsilon())
 Set the start and goal states to use.
 
void addStartState (const base::ScopedState<> &state)
 Add a starting state for planning. This call is not needed if setStartAndGoalStates() has been called.
 
void clearStartStates ()
 Clear the currently set starting states.
 
void setStartState (const base::ScopedState<> &state)
 Clear the currently set starting states and add state as the starting state.
 
void setGoalState (const base::ScopedState<> &goal, double threshold=std::numeric_limits< double >::epsilon())
 A simple form of setGoal(). The goal will be an instance of ompl::base::GoalState.
 
void setGoal (const base::GoalPtr &goal)
 Set the goal for planning. This call is not needed if setStartAndGoalStates() has been called.
 
void setPlanner (const base::PlannerPtr &planner)
 Set the planner to use. If the planner is not set, an attempt is made to use the planner allocator. If no planner allocator is available either, a default planner is set.
 
void setPlannerAllocator (const base::PlannerAllocator &pa)
 Set the planner allocator to use. This is only used if no planner has been set. This is optional – a default planner will be used if no planner is otherwise specified.
 
base::PlannerStatus getLastPlannerStatus () const
 Return the status of the last planning attempt.
 
double getLastPlanComputationTime () const
 Get the amount of time (in seconds) spent during the last planning step.
 
double getLastSimplificationTime () const
 Get the amount of time (in seconds) spend during the last path simplification step.
 
void simplifySolution (double duration=0.0)
 Attempt to simplify the current solution path. Spent at most duration seconds in the simplification process. If duration is 0 (the default), a default simplification procedure is executed.
 
void simplifySolution (const base::PlannerTerminationCondition &ptc)
 Attempt to simplify the current solution path. Stop computation when ptc becomes true at the latest.
 

Protected Attributes

base::PlannerPtr rrPlanner_
 
base::PlannerPtr planner2_
 
bool dualThreadScratchEnabled_ {true}
 
ompl::tools::ParallelPlanPtr pp_
 Instance of parallel planning to use for computing solutions in parallel.
 
ompl::tools::ThunderDBPtr experienceDB_
 A shared object between all the planners for saving and loading previous experience.
 
std::vector< ompl::geometric::PathGeometricqueuedSolutionPaths_
 Accumulated experiences to be later added to experience database.
 
- Protected Attributes inherited from ompl::tools::ExperienceSetup
bool recallEnabled_ {true}
 Flag indicating whether recalled plans should be used to find solutions. Enabled by default.
 
bool scratchEnabled_ {true}
 Flag indicating whether planning from scratch should be used to find solutions. Enabled by default.
 
std::string filePath_
 File location of database.
 
std::stringstream csvDataLogStream_
 
ExperienceStats stats_
 States data for display to console

 
- Protected Attributes inherited from ompl::geometric::SimpleSetup
base::SpaceInformationPtr si_
 The created space information.
 
base::ProblemDefinitionPtr pdef_
 The created problem definition.
 
base::PlannerPtr planner_
 The maintained planner instance.
 
base::PlannerAllocator pa_
 The optional planner allocator.
 
PathSimplifierPtr psk_
 The instance of the path simplifier.
 
bool configured_
 Flag indicating whether the classes needed for planning are set up.
 
double planTime_
 The amount of time the last planning step took.
 
double simplifyTime_
 The amount of time the last path simplification step took.
 
base::PlannerStatus lastStatus_
 The status of the last planning request.
 

Detailed Description

Built off of SimpleSetup but provides support for planning from experience.

Definition at line 150 of file Thunder.h.

Constructor & Destructor Documentation

◆ Thunder()

ompl::tools::Thunder::Thunder ( const base::StateSpacePtr &  space)
explicit

Constructor needs the state space used for planning.

Parameters
space- the state space to plan in

Definition at line 51 of file Thunder.cpp.

Member Function Documentation

◆ reversePathIfNecessary()

bool ompl::tools::Thunder::reversePathIfNecessary ( ompl::geometric::PathGeometric path1,
ompl::geometric::PathGeometric path2 
)

If path1 and path2 have a better start/goal match when reverse, then reverse path2.

Parameters
pathto test against
pathto reverse
Returns
true if reverse was necessary

Definition at line 480 of file Thunder.cpp.

Member Data Documentation

◆ dualThreadScratchEnabled_

bool ompl::tools::Thunder::dualThreadScratchEnabled_ {true}
protected

Flag indicating whether dual thread scratch planning is enabled

Definition at line 253 of file Thunder.h.

◆ planner2_

base::PlannerPtr ompl::tools::Thunder::planner2_
protected

A third planner used for testing dual-thread scratch-only planning

Definition at line 250 of file Thunder.h.

◆ rrPlanner_

base::PlannerPtr ompl::tools::Thunder::rrPlanner_
protected

The maintained experience planner instance

Definition at line 247 of file Thunder.h.


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