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. | |
virtual | ~LightningDB () |
Deconstructor. | |
bool | load (const std::string &fileName) |
Load database from file. | |
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. | |
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. | |
bool | save (const std::string &fileName) |
Save loaded database to file. | |
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::PlannerDataPtr > | findNearestStartGoal (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. | |
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 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()
|
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
-
new path returned insertion 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()
|
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()
|
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_
|
protected |
Definition at line 162 of file LightningDB.h.
◆ nnSearchKey_
|
protected |
Definition at line 165 of file LightningDB.h.
◆ numUnsavedPaths_
|
protected |
Definition at line 168 of file LightningDB.h.
◆ plannerDataStorage_
|
protected |
Helper class for storing each plannerData instance.
Definition at line 159 of file LightningDB.h.
◆ 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:
- ompl/tools/lightning/LightningDB.h
- ompl/tools/lightning/src/LightningDB.cpp