Roomba App  1.0
glWidget.hh
Go to the documentation of this file.
1 
12 #ifndef GLWIDGET_HH
13 #define GLWIDGET_HH
14 
15 #include <QGLViewer/qglviewer.h>
16 
17 #define PI 3.1415927f
18 
19 class GLWidget : public QGLViewer
20 {
21  public:
26  GLWidget(QWidget* parent);
27 
28  public slots:
33  void obstacleDataReady(const std::map<float, int>& lidarData);
34 
35  protected:
39  virtual void init() override;
40 
44  virtual void draw() override;
45 
50  virtual QString helpString() const override;
51 
52  private:
56  void drawRobot();
57 
65  void drawOneObstacle(GLfloat x, GLfloat y, GLfloat z, GLfloat color);
66 
74  void _drawCube(GLfloat size, GLubyte R, GLubyte G, GLubyte B);
75 
84  void _drawCylinder(GLfloat radius, GLfloat height, GLubyte R, GLubyte G, GLubyte B);
85 
89  std::vector<std::vector<float>> _obstacleCoordinates;
90 
94  std::vector<float> _obstacleRadius;
95 
102  const float __scale = 1.0f / 4000.0f;
103 
104  const float __robotHeight = 200.0 * __scale;
105  const float __robotRadius = 300.0 * __scale;
106 
107  const float __robotWheelRadius = 100.0 * __scale;
108  const float __robotWheelThickness = 50.0 * __scale;
109 
110  const float __lidarHeight = 210.0 * __scale;
111 
112  const float __obstacleSize = 30.0 * __scale;
113 };
114 
115 #endif // GLWIDGET_HH
const float __scale
Definition: glWidget.hh:102
const float __robotHeight
Definition: glWidget.hh:104
const float __robotRadius
Definition: glWidget.hh:105
void _drawCylinder(GLfloat radius, GLfloat height, GLubyte R, GLubyte G, GLubyte B)
Draw cylinder shape.
Definition: glWidget.cpp:169
void obstacleDataReady(const std::map< float, int > &lidarData)
Slot to get lidar data when parser sent signal that this data is ready.
Definition: glWidget.cpp:16
void drawRobot()
Draw robot shape.
Definition: glWidget.cpp:93
void drawOneObstacle(GLfloat x, GLfloat y, GLfloat z, GLfloat color)
Draw one obstacle.
Definition: glWidget.cpp:113
GLWidget(QWidget *parent)
Construct a new GLWidget object.
Definition: glWidget.cpp:14
const float __robotWheelRadius
Definition: glWidget.hh:107
std::vector< std::vector< float > > _obstacleCoordinates
All obstacles coordinates.
Definition: glWidget.hh:89
const float __obstacleSize
Definition: glWidget.hh:112
void _drawCube(GLfloat size, GLubyte R, GLubyte G, GLubyte B)
Draw cube shape.
Definition: glWidget.cpp:122
virtual void init() override
Initialize openGL widget.
Definition: glWidget.cpp:64
const float __lidarHeight
Definition: glWidget.hh:110
std::vector< float > _obstacleRadius
_obstacleRadius All obstacles radius
Definition: glWidget.hh:94
virtual void draw() override
Draw content in openGL widget.
Definition: glWidget.cpp:47
virtual QString helpString() const override
Construct help string for openGL widget.
Definition: glWidget.cpp:70
const float __robotWheelThickness
Definition: glWidget.hh:108