Handles all Laser scanners.
More...
#include <laserThread.h>
List of all members.
Static Private Attributes |
static const int | FREEWAY = 0 |
static const unsigned char | HOKUYO_URG = 2 |
static const short int | LASER1 = 1 |
| The simulated distances for the rear laser scanner.
|
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 unsigned char | LMS = 0 |
static const short int | MAXERRORS = 2 |
static const unsigned char | NONE = 255 |
static const int | OBSTACLE = 1 |
static const unsigned char | PLS = 1 |
static const unsigned char | S300 = 4 |
static const unsigned char | SIMULATED_LASER = 3 |
static const unsigned long | THREADSLEEPTIME = 50 |
Detailed Description
Handles all Laser scanners.
- Author:
- Markus Knapp It checks, if they are connected, accesses them and emits all read data via Signal. It also provides a simulation mode.
Definition at line 35 of file laserThread.h.
Constructor & Destructor Documentation
LaserThread::LaserThread |
( |
| ) |
|
LaserThread::~LaserThread |
( |
| ) |
|
Member Function Documentation
void LaserThread::getAndStoreLaserValuesFront |
( |
| ) |
|
|
private |
void LaserThread::getAndStoreLaserValuesRear |
( |
| ) |
|
|
private |
int LaserThread::getAngle |
( |
short int |
laserScanner | ) |
|
Returns the physical angle of the laserscanner in degrees, e.g. 180 or 270.
- Parameters:
-
laserScanner | can be LASER1 or LASER2 |
- Returns:
- the angle in degrees
Definition at line 574 of file laserThread.cpp.
int LaserThread::getFlag |
( |
short int |
laserScanner, |
|
|
int |
angle |
|
) |
| |
- Parameters:
-
laserScanner | can be LASER1 or LASER2 |
angle | is the wanted angle in degrees |
- Returns:
- the laser scanner line flag (the flag shows if there is an obstacle at this line or not)
Definition at line 263 of file laserThread.cpp.
float LaserThread::getResolution |
( |
short int |
laserScanner | ) |
|
Returns the physical resolution of the laserscanner in degrees, e.g. 1.0 or 0.5.
- Parameters:
-
laserScanner | can be LASER1 or LASER2 |
- Returns:
- the resolution in degrees
Definition at line 591 of file laserThread.cpp.
float LaserThread::getValue |
( |
short int |
laserScanner, |
|
|
int |
angle |
|
) |
| |
- Returns:
- the (last) measuread value (distance) in meters(!)
Definition at line 237 of file laserThread.cpp.
bool LaserThread::isConnected |
( |
short int |
laserScanner | ) |
|
Returns the state of a connected laser scanner. This method also does some init stuff for all the important mebers like the QList (laser values etc.).
- Parameters:
-
laserScanner | can be LASER1 or LASER2 |
- Returns:
- true, if connected
- Todo:
- Support two S300 scanners
- Todo:
- S300 stuff
Definition at line 608 of file laserThread.cpp.
void LaserThread::laserDataCompleteFront |
( |
QList< float > |
laserScannerValuesFront, |
|
|
QList< int > |
laserScannerFlagsFront |
|
) |
| |
|
signal |
Emits a list containing all front laser values (distances) and their flags.
void LaserThread::laserDataCompleteRear |
( |
QList< float > |
laserScannerValuesRear, |
|
|
QList< int > |
laserScannerFlagsRear |
|
) |
| |
|
signal |
Emits a list containing all rear laser values (distances) and their flags.
void LaserThread::message |
( |
QString |
text | ) |
|
|
signal |
Emits a info or error message to a slot. This slot can be used to display a text on a splash screen, log file, to print it to a console...
- Parameters:
-
text | is the message to be emitted |
bool LaserThread::readSimulationValues |
( |
| ) |
|
|
private |
void LaserThread::run |
( |
| ) |
|
|
virtual |
void LaserThread::saveLaserData |
( |
| ) |
|
|
slot |
Saves the current laser line simulation values to disk (.sim file). Resulting filename will look like direcs-YYYY_MM_DD__HH_MM_SS.sim
- Todo:
- Stop laser thread here for saving the values or is a mutex lock for the QList okay or are QLists able to handle this?
Definition at line 776 of file laserThread.cpp.
void LaserThread::sendNetworkString |
( |
QString |
text | ) |
|
|
signal |
Sends a string over the network.
void LaserThread::setAngle |
( |
short int |
laserScanner, |
|
|
int |
angle |
|
) |
| |
Defines the angle of the laserscanner e.g. 180 or 270 degrees.
- Parameters:
-
laserScanner | can be LASER1 or LASER2 |
angle | is the angle |
Definition at line 536 of file laserThread.cpp.
void LaserThread::setFlag |
( |
short int |
laserScanner, |
|
|
int |
angle, |
|
|
int |
flag |
|
) |
| |
This method sets the a flag for each laser line (angle) which represents a free way, an obstackle etc.
- Parameters:
-
laserScanner | can be LASER1 or LASER2 |
angle | is the angle in degrees |
flag | can be FREEWAY, OBSTACLE, LARGESTFREEWAY or CENTEROFLARGESTFREEWAY. |
- See also:
- ObstacleCheckThread
Definition at line 289 of file laserThread.cpp.
void LaserThread::setMeasureMode |
( |
bool |
state | ) |
|
|
slot |
This slot sets the measure mode. If activated one can walk around the laser, and the lessest value will only be stored. With this one can set a new alarm distance by walking around the robot.
Definition at line 411 of file laserThread.cpp.
void LaserThread::setMounting |
( |
short int |
laserScanner, |
|
|
QString |
mounting |
|
) |
| |
Sets the mounting for a laser scanner to flip the data for example from 0-179 to 179-0, when the laser scanner is mounted flipped.
- Parameters:
-
laserScanner | can be LASER1 or LASER2 |
mounting | can be "normal" or "flipped" |
- See also:
- setDevicePort, read_parameters, laser.h
Definition at line 460 of file laserThread.cpp.
void LaserThread::setResolution |
( |
short int |
laserScanner, |
|
|
float |
resolution |
|
) |
| |
Defines the resolution of the laserscanner e.g. 0.5 or 1.0 degrees.
- Parameters:
-
laserScanner | can be LASER1 or LASER2 |
resolution | can be 0.5 or 1.00 degree |
Definition at line 555 of file laserThread.cpp.
void LaserThread::setSerialPort |
( |
short int |
laserScanner, |
|
|
QString |
serialPort |
|
) |
| |
Sets the serial port for a laser scanner.
- Parameters:
-
laserScanner | can be LASER1 or LASER2 |
serialPort | is the port of the laser scanner |
- See also:
- setDevicePort, read_parameters, laser.h
- Todo:
- support two S300 lasers
Definition at line 418 of file laserThread.cpp.
void LaserThread::setSimulationMode |
( |
bool |
state | ) |
|
|
slot |
This slot enables or disables the simulation mode.
Definition at line 315 of file laserThread.cpp.
void LaserThread::setType |
( |
short int |
laserScanner, |
|
|
QString |
laserType |
|
) |
| |
Sets the type of the laser
- Parameters:
-
laserScanner | can be LASER1 or LASER2 |
laserType | can be S300 |
Definition at line 477 of file laserThread.cpp.
void LaserThread::stop |
( |
| ) |
|
void LaserThread::systemerror |
( |
int |
errorlevel | ) |
|
|
signal |
Emits a emergency signal for letting other modules know that we have a massive sensor error. So in that case an emergency stop or so could be initiated.
- Parameters:
-
errorlevel | needs to be defined. Temporariliy we use -1 in case of error. |
Member Data Documentation
const int LaserThread::FREEWAY = 0 |
|
staticprivate |
const unsigned char LaserThread::HOKUYO_URG = 2 |
|
staticprivate |
Inifile* LaserThread::inifileLaserdata |
|
private |
const short int LaserThread::LASER1 = 1 |
|
staticprivate |
The simulated distances for the rear laser scanner.
The names for addressing the laser scanner array For the integrated DIRECS laser module
Definition at line 229 of file laserThread.h.
const short int LaserThread::LASER2 = 2 |
|
staticprivate |
const short int LaserThread::LASER3 = 4 |
|
staticprivate |
const short int LaserThread::LASER4 = 8 |
|
staticprivate |
const short int LaserThread::LASER5 = 16 |
|
staticprivate |
this values holds the resolution of the laserscanner. e.g. 0.5 degrees
Definition at line 195 of file laserThread.h.
int LaserThread::laserscannerAngleFront |
|
private |
int LaserThread::laserscannerAngleRear |
|
private |
this values holds the range of the laserscanner viewing angle. e.g. 180 or 270 degrees
Definition at line 191 of file laserThread.h.
QList<int> LaserThread::laserScannerFlagsFront |
|
private |
The measured distances from the rear laser scanner. This method also flippes the values when the laser is mounted flipped!
Definition at line 214 of file laserThread.h.
QList<int> LaserThread::laserScannerFlagsRear |
|
private |
Some flags for each front laser line (like "free way", "obstacle" etc.)
Definition at line 215 of file laserThread.h.
bool LaserThread::laserScannerFrontIsConnected |
|
private |
bool LaserThread::laserScannerRearIsConnected |
|
private |
float LaserThread::laserscannerResolutionFront |
|
private |
this values holds the range of the laserscanner viewing angle. e.g. 180 or 270 degrees
Definition at line 192 of file laserThread.h.
float LaserThread::laserscannerResolutionRear |
|
private |
this values holds the resolution of the laserscanner. e.g. 0.5 degrees
Definition at line 193 of file laserThread.h.
unsigned char LaserThread::laserscannerTypeFront |
|
private |
unsigned char LaserThread::laserscannerTypeRear |
|
private |
QList<float> LaserThread::laserScannerValuesFront |
|
private |
QList<float> LaserThread::laserScannerValuesRear |
|
private |
The measured distances from the front laser scanner. This method also flippes the values when the laser is mounted flipped!
Definition at line 212 of file laserThread.h.
const unsigned char LaserThread::LMS = 0 |
|
staticprivate |
const short int LaserThread::MAXERRORS = 2 |
|
staticprivate |
Nuber of tries reading from laser scanner. In case of error, we send the Signal systemerror, which lets the robot stop. In case of good reading, we decrease the errorcounter by one to zero.
Definition at line 243 of file laserThread.h.
bool LaserThread::measureMode |
|
private |
QString LaserThread::mountingLaserscannerFront |
|
private |
QString LaserThread::mountingLaserscannerRear |
|
private |
const unsigned char LaserThread::NONE = 255 |
|
staticprivate |
int LaserThread::numReadingsFront |
|
private |
int LaserThread::numReadingsRear |
|
private |
const int LaserThread::OBSTACLE = 1 |
|
staticprivate |
const unsigned char LaserThread::PLS = 1 |
|
staticprivate |
const unsigned char LaserThread::S300 = 4 |
|
staticprivate |
const unsigned char LaserThread::SIMULATED_LASER = 3 |
|
staticprivate |
bool LaserThread::simulationMode |
|
private |
QList<float> LaserThread::simulationValuesFront |
|
private |
Some flags for each rear laser line (like "free way", "obstacle" etc.)
Definition at line 217 of file laserThread.h.
QList<float> LaserThread::simulationValuesRear |
|
private |
The simulated distances for the front laser scanner.
Definition at line 218 of file laserThread.h.
volatile bool LaserThread::stopped |
|
private |
Reads the laser line simulation values and sets these as currrent 'real' laser values.
Definition at line 179 of file laserThread.h.
const unsigned long LaserThread::THREADSLEEPTIME = 50 |
|
staticprivate |
The documentation for this class was generated from the following files: