ugv_nav4d
PlannerGui.h
Go to the documentation of this file.
1 #pragma once
2 #include <QObject>
3 #include <QWidget>
4 #include <atomic>
5 
6 #ifndef Q_MOC_RUN
7 #include <vizkit3d/SubTrajectoryVisualization.hpp>
8 #include <vizkit3d/MLSMapVisualization.hpp>
9 #include <vizkit3d/TraversabilityMap3dVisualization.hpp>
10 #include <vizkit3d/GridVisualization.hpp>
11 #include <vizkit3d/SbplSplineVisualization.hpp>
12 #include <vizkit3d/RigidBodyStateVisualization.hpp>
13 #include <maps/grid/MLSMap.hpp>
14 #include <base/Eigen.hpp>
15 #include <ugv_nav4d/Planner.hpp>
16 #include <traversability_generator3d/TraversabilityConfig.hpp>
17 #include <trajectory_follower/SubTrajectory.hpp>
18 #endif
19 
20 class QDoubleSpinBox;
21 class QSpinBox;
22 class QSlider;
23 class QPushButton;
24 class QComboBox;
25 class QProgressBar;
26 
27 namespace vizkit3d {
28  class Vizkit3DWidget;
29 }
30 
31 class PlannerGui : public QObject
32 {
33  Q_OBJECT;
34 
35  void setupPlanner(int argc, char** argv);
36  void setupUI();
37 
38 public:
39  PlannerGui(int argc, char** argv);
40  PlannerGui(const std::string &dumpName);
41 
42  void show();
43 public slots:
45  void picked(float x, float y,float z, int buttonMask, int modifierMask);
46 
47  //display the planner results
48  void plannerIsDone();
49 
51  void plan(const base::Pose& start, const base::Pose& goal);
52 
53 signals:
54  //is emitted if the planner thread is done
55  void plannerDone();
56 
57 private slots:
58  void maxSlopeEditingFinished();
59  void inclineLimittingLimitSpinBoxEditingFinished();
60  void inclineLimittingMinSlopeSpinBoxEditingFinished();
61  void slopeMetricScaleSpinBoxEditingFinished();
62  void startOrientationChanged(int newValue);
63  void goalOrientationChanged(int newValue);
64  void timeEditingFinished();
65  void replanButtonReleased();
66  void dumpPressed();
67  void slopeMetricComboBoxIndexChanged(int index);
68  void numThreadsValueChanged(int newValue);
69  void obstacleDistanceSpinBoxEditingFinished();
70  void obstacleFactorSpinBoxEditingFinished();
71 
72 private:
73  void loadMls();
74  void loadMls(const std::string& path);
75  void startPlanThread();
76 
77 private:
78 
79  std::atomic<bool> inplanningphase{false}; // Atomic for thread-safe flag
80  vizkit3d::Vizkit3DWidget* widget;
81  QDoubleSpinBox* maxSlopeSpinBox;
82  QDoubleSpinBox* slopeMetricScaleSpinBox;
83  QDoubleSpinBox* time;
84  QDoubleSpinBox* inclineLimittingMinSlopeSpinBox;
85  QDoubleSpinBox* inclineLimittingLimitSpinBox;
86  QSlider* startOrientatationSlider;
87  QSlider* goalOrientationSlider;
88  QDoubleSpinBox* obstacleDistanceSpinBox;
89  QDoubleSpinBox* obstacleFactorSpinBox;
90  QComboBox* slopeMetricComboBox;
91  QComboBox* heuristicComboBox;
92  QSpinBox* numThreadsSpinBox;
93  QProgressBar* bar;
94  QWidget window;
95  vizkit3d::SbplSplineVisualization splineViz;
96  vizkit3d::SubTrajectoryVisualization trajViz;
97  vizkit3d::SubTrajectoryVisualization trajViz2;
98  vizkit3d::MLSMapVisualization mlsViz;
99  vizkit3d::TraversabilityMap3dVisualization trav3dViz;
100  vizkit3d::TraversabilityMap3dVisualization obstacleMapViz;
101  vizkit3d::RigidBodyStateVisualization startViz;
102  vizkit3d::RigidBodyStateVisualization goalViz;
103  vizkit3d::GridVisualization gridViz;
104  maps::grid::MLSMapSloped mlsMap;
105  base::Pose start;
106  base::Pose goal;
107  bool pickStart = true;
108  bool startPicked = false;
109  bool goalPicked = false;
110  bool threadRunning = false;
111  sbpl_spline_primitives::SplinePrimitivesConfig splineConfig;
112  ugv_nav4d::Mobility mobilityConfig;
113  traversability_generator3d::TraversabilityConfig travConfig;
114  ugv_nav4d::PlannerConfig plannerConfig;
115  std::shared_ptr<ugv_nav4d::Planner> planner; //is pointer cause of lazy init
116  std::vector<trajectory_follower::SubTrajectory> path;
117  std::vector<trajectory_follower::SubTrajectory> beautifiedPath;
118 
119 };
Definition: PlannerGui.h:32
void show()
Definition: PlannerGui.cpp:493
PlannerGui(int argc, char **argv)
Definition: PlannerGui.cpp:57
void plannerDone()
void plannerIsDone()
Definition: PlannerGui.cpp:613
void plan(const base::Pose &start, const base::Pose &goal)
Definition: PlannerGui.cpp:649
void picked(float x, float y, float z, int buttonMask, int modifierMask)
Definition: PlannerGui.cpp:451
Definition: PlannerGui.h:27
Definition: Mobility.hpp:12
Definition: PlannerConfig.hpp:8