ompl::tools::LightningDB Class Reference

Save and load entire paths from file. More...

#include <ompl/tools/lightning/LightningDB.h>

Public Member Functions

 LightningDB (const base::StateSpacePtr &space)
 Constructor needs the state space used for planning. More...
 
virtual ~LightningDB ()
 Deconstructor.
 
bool load (const std::string &fileName)
 Load database from file. More...
 
void addPath (geometric::PathGeometric &solutionPath, double &insertionTime)
 Add a new solution path to our database. Des not actually save to file so experience will be lost if save() is not called. More...
 
void addPathHelper (geometric::PathGeometric &solutionPath)
 
bool saveIfChanged (const std::string &fileName)
 Save loaded database to file, except skips saving if no paths have been added. More...
 
bool save (const std::string &fileName)
 Save loaded database to file. More...
 
void getAllPlannerDatas (std::vector< ompl::base::PlannerDataPtr > &plannerDatas) const
 Get a vector of all the paths in the nearest neighbor tree.
 
std::vector< ompl::base::PlannerDataPtrfindNearestStartGoal (int nearestK, const base::State *start, const base::State *goal)
 Find the k nearest paths to our queries one.
 
std::size_t getExperiencesCount () const
 Get the total number of paths stored in the database.
 
std::size_t getStatesCount () const
 Get the total number of states stored in the database, across all paths.
 
int getNumUnsavedPaths () const
 Get number of unsaved paths.
 
bool isEmpty ()
 Check if anything has been loaded into DB. More...
 

Protected Attributes

base::SpaceInformationPtr si_
 The created space information.
 
ompl::base::PlannerDataStorage plannerDataStorage_
 Helper class for storing each plannerData instance.
 
std::shared_ptr< NearestNeighbors< ompl::base::PlannerDataPtr > > nn_
 
ompl::base::PlannerDataPtr nnSearchKey_
 
int numUnsavedPaths_ {0}
 

Detailed Description

Save and load entire paths from file.

Definition at line 136 of file LightningDB.h.

Constructor & Destructor Documentation

◆ LightningDB()

ompl::tools::LightningDB::LightningDB ( const base::StateSpacePtr &  space)

Constructor needs the state space used for planning.

Parameters
space- state space

Definition at line 47 of file LightningDB.cpp.

Member Function Documentation

◆ addPath()

void ompl::tools::LightningDB::addPath ( geometric::PathGeometric solutionPath,
double &  insertionTime 
)

Add a new solution path to our database. Des not actually save to file so experience will be lost if save() is not called.

Parameters
newpath
returnedinsertion time to add to db
Returns
true on success

Definition at line 124 of file LightningDB.cpp.

◆ isEmpty()

bool ompl::tools::LightningDB::isEmpty ( )
inline

Check if anything has been loaded into DB.

Returns
true if has no nodes

Definition at line 207 of file LightningDB.h.

◆ load()

bool ompl::tools::LightningDB::load ( const std::string &  fileName)

Load database from file.

Parameters
fileName- name of database file
Returns
true if file loaded successfully

Definition at line 70 of file LightningDB.cpp.

◆ save()

bool ompl::tools::LightningDB::save ( const std::string &  fileName)

Save loaded database to file.

Parameters
fileName- name of database file
Returns
true if file saved successfully

Definition at line 165 of file LightningDB.cpp.

◆ saveIfChanged()

bool ompl::tools::LightningDB::saveIfChanged ( const std::string &  fileName)

Save loaded database to file, except skips saving if no paths have been added.

Parameters
fileName- name of database file
Returns
true if file saved successfully

Definition at line 156 of file LightningDB.cpp.


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