#include <URG04LXmm.h>
Public Member Functions | |
URG04LXmm (int argc, const char *argv[]) | |
Default constructor. | |
URG04LXmm (int argc, const char *argv[], SenderUDP *sender) | |
IP communication constructor. | |
~URG04LXmm () | |
Destructor. | |
ResourcePlate | getPlate () const |
getPlate. | |
void | setWaitNextScanTimeusecs (int t) |
void | setSender (SenderUDP *sender) |
Set the _sender. | |
void | setWait () |
set _wait flag | |
void | setIsContinuos () |
set _isContinuos flag | |
void | setEchoMatch () |
set _echoMatch flag | |
void | setStatusMatch () |
set _statusMatch flag | |
void | setTStampAcq () |
set _tStampAcq flag | |
void | setScanComplete () |
set _scanComplete flag | |
void | setCheckLine () |
set _checkLine flag | |
void | setWorkDone () |
set _workDone flag | |
void | setVerboseOn () |
set _verboseOn flag | |
void | setLog () |
set _log flag | |
void | unsetWait () |
unset _wait flag | |
void | unsetIsContinuos () |
unset _isContinuos flag | |
void | unsetEchoMatch () |
unset _echoMatch flag | |
void | unsetStatusMatch () |
unset _statusMatch flag | |
void | unsetTStampAcq () |
unset _tStampAcq flag | |
void | unsetScanComplete () |
unset _scanComplete flag | |
void | unsetCheckLine () |
unset _checkLine flag | |
void | unsetWorkDone () |
unset _workDone flag | |
void | unsetVerboseOn () |
unset _verboseOn flag | |
void | unsetLog () |
unset _log flag | |
int | totRays () |
return _totRays | |
int | totScans () |
return _totScans | |
bool | wait () |
return _wait flag | |
bool | isContinuos () |
return _isContinuos flag | |
bool | echoMatch () |
return _echoMatch flag | |
bool | statusMatch () |
return _statusMatch flag | |
bool | tStampAcq () |
return _tStampAcq flag | |
bool | scanComplete () |
return _scanComplete flag | |
bool | checkLine () |
return _checkLine flag | |
bool | workDone () |
return _workDone flag | |
bool | verboseOn () |
return _verboseOn flag | |
bool | log () |
return _log flag | |
bool | updatedScan (Scan &s) |
get a new scan | |
Scan | _singleScan () |
get last stored scan | |
void | mySingleScan () |
get a scan without return | |
void | _startScan (unsigned int num) |
start the continuous scanning | |
void | _stopScan () |
stop the continuous scanning | |
void | defFSM () |
perform a FSM for scanning operations | |
Public Attributes | |
Timer | _FSMtimer |
scanWorkState | SWstate |
FSMSstates | _state |
Instance of FSMSstatesmm enum. | |
Scan | _myScan |
bool | _canDraw |
URG04LXmmPar * | _URGpar |
Instance of URG04LXmmPar object. | |
URG04LXmmConst | _URGConst |
Instance of URGConst object. | |
URG04LXmmInfo * | _URGinfo |
Instance of URG04LXmmInfo object. | |
URG04LXmmCommand * | _cmd |
Instance of URG04LXmmCommand object. | |
Protected Member Functions | |
void | parse2bytes (ExtString _currentLine) |
parse data 2-bytes-encoded | |
void | parse3bytes (ExtString &_currentLine) |
Parse data 3-bytes-encoded. | |
void | updateInfo () |
Update info by quering sensor. | |
bool | buildMultiScan (ExtString &command) |
Build appropriate multi-scan command. | |
bool | buildSingleScan (ExtString &command) |
Build appropriate single-scan command. | |
int | readData (ExtString command, ExtString &rbuf, int how) |
Reading data function. | |
int | readData (ExtString command, int how) |
Reading data function. | |
void | changeMotor (int value) |
Set sensor's motor speed at value specified by. | |
void | changeBuad (int value) |
Set sensor's baud rate (RS232) at value specified by. | |
Protected Attributes | |
ExtString | _strCmd |
ExtString containig scan command*/. | |
ExtString | _answer |
ExtString containig sensor's answer as received from sensor*/. | |
char * | _answerBuf |
ExtString containig sensor's answer as received from sensor*/. | |
char * | _answerBufptr |
ExtString containig sensor's answer as received from sensor*/. | |
int | _answerBufSize |
bool | _badScan |
ExtString | _temporary |
ExtString containig sensor's answer and that will be processed*/. | |
Thread | _scanThread |
thread that manage the continuous scanning */ | |
unsigned int | _expectedLines |
expected complete data lines*/ | |
unsigned int | _expectedChars |
expected chars not belonging to a complete data line*/ | |
unsigned int | _expectedBytes |
expected bytes in data response*/ | |
unsigned int | _alreadyRead |
bytes in a readData call*/ | |
unsigned int | _expectedRays |
expected rays of scan*/ | |
unsigned int | _parsedLines |
number of parsed lines*/ | |
ExtString | _parsingBits |
bytes not parsed by parse3bytes*/ | |
ExtString | _prevTStamp |
ExtString containing previous scan time stamp*/. | |
Raymms | _tempRays |
temporary rays container*/ | |
Time | _tStamp |
time stamp container*/ | |
unsigned int | _totRays |
total rays created*/ | |
unsigned int | _totScans |
total performed scans*/ | |
unsigned int | _lfcount |
number of line feed found consecutively in response*/ | |
unsigned int | _readAttempts |
number of reading attempts without response*/ | |
unsigned int | _remainingScans |
number scan still to perform*/ | |
bool | _wait |
flag set if next state is a waiting state*/ | |
bool | _isContinuos |
flag set if was sent a MS-MD command*/ | |
bool | _echoMatch |
flag set if echo matching was performed*/ | |
bool | _statusMatch |
flag set if status matching was performed*/ | |
bool | _tStampAcq |
flag set if time stamp acquisition matching was performed*/ | |
bool | _checkLine |
flag set if received data format is correct*/ | |
bool | _scanComplete |
flag set if a scan has been completed*/ | |
bool | _workDone |
bool | _verboseOn |
flag set for verbose mode on*/ | |
bool | _log |
flag set for log mode on*/ | |
Time | _readDataTime |
deadline for data reading*/ | |
Time | _waitNextScan |
deadline for next scan acquisition (depends on data encoding)*/ | |
Time | _FSMperiod |
deadline for scan FSM*/ | |
Time | _waitEchoMatch |
deadline for correct response after a multiple scan request*/ | |
Timer | _waitedScan |
waited time for next scan acquisition*/ | |
Timer | _waitedEcho |
waited time for correct response*/ | |
int | _waitNextScanTimeusecs |
ofstream | _logFile |
stream for log mode*/ | |
SenderUDP * | _sender |
bool | _sendScan |
char | _sendingBuffer [10000] |
int | _printedBuffer |
Main class of the file, it is the implementation of a URG04LX Range Sensor. It is composed by the above classes and several other attributes usuful for scan operations that are implemented here. Scan is performed by calling one (or more) of the mandatory methods but it is actually realized by scanFSM. The communication operations are rather different related to URG04LXmmCommand ones (see functions buildMultiScan, buildSingleScan, readData in URG04LX.cpp for more details). There are also some get and set functions for private attributes.
MipResources::URG04LXmm::URG04LXmm | ( | int | argc, | |
const char * | argv[] | |||
) |
Default constructor.
<sets the object that wil be passed to scanWork and scanClean
<sets the routine that must be called after startScan() is called
<sets the routine that must be called after stopScan() is called
<sets the slepping time of the continous scanning thread
MipResources::URG04LXmm::URG04LXmm | ( | int | argc, | |
const char * | argv[], | |||
SenderUDP * | sender | |||
) |
IP communication constructor.
<sets the object that will be passed to scanWork and scanClean
<sets the routine that must be called after startScan() is called
<sets the routine that must be called after stopScan() is called
<sets the slepping time of the continous scanning thread
MipResources::URG04LXmm::~URG04LXmm | ( | ) |
Destructor.
void MipResources::URG04LXmm::parse2bytes | ( | ExtString | _currentLine | ) | [protected] |
parse data 2-bytes-encoded
_currentLine | parsing is performed by lines |
void MipResources::URG04LXmm::parse3bytes | ( | ExtString & | _currentLine | ) | [protected] |
Parse data 3-bytes-encoded.
_currentLine | Parsing is performed by lines. |
void MipResources::URG04LXmm::updateInfo | ( | ) | [protected] |
Update info by quering sensor.
bool MipResources::URG04LXmm::buildMultiScan | ( | ExtString & | command | ) | [protected] |
Build appropriate multi-scan command.
bool MipResources::URG04LXmm::buildSingleScan | ( | ExtString & | command | ) | [protected] |
Build appropriate single-scan command.
Reading data function.
int MipResources::URG04LXmm::readData | ( | ExtString | command, | |
int | how | |||
) | [protected] |
Reading data function.
void MipResources::URG04LXmm::changeMotor | ( | int | value | ) | [protected] |
Set sensor's motor speed at value specified by.
[in] | value | Setting speed. |
void MipResources::URG04LXmm::changeBuad | ( | int | value | ) | [protected] |
Set sensor's baud rate (RS232) at value specified by.
[in] | value | Setting baud rate. |
ResourcePlate MipResources::URG04LXmm::getPlate | ( | ) | const [inline, virtual] |
void MipResources::URG04LXmm::setWaitNextScanTimeusecs | ( | int | t | ) | [inline] |
void MipResources::URG04LXmm::setSender | ( | SenderUDP * | sender | ) | [inline] |
Set the _sender.
void MipResources::URG04LXmm::setWait | ( | ) | [inline] |
set _wait flag
void MipResources::URG04LXmm::setIsContinuos | ( | ) | [inline] |
set _isContinuos flag
void MipResources::URG04LXmm::setEchoMatch | ( | ) | [inline] |
set _echoMatch flag
void MipResources::URG04LXmm::setStatusMatch | ( | ) | [inline] |
set _statusMatch flag
void MipResources::URG04LXmm::setTStampAcq | ( | ) | [inline] |
set _tStampAcq flag
void MipResources::URG04LXmm::setScanComplete | ( | ) | [inline] |
set _scanComplete flag
void MipResources::URG04LXmm::setCheckLine | ( | ) | [inline] |
set _checkLine flag
void MipResources::URG04LXmm::setWorkDone | ( | ) | [inline] |
set _workDone flag
void MipResources::URG04LXmm::setVerboseOn | ( | ) | [inline] |
set _verboseOn flag
void MipResources::URG04LXmm::setLog | ( | ) | [inline] |
set _log flag
void MipResources::URG04LXmm::unsetWait | ( | ) | [inline] |
unset _wait flag
void MipResources::URG04LXmm::unsetIsContinuos | ( | ) | [inline] |
unset _isContinuos flag
void MipResources::URG04LXmm::unsetEchoMatch | ( | ) | [inline] |
unset _echoMatch flag
void MipResources::URG04LXmm::unsetStatusMatch | ( | ) | [inline] |
unset _statusMatch flag
void MipResources::URG04LXmm::unsetTStampAcq | ( | ) | [inline] |
unset _tStampAcq flag
void MipResources::URG04LXmm::unsetScanComplete | ( | ) | [inline] |
unset _scanComplete flag
void MipResources::URG04LXmm::unsetCheckLine | ( | ) | [inline] |
unset _checkLine flag
void MipResources::URG04LXmm::unsetWorkDone | ( | ) | [inline] |
unset _workDone flag
void MipResources::URG04LXmm::unsetVerboseOn | ( | ) | [inline] |
unset _verboseOn flag
void MipResources::URG04LXmm::unsetLog | ( | ) | [inline] |
unset _log flag
int MipResources::URG04LXmm::totRays | ( | ) | [inline] |
return _totRays
int MipResources::URG04LXmm::totScans | ( | ) | [inline] |
return _totScans
bool MipResources::URG04LXmm::wait | ( | ) | [inline] |
return _wait flag
bool MipResources::URG04LXmm::isContinuos | ( | ) | [inline] |
return _isContinuos flag
bool MipResources::URG04LXmm::echoMatch | ( | ) | [inline] |
return _echoMatch flag
bool MipResources::URG04LXmm::statusMatch | ( | ) | [inline] |
return _statusMatch flag
bool MipResources::URG04LXmm::tStampAcq | ( | ) | [inline] |
return _tStampAcq flag
bool MipResources::URG04LXmm::scanComplete | ( | ) | [inline] |
return _scanComplete flag
bool MipResources::URG04LXmm::checkLine | ( | ) | [inline] |
return _checkLine flag
bool MipResources::URG04LXmm::workDone | ( | ) | [inline] |
return _workDone flag
bool MipResources::URG04LXmm::verboseOn | ( | ) | [inline] |
return _verboseOn flag
bool MipResources::URG04LXmm::log | ( | ) | [inline] |
return _log flag
bool MipResources::URG04LXmm::updatedScan | ( | Scan & | s | ) |
Scan MipResources::URG04LXmm::_singleScan | ( | ) | [virtual] |
void MipResources::URG04LXmm::mySingleScan | ( | ) | [inline] |
get a scan without return
void MipResources::URG04LXmm::_startScan | ( | unsigned int | num | ) | [virtual] |
start the continuous scanning
num | number of scan to perform, (0 means unbounded) |
Implements MipResources::RangeSens.
void MipResources::URG04LXmm::_stopScan | ( | ) | [virtual] |
void MipResources::URG04LXmm::defFSM | ( | ) |
perform a FSM for scanning operations
ExtString MipResources::URG04LXmm::_strCmd [protected] |
ExtString containig scan command*/.
ExtString MipResources::URG04LXmm::_answer [protected] |
ExtString containig sensor's answer as received from sensor*/.
char* MipResources::URG04LXmm::_answerBuf [protected] |
ExtString containig sensor's answer as received from sensor*/.
char* MipResources::URG04LXmm::_answerBufptr [protected] |
ExtString containig sensor's answer as received from sensor*/.
int MipResources::URG04LXmm::_answerBufSize [protected] |
bool MipResources::URG04LXmm::_badScan [protected] |
ExtString MipResources::URG04LXmm::_temporary [protected] |
ExtString containig sensor's answer and that will be processed*/.
Thread MipResources::URG04LXmm::_scanThread [protected] |
thread that manage the continuous scanning */
unsigned int MipResources::URG04LXmm::_expectedLines [protected] |
expected complete data lines*/
unsigned int MipResources::URG04LXmm::_expectedChars [protected] |
expected chars not belonging to a complete data line*/
unsigned int MipResources::URG04LXmm::_expectedBytes [protected] |
expected bytes in data response*/
unsigned int MipResources::URG04LXmm::_alreadyRead [protected] |
bytes in a readData call*/
unsigned int MipResources::URG04LXmm::_expectedRays [protected] |
expected rays of scan*/
unsigned int MipResources::URG04LXmm::_parsedLines [protected] |
number of parsed lines*/
ExtString MipResources::URG04LXmm::_parsingBits [protected] |
bytes not parsed by parse3bytes*/
ExtString MipResources::URG04LXmm::_prevTStamp [protected] |
ExtString containing previous scan time stamp*/.
Raymms MipResources::URG04LXmm::_tempRays [protected] |
temporary rays container*/
Time MipResources::URG04LXmm::_tStamp [protected] |
time stamp container*/
unsigned int MipResources::URG04LXmm::_totRays [protected] |
total rays created*/
unsigned int MipResources::URG04LXmm::_totScans [protected] |
total performed scans*/
unsigned int MipResources::URG04LXmm::_lfcount [protected] |
number of line feed found consecutively in response*/
unsigned int MipResources::URG04LXmm::_readAttempts [protected] |
number of reading attempts without response*/
unsigned int MipResources::URG04LXmm::_remainingScans [protected] |
number scan still to perform*/
bool MipResources::URG04LXmm::_wait [protected] |
flag set if next state is a waiting state*/
bool MipResources::URG04LXmm::_isContinuos [protected] |
flag set if was sent a MS-MD command*/
bool MipResources::URG04LXmm::_echoMatch [protected] |
flag set if echo matching was performed*/
bool MipResources::URG04LXmm::_statusMatch [protected] |
flag set if status matching was performed*/
bool MipResources::URG04LXmm::_tStampAcq [protected] |
flag set if time stamp acquisition matching was performed*/
bool MipResources::URG04LXmm::_checkLine [protected] |
flag set if received data format is correct*/
bool MipResources::URG04LXmm::_scanComplete [protected] |
flag set if a scan has been completed*/
bool MipResources::URG04LXmm::_workDone [protected] |
bool MipResources::URG04LXmm::_verboseOn [protected] |
flag set for verbose mode on*/
bool MipResources::URG04LXmm::_log [protected] |
flag set for log mode on*/
Time MipResources::URG04LXmm::_readDataTime [protected] |
deadline for data reading*/
Time MipResources::URG04LXmm::_waitNextScan [protected] |
deadline for next scan acquisition (depends on data encoding)*/
Time MipResources::URG04LXmm::_FSMperiod [protected] |
deadline for scan FSM*/
Time MipResources::URG04LXmm::_waitEchoMatch [protected] |
deadline for correct response after a multiple scan request*/
Timer MipResources::URG04LXmm::_waitedScan [protected] |
waited time for next scan acquisition*/
Timer MipResources::URG04LXmm::_waitedEcho [protected] |
waited time for correct response*/
int MipResources::URG04LXmm::_waitNextScanTimeusecs [protected] |
ofstream MipResources::URG04LXmm::_logFile [protected] |
stream for log mode*/
SenderUDP* MipResources::URG04LXmm::_sender [protected] |
bool MipResources::URG04LXmm::_sendScan [protected] |
char MipResources::URG04LXmm::_sendingBuffer[10000] [protected] |
int MipResources::URG04LXmm::_printedBuffer [protected] |
Instance of FSMSstatesmm enum.
Instance of URG04LXmmPar object.
Instance of URGConst object.
Instance of URG04LXmmInfo object.
Instance of URG04LXmmCommand object.