MipResources::URG04LX Class Reference
[Range sensor]

represents a URG04LX range sensor More...

#include <URG04LX.h>

Inheritance diagram for MipResources::URG04LX:

MipResources::RangeSens MipResources::Resource MIPObject

List of all members.

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


Detailed Description

represents a URG04LX range sensor

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.

Note:
inherites from RangeSens class
Author:
Antonio Franchi and Marco Barbalinardo - email:barba82@yahoo.it
Date:
2008/11/07
Bug:
Scan may loose information if an error occurs
Todo:
mandatory methods do not work properly, group states of FSMdef in appropriate functions

Constructor & Destructor Documentation

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


Member Function Documentation

void MipResources::URG04LX::parse2bytes ( ExtString  _currentLine  )  [protected]

parse data 2-bytes-encoded

Parameters:
_currentLine parsing is performed by lines

void MipResources::URG04LX::parse3bytes ( ExtString _currentLine  )  [protected]

parse data 3-bytes-encoded

Parameters:
_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

int MipResources::URG04LX::readData ( ExtString  command,
ExtString rbuf,
int  how 
) [protected]

reading data function

void MipResources::URG04LX::changeMotor ( int  value  )  [protected]

set sensor's motor speed at value specified by

Parameters:
@param value setting speed

void MipResources::URG04LX::changeBuad ( int  value  )  [protected]

set sensor's baud rate (RS232) at value specified by

Parameters:
@param value setting baud rate

ResourcePlate MipResources::URG04LX::getPlate (  )  const [inline, virtual]

getPlate

Implements MipResources::RangeSens.

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  ) 

get a new scan

Reimplemented from MipResources::RangeSens.

bool MipResources::URG04LX::storedScan ( Scan s,
Time  timeout 
)

get last stored scan

Reimplemented from MipResources::RangeSens.

Scan MipResources::URG04LX::_singleScan (  )  [virtual]

get a scan

Implements MipResources::RangeSens.

void MipResources::URG04LX::mySingleScan (  )  [inline]

get a scan without return

void MipResources::URG04LX::_startScan ( unsigned int  num  )  [virtual]

start the continuous scanning

Parameters:
num number of scan to perform, (0 means unbounded)

Implements MipResources::RangeSens.

void MipResources::URG04LX::_stopScan (  )  [virtual]

stop the continuous scanning

Implements MipResources::RangeSens.

void MipResources::URG04LX::defFSM (  ) 

perform a FSM for scanning operations


Member Data Documentation

ExtString containig scan command

ExtString containig sensor's answer as received from sensor

ExtString containig sensor's answer and that will be processed

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

bytes not parsed by parse3bytes

ExtString containing previous scan time stamp

temporary rays container

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

flag set if was sent a MS-MD command

flag set if echo matching was performed

flag set if status matching was performed

flag set if time stamp acquisition matching was performed

flag set if received data format is correct

flag set if a scan has been completed

flag set for verbose mode on

bool MipResources::URG04LX::_log [protected]

flag set for log mode on

deadline for data reading

deadline for next scan acquisition (depends on data encoding)

deadline for scan FSM

deadline for correct response after a multiple scan request

waited time for next scan acquisition

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


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

Generated on Mon Feb 20 07:01:13 2017 for MIP by  doxygen 1.5.6