Bench-MR
A Motion Planning Benchmark for Wheeled Mobile Robots
OMPLSimplifier.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "AbstractPlanner.h"
5
11 public:
12 explicit OMPLSimplifier(const std::vector<GNode> &path)
13 : _path(path), AbstractPlanner() {
14 _steered = PlannerUtils::toSteeredTrajectory(path).getPath();
15 _geometric = new og::PathGeometric(ss->getSpaceInformation());
16 for (auto &node : path) {
17 auto *state =
18 ss->getStateSpace()->allocState()->as<ob::SE2StateSpace::StateType>();
19 state->setXY(node.x_r, node.y_r);
20 state->setYaw(node.theta);
21 _geometric->append(state);
22 }
23 }
24
25 ~OMPLSimplifier() { delete _geometric; }
26
27 std::string name() const override { return "OMPL Simplifier"; }
28
29 ob::PlannerStatus run() {
30 OMPL_ERROR("OMPLSimplifier::run() has not been implemented.");
31 return ob::PlannerStatus::CRASH;
32 }
33
34 std::vector<GNode> solutionTrajectory() const { return _path; }
35 std::vector<TrajectoryPoint> solutionPath() const { return _steered; }
36 og::PathGeometric geometricPath() const { return *_geometric; }
37
38 bool hasReachedGoalExactly() const { return true; }
39
40 double planningTime() const { return 0; }
41 ob::Planner *omplPlanner() { return nullptr; }
42
43 private:
44 const std::vector<GNode> _path{};
45 std::vector<TrajectoryPoint> _steered{};
46 og::PathGeometric *_geometric{};
47};
Definition: AbstractPlanner.h:29
og::SimpleSetup * ss
Definition: AbstractPlanner.h:114
Derived from AbstractPlanner, this class is intended to simplify existing (hand-crafted) trajectories...
Definition: OMPLSimplifier.hpp:10
std::vector< TrajectoryPoint > solutionPath() const
Definition: OMPLSimplifier.hpp:35
ob::Planner * omplPlanner()
Definition: OMPLSimplifier.hpp:41
bool hasReachedGoalExactly() const
Definition: OMPLSimplifier.hpp:38
og::PathGeometric geometricPath() const
Definition: OMPLSimplifier.hpp:36
std::string name() const override
Definition: OMPLSimplifier.hpp:27
~OMPLSimplifier()
Definition: OMPLSimplifier.hpp:25
OMPLSimplifier(const std::vector< GNode > &path)
Definition: OMPLSimplifier.hpp:12
double planningTime() const
Definition: OMPLSimplifier.hpp:40
std::vector< GNode > solutionTrajectory() const
Definition: OMPLSimplifier.hpp:34
ob::PlannerStatus run()
Definition: OMPLSimplifier.hpp:29
Planner
Definition: PlannerSettings.h:16