Program Listing for File Thunder.h
↰ Return to documentation for file (src/ompl/tools/thunder/Thunder.h)
/*********************************************************************
* Software License Agreement (BSD License)
*
* Copyright (c) 2014, JSK, The University of Tokyo.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of the JSK, The University of Tokyo nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*********************************************************************/
/* Author: Dave Coleman
*/
#ifndef OMPL_TOOLS_THUNDER_THUNDER_
#define OMPL_TOOLS_THUNDER_THUNDER_
#include <ompl/tools/experience/ExperienceSetup.h> // the parent class
#include <ompl/tools/thunder/ThunderDB.h>
#include <ompl/geometric/planners/experience/ThunderRetrieveRepair.h>
#include <ompl/base/Planner.h>
#include <ompl/base/PlannerData.h>
#include <ompl/base/ProblemDefinition.h>
#include <ompl/base/SpaceInformation.h>
#include <ompl/base/ProblemDefinition.h>
#include <ompl/base/StateSpace.h> // for storing to file
#include <ompl/geometric/PathGeometric.h>
#include <ompl/geometric/PathSimplifier.h>
#include <ompl/tools/multiplan/ParallelPlan.h>
#include <ompl/util/Console.h>
#include <ompl/util/Exception.h>
namespace ompl
{
namespace tools
{
OMPL_CLASS_FORWARD(Thunder);
class Thunder : public ompl::tools::ExperienceSetup
{
public:
explicit Thunder(const base::SpaceInformationPtr &si);
explicit Thunder(const base::StateSpacePtr &space);
private:
void initialize();
public:
void printResultsInfo(std::ostream &out = std::cout) const override;
void printLogs(std::ostream &out = std::cout) const override;
ompl::base::PlannerPtr &getPlanner()
{
return planner_;
}
ompl::geometric::ThunderRetrieveRepair &getRetrieveRepairPlanner() const
{
return static_cast<ompl::geometric::ThunderRetrieveRepair &>(*rrPlanner_);
}
void setRepairPlanner(const base::PlannerPtr &planner) override
{
static_cast<ompl::geometric::ThunderRetrieveRepair &>(*rrPlanner_).setRepairPlanner(planner);
}
void setPlannerAllocator(const base::PlannerAllocator &pa);
base::PlannerStatus solve(double time = 1.0) override;
base::PlannerStatus solve(const base::PlannerTerminationCondition &ptc) override;
bool save() override;
bool saveIfChanged() override;
void clear() override;
void print(std::ostream &out = std::cout) const override;
void setup() override;
void getAllPlannerDatas(std::vector<ompl::base::PlannerDataPtr> &plannerDatas) const override;
std::size_t getExperiencesCount() const override;
void convertPlannerData(const ompl::base::PlannerDataPtr &plannerData,
ompl::geometric::PathGeometric &path);
bool reversePathIfNecessary(ompl::geometric::PathGeometric &path1, ompl::geometric::PathGeometric &path2);
ompl::tools::ThunderDBPtr getExperienceDB();
bool doPostProcessing() override;
protected:
base::PlannerPtr rrPlanner_;
base::PlannerPtr planner2_;
bool dualThreadScratchEnabled_{true};
ompl::tools::ParallelPlanPtr pp_;
ompl::tools::ThunderDBPtr experienceDB_;
std::vector<ompl::geometric::PathGeometric> queuedSolutionPaths_;
}; // end of class Thunder
} // end of namespace
} // end of namespace
#endif