libmove3d-planners
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros Groups Pages
HUD.h
1 #ifndef API_HUD_H
2 #define API_HUD_H
3 
4 #include "Graphic-pkg.h"
5 #include <boost/bind.hpp>
6 #include <boost/function.hpp>
7 #include <set>
8 #include "API/Device/robot.hpp"
9 #include "Logging/Logger.h"
10 #ifdef QT_LIBRARY
11 #include <QtCore/QObject>
12 #endif
13 
14 
15 namespace API {
16 
21 {
22  PlanningStatus(bool plannerOk=false, bool isTrrt=false, unsigned int nbFails=0,double gap=0,double initTargetDist=0,double temp=-1,bool found=false):
23  plannerOk(plannerOk), plannerTRRT(isTrrt),nbFails(nbFails),gap(gap),initTargetDist(initTargetDist),temperature(temp), found(found) {}
24  bool plannerOk;
25  bool plannerTRRT;
26  unsigned int nbFails;
27  double gap;
28  double initTargetDist;
29  double temperature;
30  bool found;
31 };
32 
38 class HUD
39 #ifdef QT_LIBRARY
40  : public QObject
41 #endif
42 {
43 #ifdef QT_LIBRARY
44  Q_OBJECT
45 #endif
46  MOVE3D_STATIC_LOGGER;
47 public:
48  HUD();
50  static HUD* getHUD();
52  static void initHUD();
53  virtual ~HUD();
54 
55 #ifdef QT_LIBRARY
56 public slots:
57 #endif
58 
62  void setDraw(bool enable);
66  void setTextSize(double textSize);
68  void setTextSize3d(double textSize3d);
69 
71  void setDrawAgentInfo(bool drawAgentInfo);
73  void setDrawCost(bool drawCost);
75  void setDrawAdvancedCost(bool drawAdvancedCost);
77  void setDrawSearchStatus(bool drawSearchStatus);
78 public:
79  bool isDraw();
80  static void drawHUD(void);
81 
82  double textSize() const;
83  double textSize3d() const;
84 
85  void setAgentStaticInfoDefault();
86  const std::map<Robot *, std::string> &agentStaticInfo() const;
87  void setAgentStaticInfo(const std::map<Robot *, std::string> &agentStaticInfo);
88 
89  bool getDrawAgentInfo() const;
90  bool getDrawCost() const;
91  bool getDrawAdvancedCost() const;
92  bool getDrawSearchStatus() const;
93 
101 
102 protected:
103 
105  virtual void draw();
106 
107  void printAgentInfo();
108  void printCost();
109  void printAdvancedCost();
110  void printSearchStatus();
111 
112 private:
113  static std::set<HUD*> _hud_to_draw;
114  static HUD* __hud;
115 
116  std::map<Robot*,std::string> _agentStaticInfo;
117 
118  double _textSize;
119  double _textSize3d;
120 
121  bool _drawAgentInfo;
122  bool _drawCost;
123  bool _drawAdvancedCost;
124  bool _drawSearchStatus;
125 };
126 
127 } // namespace API
128 
129 #endif // API_HUD_H
bool found
is the path found
Definition: HUD.h:30
void setDrawCost(bool drawCost)
draw the cost of the currently scene (through global_costSpace)
Definition: HUD.cpp:249
unsigned int nbFails
nb of configurations shot and discarded (in collision or too expansive)
Definition: HUD.h:26
bool plannerTRRT
is there a planner ?
Definition: HUD.h:25
void setDraw(bool enable)
setDraw to enable or disable this HUD
Definition: HUD.cpp:318
The PlanningStatus struct groups data about a planner state.
Definition: HUD.h:20
static PlanningStatus getPlanningStatus()
getPlanningStatus fetch information about the planner
Definition: HUD.cpp:205
This file implements macros to help with the logging, in a way similar to ROS, using log4cxx...
double temperature
for T-RRT, Simulated Annealing temperature
Definition: HUD.h:29
double gap
distance between the last added node and the goal, or something else when using Bi-RRT ...
Definition: HUD.h:27
The HUD class aims at providing, centralizing and managing information displayed in the scene...
Definition: HUD.h:38
void setTextSize(double textSize)
set global text size used for displaying 2d info on the screen
Definition: HUD.cpp:279
double initTargetDist
distance separing the initial and target configurations (configuration space)
Definition: HUD.h:28
void setDrawAgentInfo(bool drawAgentInfo)
enable the drawing of agents shortnames above their head
Definition: HUD.cpp:259
static void initHUD()
initialize the HUD class so any existing or future HUD can be displayed (creates the interface with g...
Definition: HUD.cpp:35
virtual void draw()
draw this HUD taking into account its options
Definition: HUD.cpp:47
void setTextSize3d(double textSize3d)
set text size for drawing 3d text in the scene
Definition: HUD.cpp:289
void setDrawSearchStatus(bool drawSearchStatus)
enable the drawing of planning status (through global_Move3DPlanner, RRT, T-RRT)
Definition: HUD.cpp:228
static HUD * getHUD()
get the main HUD (acts like a singleton)
Definition: HUD.cpp:27
void setDrawAdvancedCost(bool drawAdvancedCost)
enable the drawing of advanced cost information (throug HRICS::CostManager)
Definition: HUD.cpp:239