-
Notifications
You must be signed in to change notification settings - Fork 48
/
mainVisualCompare.cpp
executable file
·71 lines (47 loc) · 2.24 KB
/
mainVisualCompare.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#define DEBUG // TODO activate DEBUG in PlannerSettings.h
#include "base/PlannerSettings.h"
#include "steer_functions/POSQ/POSQSteering.h"
#include "metrics/PathLengthMetric.h"
#include "planners/OMPLPlanner.hpp"
#include "planners/ThetaStar.h"
#include "gui/PathEvaluation.h"
#include "PostSmoothing.h"
#include "planners/OMPLSimplifier.hpp"
namespace og = ompl::geometric;
int main(int argc, char **argv)
{
PlannerSettings::steeringType = Steering::STEER_TYPE_REEDS_SHEPP;
PlannerSettings::initializeSteering();
QtVisualizer::initialize();
QtVisualizer::showStartGoal(false);
PlannerSettings::environment = Environment::createRandomCorridor(50, 50, 3, 30, 123);
QtVisualizer::visualize(*PlannerSettings::environment, 0);
auto *planner = new RRTPlanner;
if (!planner->run())
return EXIT_FAILURE;
std::vector<GNode> path = planner->solutionTrajectory();
std::vector<Tpoint> trajectory = planner->solutionPath();
QtVisualizer::drawPath(PlannerUtils::toSteeredTrajectoryPoints(path), Qt::black, 4);
QtVisualizer::addLegendEntry(LegendEntry("Original path", QPen(Qt::black, 4.)));
PostSmoothing ourSmoothing;
std::vector<GNode> ourSmoothed(path);
ourSmoothing.smooth(ourSmoothed);
QColor qc("#36F");
QtVisualizer::drawPath(PlannerUtils::toSteeredTrajectoryPoints(ourSmoothed), qc, 4);
QtVisualizer::addLegendEntry(LegendEntry("GRIPS", QPen(qc, 4.)));
OMPLSimplifier simplifier(path);
QPen bpen(QColor("#F70"), 3., Qt::DashDotLine);
QtVisualizer::drawPath(simplifier.smoothBSpline().trajectory, bpen);
QtVisualizer::addLegendEntry(LegendEntry("B-Spline", bpen));
QPen spen(QColor("#BF5"), 3., Qt::DotLine);
QtVisualizer::drawPath(simplifier.shortcutPath().trajectory, spen);
QtVisualizer::addLegendEntry(LegendEntry("Shortcut", spen));
QPen dpen(Qt::cyan, 3., Qt::DotLine);
QtVisualizer::drawPath(simplifier.simplifyMax().trajectory, dpen);
QtVisualizer::addLegendEntry(LegendEntry("SimplifyMax", dpen));
QPen apen(Qt::darkRed, 3., Qt::DotLine);
QtVisualizer::drawPath(planner->anytimePathShortening().trajectory, apen);
QtVisualizer::addLegendEntry(LegendEntry("AnytimePS", apen));
QtVisualizer::show();
return QtVisualizer::exec();
}