37 #include "ompl/control/PathControl.h"
38 #include "ompl/control/planners/ltl/LTLProblemDefinition.h"
39 #include "ompl/control/planners/ltl/LTLSpaceInformation.h"
40 #include "ompl/base/ProblemDefinition.h"
42 namespace ob = ompl::base;
43 namespace oc = ompl::control;
45 oc::LTLProblemDefinition::LTLProblemDefinition(
const LTLSpaceInformationPtr& ltlsi)
46 : ob::ProblemDefinition(ltlsi), ltlsi_(ltlsi)
51 void oc::LTLProblemDefinition::addLowerStartState(
const ob::State* s)
54 ltlsi_->getFullState(s, fullStart.get());
55 addStartState(fullStart);
58 ob::PathPtr oc::LTLProblemDefinition::getLowerSolutionPath(
void)
const
60 PathControl* fullPath =
static_cast<PathControl*
>(getSolutionPath().get());
61 ob::PathPtr lowPathPtr(
new PathControl(ltlsi_->getLowSpace()));
62 PathControl* lowPath =
static_cast<PathControl*
>(lowPathPtr.get());
64 if (fullPath->getStateCount() > 0)
66 for(
size_t i = 0; i < fullPath->getStateCount()-1; ++i)
67 lowPath->append(ltlsi_->getLowLevelState(fullPath->getState(i)),
68 fullPath->getControl(i),
69 fullPath->getControlDuration(i));
72 lowPath->append(ltlsi_->getLowLevelState(fullPath->getState(fullPath->getStateCount()-1)));
78 void oc::LTLProblemDefinition::createGoal(
void)
80 class LTLGoal :
public base::Goal
83 LTLGoal(
const LTLSpaceInformationPtr& ltlsi)
84 : ob::Goal(ltlsi), ltlsi_(ltlsi), prod_(ltlsi->getProductGraph()) {}
85 virtual ~LTLGoal(
void) {}
86 virtual bool isSatisfied(
const ob::State* s)
const
88 return prod_->isSolution(ltlsi_->getProdGraphState(s));
91 const LTLSpaceInformationPtr ltlsi_;
92 const ProductGraphPtr prod_;
97 setGoal(
ob::GoalPtr(static_cast<ob::Goal*>(
new LTLGoal(ltlsi_))));
Definition of a scoped state.
Definition of an abstract state.
A shared pointer wrapper for ompl::base::Goal.
A shared pointer wrapper for ompl::base::Path.