Class LightningDB

Class Documentation

class LightningDB

Save and load entire paths from file.

Public Functions

LightningDB(const base::StateSpacePtr &space)

Constructor needs the state space used for planning.

Parameters:

space – - state space

virtual ~LightningDB()

Deconstructor.

bool load(const std::string &fileName)

Load database from file.

Parameters:

fileName – - name of database file

Returns:

true if file loaded successfully

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.

Parameters:
  • new – path

  • returned – insertion time to add to db

Returns:

true on success

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.

Parameters:

fileName – - name of database file

Returns:

true if file saved successfully

bool save(const std::string &fileName)

Save loaded database to file.

Parameters:

fileName – - name of database file

Returns:

true if file saved successfully

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.

inline int getNumUnsavedPaths() const

Get number of unsaved paths.

inline bool isEmpty()

Check if anything has been loaded into DB.

Returns:

true if has no nodes

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}