Roomba App  1.0
Parser Class Reference

Parsing class for a processing data from the serial port frame. More...

#include <parser.hh>

Inheritance diagram for Parser:
Collaboration diagram for Parser:

Signals

void changedLeftMotorGSpeed (const QString &speedValue)
 A signal emitted when parsed data of the left motor given speed is ready. More...
 
void changedRightMotorGSpeed (const QString &speedValue)
 A signal emitted when parsed data of the right motor given speed is ready. More...
 
void changedLeftMotorSpeed (const QString &speedValue)
 A signal emitted when parsed data of the left motor speed is ready. More...
 
void changedRightMotorSpeed (const QString &speedValue)
 A signal emitted when parsed data of the right motor speed is ready. More...
 
void changedLeftMotorAcceleration (const QString &accelerationValue)
 A signal emitted when parsed data of the left motor acceleration is ready. More...
 
void changedRightMotorAcceleration (const QString &accelerationValue)
 A signal emitted when parsed data of the right motor acceleration is ready. More...
 
void changedJoystick (const QPoint &coordinates)
 A signal emitted when parsed data of a joystick swing is ready. More...
 
void changedBattery (int battery)
 A signal emitted when parsed data of the battery voltage is ready. More...
 
void changedLidar (const std::map< float, int > lidarData)
 A signal emitted when parsed data of the lidar is ready. More...
 
void leftMotorDirection (const int &direction)
 A signal emitted to pass wheel rotating direction to the openGL widget. More...
 
void rightMotorDirection (const int &direction)
 A signal emitted to pass wheel rotating direction to the openGL widget. More...
 
void setObstacleCloseStatus ()
 Set the Obstacle Close Status. More...
 
void resetObstacleCloseStatus ()
 Reset the Obstacle Close Status. More...
 

Public Member Functions

 Parser ()=default
 Construct a new Parser object. More...
 
 ~Parser ()=default
 Destroy the Parser object. More...
 
bool parseFrame (const std::string &frame)
 Parse line from the serial port into managed variables. More...
 
void processData ()
 Process data from a one frame. More...
 

Private Member Functions

float calculateSpeedRight (const int &xAxis, const int &yAxis)
 Calculate speed value on the right motor from the joystick swing. More...
 
float calculateSpeedLeft (const int &xAxis, const int &yAxis)
 Calculate speed value on the left motor from the joystick swing. More...
 

Private Attributes

int _leftSpeed
 The left motor speed. More...
 
int _rightSpeed
 The right motor speed. More...
 
int _leftAcceleration
 The left motor acceleration. More...
 
int _rightAcceleration
 The right motor acceleration. More...
 
int _xAxis
 The joystick swing on the x axis. More...
 
int _yAxis
 The joystick swing on the y axis. More...
 
int _battery
 The battery voltage. More...
 
std::map< float, int > _lidarData
 Data from a laser sensor. More...
 
int _CRC16
 Sent CRC from the device. More...
 

Detailed Description

Definition at line 28 of file parser.hh.

Constructor & Destructor Documentation

◆ Parser()

Parser::Parser ( )
explicitdefault

◆ ~Parser()

Parser::~Parser ( )
default

Member Function Documentation

◆ calculateSpeedLeft()

float Parser::calculateSpeedLeft ( const int &  xAxis,
const int &  yAxis 
)
private
Parameters
[in]xAxisValue of swing on the x axis.
[in]yAxisValue of swing on the y axis.
Returns
Speed value on the left motor.

Definition at line 190 of file parser.cpp.

Here is the caller graph for this function:

◆ calculateSpeedRight()

float Parser::calculateSpeedRight ( const int &  xAxis,
const int &  yAxis 
)
private
Parameters
[in]xAxisValue of swing on the x axis.
[in]yAxisValue of swing on the y axis.
Returns
Speed value on the right motor.

Definition at line 136 of file parser.cpp.

Here is the caller graph for this function:

◆ changedBattery

void Parser::changedBattery ( int  battery)
signal
Parameters
[out]batteryValue of the battery voltage.
Here is the caller graph for this function:

◆ changedJoystick

void Parser::changedJoystick ( const QPoint &  coordinates)
signal
Parameters
[out]coordinatesValues of swing on the x and the y axis.
Here is the caller graph for this function:

◆ changedLeftMotorAcceleration

void Parser::changedLeftMotorAcceleration ( const QString &  accelerationValue)
signal
Parameters
[out]accelerationValueValue of the left motor acceleration.
Here is the caller graph for this function:

◆ changedLeftMotorGSpeed

void Parser::changedLeftMotorGSpeed ( const QString &  speedValue)
signal
Parameters
[out]speedValueValue of left motor given speed.
Here is the caller graph for this function:

◆ changedLeftMotorSpeed

void Parser::changedLeftMotorSpeed ( const QString &  speedValue)
signal
Parameters
[out]speedValueValue of left motor speed.
Here is the caller graph for this function:

◆ changedLidar

void Parser::changedLidar ( const std::map< float, int >  lidarData)
signal
Parameters
[out]lidarDataA map containing lidar data [key is angle and value is distance].
Here is the caller graph for this function:

◆ changedRightMotorAcceleration

void Parser::changedRightMotorAcceleration ( const QString &  accelerationValue)
signal
Parameters
[out]accelerationValueValue of the right motor acceleration.
Here is the caller graph for this function:

◆ changedRightMotorGSpeed

void Parser::changedRightMotorGSpeed ( const QString &  speedValue)
signal
Parameters
[out]speedValueValue of right motor given speed.
Here is the caller graph for this function:

◆ changedRightMotorSpeed

void Parser::changedRightMotorSpeed ( const QString &  speedValue)
signal
Parameters
[out]speedValueValue of the right motor speed.
Here is the caller graph for this function:

◆ leftMotorDirection

void Parser::leftMotorDirection ( const int &  direction)
signal
Parameters
[out]directionWheel spining direction.
Here is the caller graph for this function:

◆ parseFrame()

bool Parser::parseFrame ( const std::string &  frame)
Parameters
[in]frameOne line from the serial port.
Returns
Identifier wether a frame was parsed successfully.

Definition at line 21 of file parser.cpp.

Here is the caller graph for this function:

◆ processData()

void Parser::processData ( )

Definition at line 72 of file parser.cpp.

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

◆ resetObstacleCloseStatus

void Parser::resetObstacleCloseStatus ( )
signal
Here is the caller graph for this function:

◆ rightMotorDirection

void Parser::rightMotorDirection ( const int &  direction)
signal
Parameters
[out]directionA wheel spining direction.
Here is the caller graph for this function:

◆ setObstacleCloseStatus

void Parser::setObstacleCloseStatus ( )
signal
Here is the caller graph for this function:

Member Data Documentation

◆ _battery

int Parser::_battery
private

Definition at line 155 of file parser.hh.

◆ _CRC16

int Parser::_CRC16
private

Definition at line 157 of file parser.hh.

◆ _leftAcceleration

int Parser::_leftAcceleration
private

Definition at line 151 of file parser.hh.

◆ _leftSpeed

int Parser::_leftSpeed
private

Definition at line 149 of file parser.hh.

◆ _lidarData

std::map<float, int> Parser::_lidarData
private

Definition at line 156 of file parser.hh.

◆ _rightAcceleration

int Parser::_rightAcceleration
private

Definition at line 152 of file parser.hh.

◆ _rightSpeed

int Parser::_rightSpeed
private

Definition at line 150 of file parser.hh.

◆ _xAxis

int Parser::_xAxis
private

Definition at line 153 of file parser.hh.

◆ _yAxis

int Parser::_yAxis
private

Definition at line 154 of file parser.hh.


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