direcs  2012-09-30
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ConsoleGui Class Reference

The 'gui' class in the console mode. More...

#include <consoleGui.h>

List of all members.

Public Slots

void appendLog (QString text, bool CR=true, bool sayIt=false)
void appendNetworkLog (QString text, bool CR=true, bool sayIt=false)
void appendSerialLog (QString text, bool CR=true)
void refreshLaserViewFront (QList< float > laserScannerValues, QList< int > laserScannerFlags)
void refreshLaserViewRear (QList< float > laserScannerValues, QList< int > laserScannerFlags)
void setLaserscannerAngle (short int laserscanner, int angle)
void setLaserscannerResolution (short int laserscanner, float resolution)
void setRobotControls (bool state)
void showLaserFrontAngles (int largestFreeAreaStart, int largestFreeAreaEnd, int centerOfFreeWay, float width)
void showPreferredDirection (QString direction)

Signals

void drive (const unsigned char command)
void enableRemoteControlListening (bool state)
void initCircuit ()
void initServos ()
void resetDrivenDistance (int sensor)
void shutdown ()
void simulate (bool state)
void speak (QString text)
void test ()

Public Member Functions

 ConsoleGui ()
void showAlarm (short int sensor, bool state)
void showDistanceGraphical (int sensor, int distance)
void showDrivenDistance (int sensor, int distance)
void showMotorStatus (unsigned char motor, bool power, unsigned char direction)
 ~ConsoleGui ()

Private Member Functions

void createLaserDistanceObjects ()
void createLaserScannerObjects ()

Private Attributes

bool robotIsOn

Static Private Attributes

static const float AMPERESMAXPLOTCURVE1 = 3000.0
static const float AMPERESMAXPLOTCURVE2 = 3000.0
 The maximum axis Y value in Amperes (A) for plot curve number 1.
static const float AMPERESSTEPPLOTCURVE1 = 500.0
 The maximum axis Y value in Amperes (A) for plot curve number 2.
static const float AMPERESSTEPPLOTCURVE2 = 500.0
 The step value for the y axis for plot curve number 1.
static const int CENTEROFLARGESTFREEWAY = 3
static const unsigned char CLOCKWISE = 0
 for the test widget
static const unsigned char COUNTERCLOCKWISE = 1
 Motor direction "CLOCKWISE".
static const int FITTOFRAMEFACTOR = 45
static const int FREEWAY = 0
static const int INITIALLASERYPOSFRONT = 100
 the initial Y position of the laser lines and the robot image in the GUI
static const int INITIALLASERYPOSREAR = 100
static const int LARGESTFREEWAY = 2
static const short int LASER1 = 1
static const short int LASER2 = 2
static const short int LASER3 = 4
static const short int LASER4 = 8
static const short int LASER5 = 16
static const int LASERDISTANCECIRCLES = 27
 Number of distance semi circles.
static const int LASERDISTANCEDISTANCE = 60
 Distances between the lines to show the laser distances in pixels.
static const int LASERDISTANCEFIRSTCIRCLE = 82
 the size (diameter) of the first (innerst) circle in pixels
static const unsigned char MOTOR1 = 10
 Motor direction/power "same like before".
static const unsigned char MOTOR1BW = 11
 for the test widget
static const unsigned char MOTOR1FW = 10
 For button signal "stop driving".
static const unsigned char MOTOR1OFF = 12
 for the test widget
static const unsigned char MOTOR2 = 20
 Motor 1 front left.
static const unsigned char MOTOR2BW = 14
 for the test widget
static const unsigned char MOTOR2FW = 13
 for the test widget
static const unsigned char MOTOR2OFF = 15
 for the test widget
static const unsigned char MOTOR3 = 30
 Motor 2 front right.
static const unsigned char MOTOR3BW = 17
 for the test widget
static const unsigned char MOTOR3FW = 16
 for the test widget
static const unsigned char MOTOR3OFF = 18
 for the test widget
static const unsigned char MOTOR4 = 40
 Motor 3 back left.
static const unsigned char MOTOR4BW = 20
 for the test widget
static const unsigned char MOTOR4FW = 19
 for the test widget
static const unsigned char MOTOR4OFF = 21
 for the test widget
static const short int MOTORSENSOR1 = 0
static const short int MOTORSENSOR2 = 1
static const short int NONE = 0
static const int OBSTACLE = 1
static const bool OFF = false
static const bool ON = true
 The step value for the y axis for plot curve number 1.
static const unsigned char SAME = 3
 Motor direction "COUNTERCLOCKWISE.
static const short int SENSOR1 = 1
 Motor 4 back right.
static const short int SENSOR16 = 256
static const short int SENSOR2 = 2
static const short int SENSOR3 = 4
static const short int SENSOR4 = 8
static const short int SENSOR5 = 16
static const short int SENSOR6 = 32
static const short int SENSOR7 = 64
static const short int SENSOR8 = 128
static const int SENSORPROGRESSBARMAXIR = 50
 Stores the robots (circuits) state.ON or OFF.
static const int SENSORPROGRESSBARMAXUS = 400
static const unsigned char START = 7
static const int STARTZOOMLEVEL = 3
static const unsigned char STOP = 8
 For button signal "start driving".

Detailed Description

The 'gui' class in the console mode.

Author:
Markus Knapp

Definition at line 32 of file consoleGui.h.


Constructor & Destructor Documentation

ConsoleGui::ConsoleGui ( )

Definition at line 24 of file consoleGui.cpp.

ConsoleGui::~ConsoleGui ( )

Definition at line 29 of file consoleGui.cpp.


Member Function Documentation

void ConsoleGui::appendLog ( QString  text,
bool  CR = true,
bool  sayIt = false 
)
slot

Appends text to the main log in the main window.

Parameters:
textis the text to be displayed.
CRadds a carriage return (CR) to the text, if true (default). This parameter is optional!
sayItIf true, the text is also spoken (default=false). This parameter is optional!

Definition at line 49 of file consoleGui.cpp.

void ConsoleGui::appendNetworkLog ( QString  text,
bool  CR = true,
bool  sayIt = false 
)
slot

Append text to the network log in the main window

Parameters:
textis the text to be displayed.
CRadds a carriage return (CR) to the text, if true (default). This parameter is optional!
sayItIf true, the text is also spoken (default=false). This parameter is optional!
See also:
appendLog()

Definition at line 78 of file consoleGui.cpp.

void ConsoleGui::appendSerialLog ( QString  text,
bool  CR = true 
)
slot

Append text to the serial log in the main window

Parameters:
textis the text to be displayed.
CRadds a carriage return (CR) to the text, if true (default). This parameter is optional!
See also:
appendLog()

Definition at line 91 of file consoleGui.cpp.

Here is the caller graph for this function:

void ConsoleGui::createLaserDistanceObjects ( )
private
void ConsoleGui::createLaserScannerObjects ( )
private

Creates all objects, lines, scene, view etc.

void ConsoleGui::drive ( const unsigned char  command)
signal

Instructs the robot to drive FORWARD, BACKWARD, LEFT and RIGHT. The commands START, STOP or WAIT are also possible.

Parameters:
command
void ConsoleGui::enableRemoteControlListening ( bool  state)
signal

Enables or disables the listening for the robot remote control. This signal is sent from the remote control button.

Parameters:
statecan be true or false.
See also:
NetworkThread()
void ConsoleGui::initCircuit ( )
signal

Initializes the robots basic circuit.

void ConsoleGui::initServos ( )
signal

Initializes the servos.

void ConsoleGui::refreshLaserViewFront ( QList< float >  laserScannerValues,
QList< int >  laserScannerFlags 
)
slot

Refreshes the view of the lines from the front laser scanner.

Definition at line 562 of file consoleGui.cpp.

void ConsoleGui::refreshLaserViewRear ( QList< float >  laserScannerValues,
QList< int >  laserScannerFlags 
)
slot

Refreshes the view of the lines from the rear laser scanner.

Definition at line 570 of file consoleGui.cpp.

void ConsoleGui::resetDrivenDistance ( int  sensor)
signal

Resets the driven distance to 0.

Parameters:
sensoris the sensor number.
void ConsoleGui::setLaserscannerAngle ( short int  laserscanner,
int  angle 
)
slot

Gets the angle of a laser from the

See also:
laserThread for drawing the correct laser scanner angles (e.g. 180 or 270 degrees)
Parameters:
laserScannercan be LASER1 or LASER2
anglein degrees

Definition at line 578 of file consoleGui.cpp.

Here is the caller graph for this function:

void ConsoleGui::setLaserscannerResolution ( short int  laserscanner,
float  resolution 
)
slot

Gets the resolution of a laser from the

See also:
laserThread for drawing the correct laser scanner angles (e.g. 0.5 or 1.0 degrees)
Parameters:
laserScannercan be LASER1 or LASER2
anglein degrees

Definition at line 585 of file consoleGui.cpp.

Here is the caller graph for this function:

void ConsoleGui::setRobotControls ( bool  state)
slot

Only store the robots state locally.

Parameters:
statecan be ON or OFF

Definition at line 42 of file consoleGui.cpp.

void ConsoleGui::showAlarm ( short int  sensor,
bool  state 
)

Shows a sensor alarm (turns progressBars red, text in bold etc.)

Parameters:
sensoris the sensor number.
statecan be ON or OFF.

Definition at line 201 of file consoleGui.cpp.

void ConsoleGui::showDistanceGraphical ( int  sensor,
int  distance 
)

Shows a sensor distance in a progress bar.

Parameters:
sensoris the sensor number.
distanceis the distance in cm.
See also:
SensorThread::convertToSensorValue(), SensorThread::convertToDistance()

Definition at line 121 of file consoleGui.cpp.

void ConsoleGui::showDrivenDistance ( int  sensor,
int  distance 
)

Shows the driven distance in a text label.

Parameters:
sensoris the sensor number.
distanceis the distance in cm.

Definition at line 175 of file consoleGui.cpp.

void ConsoleGui::showLaserFrontAngles ( int  largestFreeAreaStart,
int  largestFreeAreaEnd,
int  centerOfFreeWay,
float  width 
)
slot

Shows the angles of the free area where to drive in lables.

Parameters:
largestFreeAreaStart
largestFreeAreaEnd
centerOfFreeWay
widthof the estimated drive-tru area

Definition at line 531 of file consoleGui.cpp.

void ConsoleGui::showMotorStatus ( unsigned char  motor,
bool  power,
unsigned char  direction 
)

Shows the status and direction of a motor (ON, OFF, RIGHT, LEFT)

Parameters:
motoris the motor number.
powercan be ON or OFF.
directioncan be FORWARD or BACKWARD.

Definition at line 407 of file consoleGui.cpp.

void ConsoleGui::showPreferredDirection ( QString  direction)
slot

Shows the preferred driving direction in a lable.

Parameters:
directioncan be FORWARD, BACKWARD, LEFT or RIGHT

Definition at line 541 of file consoleGui.cpp.

void ConsoleGui::shutdown ( )
signal

Exits the whole programm.

void ConsoleGui::simulate ( bool  state)
signal

Enables or disables the robots simulation mode. This signal is sent from the simulation button and received from all threads which deliver real signals from the bot. Once the signal is received, the slots switches to simulation mode.

Parameters:
statecan be true or false.
See also:
Direcs::setSimulationMode()
SensorThread::setSimulationMode()
LaserThread::setSimulationMode()
ObstackeCheckThread::setSimulationMode()
void ConsoleGui::speak ( QString  text)
signal

Emits a speak signal. This signal is sent to the speakThread.

void ConsoleGui::test ( )
signal

Emits a signal to call the test method in the Direcs class..


Member Data Documentation

const float ConsoleGui::AMPERESMAXPLOTCURVE1 = 3000.0
staticprivate

max value in cm for us sensor

Definition at line 223 of file consoleGui.h.

const float ConsoleGui::AMPERESMAXPLOTCURVE2 = 3000.0
staticprivate

The maximum axis Y value in Amperes (A) for plot curve number 1.

Definition at line 224 of file consoleGui.h.

const float ConsoleGui::AMPERESSTEPPLOTCURVE1 = 500.0
staticprivate

The maximum axis Y value in Amperes (A) for plot curve number 2.

Definition at line 225 of file consoleGui.h.

const float ConsoleGui::AMPERESSTEPPLOTCURVE2 = 500.0
staticprivate

The step value for the y axis for plot curve number 1.

Definition at line 226 of file consoleGui.h.

const int ConsoleGui::CENTEROFLARGESTFREEWAY = 3
staticprivate

Definition at line 306 of file consoleGui.h.

const unsigned char ConsoleGui::CLOCKWISE = 0
staticprivate

for the test widget

Definition at line 247 of file consoleGui.h.

const unsigned char ConsoleGui::COUNTERCLOCKWISE = 1
staticprivate

Motor direction "CLOCKWISE".

Definition at line 248 of file consoleGui.h.

const int ConsoleGui::FITTOFRAMEFACTOR = 45
staticprivate

Factor for fitting 6 meters (measured from the laser scanner) into a frame with a height of 270 pixels at a default zoom level of 5 !! Example:

laservalue = 0.18 cm fit factor = 45 zoom level = 5

0.18 x 45 x 5 = 40.5 Pixel -> 41 Pixel is the length of the laser line in the GUI

Definition at line 288 of file consoleGui.h.

const int ConsoleGui::FREEWAY = 0
staticprivate

Definition at line 303 of file consoleGui.h.

const int ConsoleGui::INITIALLASERYPOSFRONT = 100
staticprivate

the initial Y position of the laser lines and the robot image in the GUI

Definition at line 292 of file consoleGui.h.

const int ConsoleGui::INITIALLASERYPOSREAR = 100
staticprivate

Definition at line 293 of file consoleGui.h.

const int ConsoleGui::LARGESTFREEWAY = 2
staticprivate

Definition at line 305 of file consoleGui.h.

const short int ConsoleGui::LASER1 = 1
staticprivate

Defines the size of the laserLines[] array This es equal to the number of degrees. See also laserThread.h For the laserThread

Definition at line 318 of file consoleGui.h.

const short int ConsoleGui::LASER2 = 2
staticprivate

Definition at line 319 of file consoleGui.h.

const short int ConsoleGui::LASER3 = 4
staticprivate

Definition at line 320 of file consoleGui.h.

const short int ConsoleGui::LASER4 = 8
staticprivate

Definition at line 321 of file consoleGui.h.

const short int ConsoleGui::LASER5 = 16
staticprivate

Definition at line 322 of file consoleGui.h.

const int ConsoleGui::LASERDISTANCECIRCLES = 27
staticprivate

Number of distance semi circles.

Definition at line 296 of file consoleGui.h.

const int ConsoleGui::LASERDISTANCEDISTANCE = 60
staticprivate

Distances between the lines to show the laser distances in pixels.

Definition at line 300 of file consoleGui.h.

const int ConsoleGui::LASERDISTANCEFIRSTCIRCLE = 82
staticprivate

the size (diameter) of the first (innerst) circle in pixels

Definition at line 298 of file consoleGui.h.

const unsigned char ConsoleGui::MOTOR1 = 10
staticprivate

Motor direction/power "same like before".

Definition at line 250 of file consoleGui.h.

const unsigned char ConsoleGui::MOTOR1BW = 11
staticprivate

for the test widget

Definition at line 235 of file consoleGui.h.

const unsigned char ConsoleGui::MOTOR1FW = 10
staticprivate

For button signal "stop driving".

Definition at line 234 of file consoleGui.h.

const unsigned char ConsoleGui::MOTOR1OFF = 12
staticprivate

for the test widget

Definition at line 236 of file consoleGui.h.

const unsigned char ConsoleGui::MOTOR2 = 20
staticprivate

Motor 1 front left.

Definition at line 251 of file consoleGui.h.

const unsigned char ConsoleGui::MOTOR2BW = 14
staticprivate

for the test widget

Definition at line 238 of file consoleGui.h.

const unsigned char ConsoleGui::MOTOR2FW = 13
staticprivate

for the test widget

Definition at line 237 of file consoleGui.h.

const unsigned char ConsoleGui::MOTOR2OFF = 15
staticprivate

for the test widget

Definition at line 239 of file consoleGui.h.

const unsigned char ConsoleGui::MOTOR3 = 30
staticprivate

Motor 2 front right.

Definition at line 252 of file consoleGui.h.

const unsigned char ConsoleGui::MOTOR3BW = 17
staticprivate

for the test widget

Definition at line 241 of file consoleGui.h.

const unsigned char ConsoleGui::MOTOR3FW = 16
staticprivate

for the test widget

Definition at line 240 of file consoleGui.h.

const unsigned char ConsoleGui::MOTOR3OFF = 18
staticprivate

for the test widget

Definition at line 242 of file consoleGui.h.

const unsigned char ConsoleGui::MOTOR4 = 40
staticprivate

Motor 3 back left.

Definition at line 253 of file consoleGui.h.

const unsigned char ConsoleGui::MOTOR4BW = 20
staticprivate

for the test widget

Definition at line 244 of file consoleGui.h.

const unsigned char ConsoleGui::MOTOR4FW = 19
staticprivate

for the test widget

Definition at line 243 of file consoleGui.h.

const unsigned char ConsoleGui::MOTOR4OFF = 21
staticprivate

for the test widget

Definition at line 245 of file consoleGui.h.

const short int ConsoleGui::MOTORSENSOR1 = 0
staticprivate

Definition at line 275 of file consoleGui.h.

const short int ConsoleGui::MOTORSENSOR2 = 1
staticprivate

Definition at line 276 of file consoleGui.h.

const short int ConsoleGui::NONE = 0
staticprivate

Value if no sensor has a value to react

Definition at line 273 of file consoleGui.h.

const int ConsoleGui::OBSTACLE = 1
staticprivate

Definition at line 304 of file consoleGui.h.

const bool ConsoleGui::OFF = false
staticprivate

For motor "ON"

Definition at line 229 of file consoleGui.h.

const bool ConsoleGui::ON = true
staticprivate

The step value for the y axis for plot curve number 1.

Definition at line 228 of file consoleGui.h.

bool ConsoleGui::robotIsOn
private

Definition at line 218 of file consoleGui.h.

const unsigned char ConsoleGui::SAME = 3
staticprivate

Motor direction "COUNTERCLOCKWISE.

Definition at line 249 of file consoleGui.h.

const short int ConsoleGui::SENSOR1 = 1
staticprivate

Motor 4 back right.

Give the sensors some names

DONT CHANGE THIS NUMBERS! THEY ARE ALSO USED TO ADRESS THE ARRAY "iRSensorValue[]" !!

Definition at line 261 of file consoleGui.h.

const short int ConsoleGui::SENSOR16 = 256
staticprivate

ultrasonic sensor

Definition at line 271 of file consoleGui.h.

const short int ConsoleGui::SENSOR2 = 2
staticprivate

Definition at line 262 of file consoleGui.h.

const short int ConsoleGui::SENSOR3 = 4
staticprivate

Definition at line 263 of file consoleGui.h.

const short int ConsoleGui::SENSOR4 = 8
staticprivate

Definition at line 264 of file consoleGui.h.

const short int ConsoleGui::SENSOR5 = 16
staticprivate

Definition at line 265 of file consoleGui.h.

const short int ConsoleGui::SENSOR6 = 32
staticprivate

Definition at line 266 of file consoleGui.h.

const short int ConsoleGui::SENSOR7 = 64
staticprivate

Definition at line 267 of file consoleGui.h.

const short int ConsoleGui::SENSOR8 = 128
staticprivate

Definition at line 268 of file consoleGui.h.

const int ConsoleGui::SENSORPROGRESSBARMAXIR = 50
staticprivate

Stores the robots (circuits) state.ON or OFF.

Definition at line 220 of file consoleGui.h.

const int ConsoleGui::SENSORPROGRESSBARMAXUS = 400
staticprivate

max value in cm for ir sensor

Definition at line 221 of file consoleGui.h.

const unsigned char ConsoleGui::START = 7
staticprivate

For motor "OFF"

See also:
Direcs::drive() [Slot]

Definition at line 232 of file consoleGui.h.

const int ConsoleGui::STARTZOOMLEVEL = 3
staticprivate

Definition at line 289 of file consoleGui.h.

const unsigned char ConsoleGui::STOP = 8
staticprivate

For button signal "start driving".

Definition at line 233 of file consoleGui.h.


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