Loading...
Searching...
No Matches
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. More...
 
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. More...
 
std::vector< ompl::base::PlannerDataPtrfindNearestStartGoal (int nearestK, const base::State *start, const base::State *goal)
 Find the k nearest paths to our queries one. More...
 
std::size_t getExperiencesCount () const
 Get the total number of paths stored in the database. More...
 
std::size_t getStatesCount () const
 Get the total number of states stored in the database, across all paths. More...
 
int getNumUnsavedPaths () const
 Get number of unsaved paths. More...
 
bool isEmpty ()
 Check if anything has been loaded into DB. More...
 

Protected Attributes

base::SpaceInformationPtr si_
 The created space information. More...
 
ompl::base::PlannerDataStorage plannerDataStorage_
 Helper class for storing each plannerData instance. More...
 
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 72 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.

◆ ~LightningDB()

ompl::tools::LightningDB::~LightningDB ( )
virtual

Deconstructor.

Definition at line 64 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.

◆ addPathHelper()

void ompl::tools::LightningDB::addPathHelper ( geometric::PathGeometric solutionPath)

Definition at line 134 of file LightningDB.cpp.

◆ findNearestStartGoal()

std::vector< ompl::base::PlannerDataPtr > ompl::tools::LightningDB::findNearestStartGoal ( int  nearestK,
const base::State start,
const base::State goal 
)

Find the k nearest paths to our queries one.

Definition at line 221 of file LightningDB.cpp.

◆ getAllPlannerDatas()

void ompl::tools::LightningDB::getAllPlannerDatas ( std::vector< ompl::base::PlannerDataPtr > &  plannerDatas) const

Get a vector of all the paths in the nearest neighbor tree.

Definition at line 211 of file LightningDB.cpp.

◆ getExperiencesCount()

std::size_t ompl::tools::LightningDB::getExperiencesCount ( ) const

Get the total number of paths stored in the database.

Definition at line 257 of file LightningDB.cpp.

◆ getNumUnsavedPaths()

int ompl::tools::LightningDB::getNumUnsavedPaths ( ) const
inline

Get number of unsaved paths.

Definition at line 134 of file LightningDB.h.

◆ getStatesCount()

std::size_t ompl::tools::LightningDB::getStatesCount ( ) const

Get the total number of states stored in the database, across all paths.

Definition at line 262 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 143 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.

Member Data Documentation

◆ nn_

std::shared_ptr<NearestNeighbors<ompl::base::PlannerDataPtr> > ompl::tools::LightningDB::nn_
protected

Definition at line 162 of file LightningDB.h.

◆ nnSearchKey_

ompl::base::PlannerDataPtr ompl::tools::LightningDB::nnSearchKey_
protected

Definition at line 165 of file LightningDB.h.

◆ numUnsavedPaths_

int ompl::tools::LightningDB::numUnsavedPaths_ {0}
protected

Definition at line 168 of file LightningDB.h.

◆ plannerDataStorage_

ompl::base::PlannerDataStorage ompl::tools::LightningDB::plannerDataStorage_
protected

Helper class for storing each plannerData instance.

Definition at line 159 of file LightningDB.h.

◆ si_

base::SpaceInformationPtr ompl::tools::LightningDB::si_
protected

The created space information.

Definition at line 156 of file LightningDB.h.


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