Roomba App  1.0
GLWidget Class Reference

#include <glWidget.hh>

Inheritance diagram for GLWidget:
Collaboration diagram for GLWidget:

Public Slots

void obstacleDataReady (const std::map< float, int > &lidarData)
 Slot to get lidar data when parser sent signal that this data is ready. More...
 

Public Member Functions

 GLWidget (QWidget *parent)
 Construct a new GLWidget object. More...
 

Protected Member Functions

virtual void init () override
 Initialize openGL widget. More...
 
virtual void draw () override
 Draw content in openGL widget. More...
 
virtual QString helpString () const override
 Construct help string for openGL widget. More...
 

Private Member Functions

void drawRobot ()
 Draw robot shape. More...
 
void drawOneObstacle (GLfloat x, GLfloat y, GLfloat z, GLfloat color)
 Draw one obstacle. More...
 
void _drawCube (GLfloat size, GLubyte R, GLubyte G, GLubyte B)
 Draw cube shape. More...
 
void _drawCylinder (GLfloat radius, GLfloat height, GLubyte R, GLubyte G, GLubyte B)
 Draw cylinder shape. More...
 

Private Attributes

std::vector< std::vector< float > > _obstacleCoordinates
 All obstacles coordinates. More...
 
std::vector< float > _obstacleRadius
 _obstacleRadius All obstacles radius More...
 
const float __scale = 1.0f / 4000.0f
 
const float __robotHeight = 200.0 * __scale
 
const float __robotRadius = 300.0 * __scale
 
const float __robotWheelRadius = 100.0 * __scale
 
const float __robotWheelThickness = 50.0 * __scale
 
const float __lidarHeight = 210.0 * __scale
 
const float __obstacleSize = 30.0 * __scale
 

Detailed Description

Definition at line 19 of file glWidget.hh.

Constructor & Destructor Documentation

◆ GLWidget()

GLWidget::GLWidget ( QWidget *  parent)
Parameters
[in]parentPoiter to parent widget

Definition at line 14 of file glWidget.cpp.

Member Function Documentation

◆ _drawCube()

void GLWidget::_drawCube ( GLfloat  size,
GLubyte  R,
GLubyte  G,
GLubyte  B 
)
private
Parameters
[in]sizeCube size
[in]RRed color value [0-255]
[in]GGreen color value [0-255]
[in]BBlue color value [0-255]

Definition at line 122 of file glWidget.cpp.

Here is the caller graph for this function:

◆ _drawCylinder()

void GLWidget::_drawCylinder ( GLfloat  radius,
GLfloat  height,
GLubyte  R,
GLubyte  G,
GLubyte  B 
)
private
Parameters
[in]radiusCylinder radius
[in]heightCylinder height
[in]RRed color value [0-255]
[in]GGreen color value [0-255]
[in]BBlue color value [0-255]

Definition at line 169 of file glWidget.cpp.

Here is the caller graph for this function:

◆ draw()

void GLWidget::draw ( )
overrideprotectedvirtual

Definition at line 47 of file glWidget.cpp.

Here is the call graph for this function:

◆ drawOneObstacle()

void GLWidget::drawOneObstacle ( GLfloat  x,
GLfloat  y,
GLfloat  z,
GLfloat  color 
)
private
Parameters
[in]xCoordinate on x axis
[in]yCoordinate on y axis
[in]zCoordinate on z axis
[in]colorObstacle color

Definition at line 113 of file glWidget.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawRobot()

void GLWidget::drawRobot ( )
private

Definition at line 93 of file glWidget.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ helpString()

QString GLWidget::helpString ( ) const
overrideprotectedvirtual
Returns
String with help

Definition at line 70 of file glWidget.cpp.

◆ init()

void GLWidget::init ( )
overrideprotectedvirtual

Definition at line 64 of file glWidget.cpp.

◆ obstacleDataReady

void GLWidget::obstacleDataReady ( const std::map< float, int > &  lidarData)
slot
Parameters
[in]lidarDataLidar data from frame parser

Definition at line 16 of file glWidget.cpp.

Here is the caller graph for this function:

Member Data Documentation

◆ __lidarHeight

const float GLWidget::__lidarHeight = 210.0 * __scale
private

Definition at line 110 of file glWidget.hh.

◆ __obstacleSize

const float GLWidget::__obstacleSize = 30.0 * __scale
private

Definition at line 112 of file glWidget.hh.

◆ __robotHeight

const float GLWidget::__robotHeight = 200.0 * __scale
private

Definition at line 104 of file glWidget.hh.

◆ __robotRadius

const float GLWidget::__robotRadius = 300.0 * __scale
private

Definition at line 105 of file glWidget.hh.

◆ __robotWheelRadius

const float GLWidget::__robotWheelRadius = 100.0 * __scale
private

Definition at line 107 of file glWidget.hh.

◆ __robotWheelThickness

const float GLWidget::__robotWheelThickness = 50.0 * __scale
private

Definition at line 108 of file glWidget.hh.

◆ __scale

const float GLWidget::__scale = 1.0f / 4000.0f
private

Some dimensions used in drawing im millimiters

Scale is important because max distance from lidar is 4m so we have to scale down other dimensions to fit all data in 1x1x1 cube

Definition at line 102 of file glWidget.hh.

◆ _obstacleCoordinates

std::vector<std::vector<float> > GLWidget::_obstacleCoordinates
private

Definition at line 89 of file glWidget.hh.

◆ _obstacleRadius

std::vector<float> GLWidget::_obstacleRadius
private

Definition at line 94 of file glWidget.hh.


The documentation for this class was generated from the following files: