#include <URG04LX.h>
Public Member Functions | |
URG04LX (int argc, const char *argv[]) | |
defalut constructor | |
~URG04LX () | |
destructor | |
ResourcePlate | getPlate () const |
getPlate | |
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 | |
bool | storedScan (Scan &s, Time timeout) |
get last stored scan | |
Scan | _singleScan () |
get a 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 |
Scan | _myScan |
bool | _canDraw |
URG04LXPar * | _URGpar |
URG04LXConst | _URGConst |
URG04LXInfo * | _URGinfo |
URG04LXCommand * | _cmd |
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 apprpriate multi-scan command | |
bool | buildSingleScan (ExtString &command) |
build apprpriate single-scan command | |
int | readData (ExtString command, ExtString &rbuf, 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 | _answer |
ExtString | _temporary |
Thread | _scanThread |
unsigned int | _expectedLines |
unsigned int | _expectedChars |
unsigned int | _expectedBytes |
unsigned int | _alreadyRead |
unsigned int | _expectedRays |
unsigned int | _parsedLines |
ExtString | _parsingBits |
ExtString | _prevTStamp |
Rays | _tempRays |
Time | _tStamp |
unsigned int | _totRays |
unsigned int | _totScans |
unsigned int | _lfcount |
unsigned int | _readAttempts |
unsigned int | _remainingScans |
bool | _wait |
bool | _isContinuos |
bool | _echoMatch |
bool | _statusMatch |
bool | _tStampAcq |
bool | _checkLine |
bool | _scanComplete |
bool | _workDone |
bool | _verboseOn |
bool | _log |
Time | _readDataTime |
Time | _waitNextScan |
Time | _FSMperiod |
Time | _waitEchoMatch |
Timer | _waitedScan |
Timer | _waitedEcho |
ofstream | _logFile |
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 URG04LXCommand ones (see functions buildMultiScan, buildSingleScan, readData in URG04LX.cpp for more details). There are also some get and set functions for private attributes.
MipResources::URG04LX::URG04LX | ( | int | argc, | |
const char * | argv[] | |||
) |
defalut 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::URG04LX::~URG04LX | ( | ) |
destructor
void MipResources::URG04LX::parse2bytes | ( | ExtString | _currentLine | ) | [protected] |
parse data 2-bytes-encoded
_currentLine | parsing is performed by lines |
void MipResources::URG04LX::parse3bytes | ( | ExtString & | _currentLine | ) | [protected] |
parse data 3-bytes-encoded
_currentLine | parsing is performed by lines |
void MipResources::URG04LX::updateInfo | ( | ) | [protected] |
update info by quering sensor
bool MipResources::URG04LX::buildMultiScan | ( | ExtString & | command | ) | [protected] |
build apprpriate multi-scan command
bool MipResources::URG04LX::buildSingleScan | ( | ExtString & | command | ) | [protected] |
build apprpriate single-scan command
reading data function
void MipResources::URG04LX::changeMotor | ( | int | value | ) | [protected] |
set sensor's motor speed at value specified by
@param | value setting speed |
void MipResources::URG04LX::changeBuad | ( | int | value | ) | [protected] |
set sensor's baud rate (RS232) at value specified by
@param | value setting baud rate |
ResourcePlate MipResources::URG04LX::getPlate | ( | ) | const [inline, virtual] |
void MipResources::URG04LX::setWait | ( | ) | [inline] |
set _wait flag
void MipResources::URG04LX::setIsContinuos | ( | ) | [inline] |
set _isContinuos flag
void MipResources::URG04LX::setEchoMatch | ( | ) | [inline] |
set _echoMatch flag
void MipResources::URG04LX::setStatusMatch | ( | ) | [inline] |
set _statusMatch flag
void MipResources::URG04LX::setTStampAcq | ( | ) | [inline] |
set _tStampAcq flag
void MipResources::URG04LX::setScanComplete | ( | ) | [inline] |
set _scanComplete flag
void MipResources::URG04LX::setCheckLine | ( | ) | [inline] |
set _checkLine flag
void MipResources::URG04LX::setWorkDone | ( | ) | [inline] |
set _workDone flag
void MipResources::URG04LX::setVerboseOn | ( | ) | [inline] |
set _verboseOn flag
void MipResources::URG04LX::setLog | ( | ) | [inline] |
set _log flag
void MipResources::URG04LX::unsetWait | ( | ) | [inline] |
unset _wait flag
void MipResources::URG04LX::unsetIsContinuos | ( | ) | [inline] |
unset _isContinuos flag
void MipResources::URG04LX::unsetEchoMatch | ( | ) | [inline] |
unset _echoMatch flag
void MipResources::URG04LX::unsetStatusMatch | ( | ) | [inline] |
unset _statusMatch flag
void MipResources::URG04LX::unsetTStampAcq | ( | ) | [inline] |
unset _tStampAcq flag
void MipResources::URG04LX::unsetScanComplete | ( | ) | [inline] |
unset _scanComplete flag
void MipResources::URG04LX::unsetCheckLine | ( | ) | [inline] |
unset _checkLine flag
void MipResources::URG04LX::unsetWorkDone | ( | ) | [inline] |
unset _workDone flag
void MipResources::URG04LX::unsetVerboseOn | ( | ) | [inline] |
unset _verboseOn flag
void MipResources::URG04LX::unsetLog | ( | ) | [inline] |
unset _log flag
int MipResources::URG04LX::totRays | ( | ) | [inline] |
return _totRays
int MipResources::URG04LX::totScans | ( | ) | [inline] |
return _totScans
bool MipResources::URG04LX::wait | ( | ) | [inline] |
return _wait flag
bool MipResources::URG04LX::isContinuos | ( | ) | [inline] |
return _isContinuos flag
bool MipResources::URG04LX::echoMatch | ( | ) | [inline] |
return _echoMatch flag
bool MipResources::URG04LX::statusMatch | ( | ) | [inline] |
return _statusMatch flag
bool MipResources::URG04LX::tStampAcq | ( | ) | [inline] |
return _tStampAcq flag
bool MipResources::URG04LX::scanComplete | ( | ) | [inline] |
return _scanComplete flag
bool MipResources::URG04LX::checkLine | ( | ) | [inline] |
return _checkLine flag
bool MipResources::URG04LX::workDone | ( | ) | [inline] |
return _workDone flag
bool MipResources::URG04LX::verboseOn | ( | ) | [inline] |
return _verboseOn flag
bool MipResources::URG04LX::log | ( | ) | [inline] |
return _log flag
bool MipResources::URG04LX::updatedScan | ( | Scan & | s | ) |
Scan MipResources::URG04LX::_singleScan | ( | ) | [virtual] |
void MipResources::URG04LX::mySingleScan | ( | ) | [inline] |
get a scan without return
void MipResources::URG04LX::_startScan | ( | unsigned int | num | ) | [virtual] |
start the continuous scanning
num | number of scan to perform, (0 means unbounded) |
Implements MipResources::RangeSens.
void MipResources::URG04LX::_stopScan | ( | ) | [virtual] |
void MipResources::URG04LX::defFSM | ( | ) |
perform a FSM for scanning operations
ExtString MipResources::URG04LX::_strCmd [protected] |
ExtString containig scan command
ExtString MipResources::URG04LX::_answer [protected] |
ExtString containig sensor's answer as received from sensor
ExtString MipResources::URG04LX::_temporary [protected] |
ExtString containig sensor's answer and that will be processed
Thread MipResources::URG04LX::_scanThread [protected] |
thread that manage the continuous scanning
unsigned int MipResources::URG04LX::_expectedLines [protected] |
expected complete data lines
unsigned int MipResources::URG04LX::_expectedChars [protected] |
expected chars not belonging to a complete data line
unsigned int MipResources::URG04LX::_expectedBytes [protected] |
expected bytes in data response
unsigned int MipResources::URG04LX::_alreadyRead [protected] |
bytes in a readData call
unsigned int MipResources::URG04LX::_expectedRays [protected] |
expected rays of scan
unsigned int MipResources::URG04LX::_parsedLines [protected] |
number of parsed lines
ExtString MipResources::URG04LX::_parsingBits [protected] |
bytes not parsed by parse3bytes
ExtString MipResources::URG04LX::_prevTStamp [protected] |
ExtString containing previous scan time stamp
Rays MipResources::URG04LX::_tempRays [protected] |
temporary rays container
Time MipResources::URG04LX::_tStamp [protected] |
time stamp container
unsigned int MipResources::URG04LX::_totRays [protected] |
total rays created
unsigned int MipResources::URG04LX::_totScans [protected] |
total performed scans
unsigned int MipResources::URG04LX::_lfcount [protected] |
number of line feed found consecutively in response
unsigned int MipResources::URG04LX::_readAttempts [protected] |
number of reading attempts without response
unsigned int MipResources::URG04LX::_remainingScans [protected] |
number scan still to perform
bool MipResources::URG04LX::_wait [protected] |
flag set if next state is a waiting state
bool MipResources::URG04LX::_isContinuos [protected] |
flag set if was sent a MS-MD command
bool MipResources::URG04LX::_echoMatch [protected] |
flag set if echo matching was performed
bool MipResources::URG04LX::_statusMatch [protected] |
flag set if status matching was performed
bool MipResources::URG04LX::_tStampAcq [protected] |
flag set if time stamp acquisition matching was performed
bool MipResources::URG04LX::_checkLine [protected] |
flag set if received data format is correct
bool MipResources::URG04LX::_scanComplete [protected] |
flag set if a scan has been completed
bool MipResources::URG04LX::_workDone [protected] |
bool MipResources::URG04LX::_verboseOn [protected] |
flag set for verbose mode on
bool MipResources::URG04LX::_log [protected] |
flag set for log mode on
Time MipResources::URG04LX::_readDataTime [protected] |
deadline for data reading
Time MipResources::URG04LX::_waitNextScan [protected] |
deadline for next scan acquisition (depends on data encoding)
Time MipResources::URG04LX::_FSMperiod [protected] |
deadline for scan FSM
Time MipResources::URG04LX::_waitEchoMatch [protected] |
deadline for correct response after a multiple scan request
Timer MipResources::URG04LX::_waitedScan [protected] |
waited time for next scan acquisition
Timer MipResources::URG04LX::_waitedEcho [protected] |
waited time for correct response
ofstream MipResources::URG04LX::_logFile [protected] |
stream for log mode
instance of FSMSstates enum
instance of URG04LXPar object
instance of URGConst object
instance of URG04LXInfo object
instance of URG04LXCommand object