direcs
2012-09-30
|
The 'gui' class in the console mode. More...
#include <consoleGui.h>
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". |
The 'gui' class in the console mode.
Definition at line 32 of file consoleGui.h.
ConsoleGui::ConsoleGui | ( | ) |
Definition at line 24 of file consoleGui.cpp.
ConsoleGui::~ConsoleGui | ( | ) |
Definition at line 29 of file consoleGui.cpp.
|
slot |
Appends text to the main log in the main window.
text | is the text to be displayed. |
CR | adds a carriage return (CR) to the text, if true (default). This parameter is optional! |
sayIt | If true, the text is also spoken (default=false). This parameter is optional! |
Definition at line 49 of file consoleGui.cpp.
|
slot |
Append text to the network log in the main window
text | is the text to be displayed. |
CR | adds a carriage return (CR) to the text, if true (default). This parameter is optional! |
sayIt | If true, the text is also spoken (default=false). This parameter is optional! |
Definition at line 78 of file consoleGui.cpp.
|
slot |
Append text to the serial log in the main window
text | is the text to be displayed. |
CR | adds a carriage return (CR) to the text, if true (default). This parameter is optional! |
Definition at line 91 of file consoleGui.cpp.
|
private |
|
private |
Creates all objects, lines, scene, view etc.
|
signal |
Instructs the robot to drive FORWARD, BACKWARD, LEFT and RIGHT. The commands START, STOP or WAIT are also possible.
command |
|
signal |
Enables or disables the listening for the robot remote control. This signal is sent from the remote control button.
state | can be true or false. |
|
signal |
Initializes the robots basic circuit.
|
signal |
Initializes the servos.
|
slot |
Refreshes the view of the lines from the front laser scanner.
Definition at line 562 of file consoleGui.cpp.
|
slot |
Refreshes the view of the lines from the rear laser scanner.
Definition at line 570 of file consoleGui.cpp.
|
signal |
Resets the driven distance to 0.
sensor | is the sensor number. |
|
slot |
Gets the angle of a laser from the
laserScanner | can be LASER1 or LASER2 |
angle | in degrees |
Definition at line 578 of file consoleGui.cpp.
|
slot |
Gets the resolution of a laser from the
laserScanner | can be LASER1 or LASER2 |
angle | in degrees |
Definition at line 585 of file consoleGui.cpp.
|
slot |
Only store the robots state locally.
state | can 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.)
sensor | is the sensor number. |
state | can 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.
sensor | is the sensor number. |
distance | is the distance in cm. |
Definition at line 121 of file consoleGui.cpp.
void ConsoleGui::showDrivenDistance | ( | int | sensor, |
int | distance | ||
) |
Shows the driven distance in a text label.
sensor | is the sensor number. |
distance | is the distance in cm. |
Definition at line 175 of file consoleGui.cpp.
|
slot |
Shows the angles of the free area where to drive in lables.
largestFreeAreaStart | |
largestFreeAreaEnd | |
centerOfFreeWay | |
width | of 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)
motor | is the motor number. |
power | can be ON or OFF. |
direction | can be FORWARD or BACKWARD. |
Definition at line 407 of file consoleGui.cpp.
|
slot |
Shows the preferred driving direction in a lable.
direction | can be FORWARD, BACKWARD, LEFT or RIGHT |
Definition at line 541 of file consoleGui.cpp.
|
signal |
Exits the whole programm.
|
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.
state | can be true or false. |
|
signal |
Emits a speak signal. This signal is sent to the speakThread.
|
signal |
Emits a signal to call the test method in the Direcs class..
|
staticprivate |
max value in cm for us sensor
Definition at line 223 of file consoleGui.h.
|
staticprivate |
The maximum axis Y value in Amperes (A) for plot curve number 1.
Definition at line 224 of file consoleGui.h.
|
staticprivate |
The maximum axis Y value in Amperes (A) for plot curve number 2.
Definition at line 225 of file consoleGui.h.
|
staticprivate |
The step value for the y axis for plot curve number 1.
Definition at line 226 of file consoleGui.h.
|
staticprivate |
Definition at line 306 of file consoleGui.h.
|
staticprivate |
for the test widget
Definition at line 247 of file consoleGui.h.
|
staticprivate |
Motor direction "CLOCKWISE".
Definition at line 248 of file consoleGui.h.
|
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.
|
staticprivate |
Definition at line 303 of file consoleGui.h.
|
staticprivate |
the initial Y position of the laser lines and the robot image in the GUI
Definition at line 292 of file consoleGui.h.
|
staticprivate |
Definition at line 293 of file consoleGui.h.
|
staticprivate |
Definition at line 305 of file consoleGui.h.
|
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.
|
staticprivate |
Definition at line 319 of file consoleGui.h.
|
staticprivate |
Definition at line 320 of file consoleGui.h.
|
staticprivate |
Definition at line 321 of file consoleGui.h.
|
staticprivate |
Definition at line 322 of file consoleGui.h.
|
staticprivate |
Number of distance semi circles.
Definition at line 296 of file consoleGui.h.
|
staticprivate |
Distances between the lines to show the laser distances in pixels.
Definition at line 300 of file consoleGui.h.
|
staticprivate |
the size (diameter) of the first (innerst) circle in pixels
Definition at line 298 of file consoleGui.h.
|
staticprivate |
Motor direction/power "same like before".
Definition at line 250 of file consoleGui.h.
|
staticprivate |
for the test widget
Definition at line 235 of file consoleGui.h.
|
staticprivate |
For button signal "stop driving".
Definition at line 234 of file consoleGui.h.
|
staticprivate |
for the test widget
Definition at line 236 of file consoleGui.h.
|
staticprivate |
Motor 1 front left.
Definition at line 251 of file consoleGui.h.
|
staticprivate |
for the test widget
Definition at line 238 of file consoleGui.h.
|
staticprivate |
for the test widget
Definition at line 237 of file consoleGui.h.
|
staticprivate |
for the test widget
Definition at line 239 of file consoleGui.h.
|
staticprivate |
Motor 2 front right.
Definition at line 252 of file consoleGui.h.
|
staticprivate |
for the test widget
Definition at line 241 of file consoleGui.h.
|
staticprivate |
for the test widget
Definition at line 240 of file consoleGui.h.
|
staticprivate |
for the test widget
Definition at line 242 of file consoleGui.h.
|
staticprivate |
Motor 3 back left.
Definition at line 253 of file consoleGui.h.
|
staticprivate |
for the test widget
Definition at line 244 of file consoleGui.h.
|
staticprivate |
for the test widget
Definition at line 243 of file consoleGui.h.
|
staticprivate |
for the test widget
Definition at line 245 of file consoleGui.h.
|
staticprivate |
Definition at line 275 of file consoleGui.h.
|
staticprivate |
Definition at line 276 of file consoleGui.h.
|
staticprivate |
Value if no sensor has a value to react
Definition at line 273 of file consoleGui.h.
|
staticprivate |
Definition at line 304 of file consoleGui.h.
|
staticprivate |
For motor "ON"
Definition at line 229 of file consoleGui.h.
|
staticprivate |
The step value for the y axis for plot curve number 1.
Definition at line 228 of file consoleGui.h.
|
private |
Definition at line 218 of file consoleGui.h.
|
staticprivate |
Motor direction "COUNTERCLOCKWISE.
Definition at line 249 of file consoleGui.h.
|
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.
|
staticprivate |
ultrasonic sensor
Definition at line 271 of file consoleGui.h.
|
staticprivate |
Definition at line 262 of file consoleGui.h.
|
staticprivate |
Definition at line 263 of file consoleGui.h.
|
staticprivate |
Definition at line 264 of file consoleGui.h.
|
staticprivate |
Definition at line 265 of file consoleGui.h.
|
staticprivate |
Definition at line 266 of file consoleGui.h.
|
staticprivate |
Definition at line 267 of file consoleGui.h.
|
staticprivate |
Definition at line 268 of file consoleGui.h.
|
staticprivate |
Stores the robots (circuits) state.ON or OFF.
Definition at line 220 of file consoleGui.h.
|
staticprivate |
max value in cm for ir sensor
Definition at line 221 of file consoleGui.h.
|
staticprivate |
|
staticprivate |
Definition at line 289 of file consoleGui.h.
|
staticprivate |
For button signal "start driving".
Definition at line 233 of file consoleGui.h.