MipResources::URG04LXmm Class Reference
[Range sensor]

represents a URG04LX range sensor More...

#include <URG04LXmm.h>

Inheritance diagram for MipResources::URG04LXmm:

MipResources::RangeSens MipResources::Resource MIPObject

List of all members.

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


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 URG04LXmmCommand 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 RangeSensmm 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::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.


Member Function Documentation

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

parse data 2-bytes-encoded

Parameters:
_currentLine parsing is performed by lines

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

Parse data 3-bytes-encoded.

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

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

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.

Parameters:
 
[in] value Setting speed.

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

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

Parameters:
 
[in] value Setting baud rate.

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

getPlate.

Implements MipResources::RangeSens.

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  ) 

get a new scan

Reimplemented from MipResources::RangeSens.

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

get last stored scan

get a scan

Implements MipResources::RangeSens.

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

get a scan without return

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

start the continuous scanning

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

Implements MipResources::RangeSens.

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

stop the continuous scanning

Implements MipResources::RangeSens.

void MipResources::URG04LXmm::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 as received from sensor*/.

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::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*/

bytes not parsed by parse3bytes*/

ExtString containing previous scan time stamp*/.

temporary rays container*/

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*/

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*/

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::URG04LXmm::_logFile [protected]

stream for log mode*/

char MipResources::URG04LXmm::_sendingBuffer[10000] [protected]

Todo:
In scan sending mode in URG04LXmm.h find a reasanable value for dimension of _sendingBuffer.

Instance of FSMSstatesmm enum.

Instance of URG04LXmmPar object.

Instance of URGConst object.

Instance of URG04LXmmInfo object.

Instance of URG04LXmmCommand 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