MipResources::URG04LXCommand Class Reference
[Range sensor]

rapresents the commands of a URG04LX range sensor More...

#include <URG04LX.h>

Inheritance diagram for MipResources::URG04LXCommand:

MIPObject

List of all members.

Public Member Functions

 URG04LXCommand ()
 defalut constructor
 ~URG04LXCommand ()
 destructor
string getObjectName () const
 Gets the name for debugging purposes.
void setDevice (const char *device)
 change device path, FILE*, file descriptor
int writeCmd (char *s)
 send a command contained in an appropriate ExtString
int readCmd (char *s)
 receive the answer of the sensor to a command
ExtString int2string (int bytes, int value)
 converts an int into a strig made of a fixed number of characters
bool checkEcho (ExtString command, ExtString response)
 verifies that the echo of the responses is equal to the commad sent to URG
bool checkStatus (ExtString command, ExtString response)
 compare the STATUS camp of the response with status param
void changeProtocol ()
 changes protocol to SCIP2.0
void on ()
 turn on laser for scanning
void off ()
 turn off laser for scanning
void reset ()
 reset sensor switching off laser and resetting all parameters to default values
Time timeMatch (ExtString testString)
 useful to match host and sensor time and to evaluate avg data TX time
bool localFSM (char *_command, ExtString &_output)
 implements a FSM locally called for I/O opeations
void setSCIP2 ()
 set _SCIP2 flag
void unsetSCIP2 ()
 unset _SCIP2 flag
void setFirstBlock ()
 set _isReceiving flag
void setVerboseOn ()
 set _verboseOn flag
void setLog ()
 set _log flag
void setfdBad ()
 set _fdBad flag
void unsetFirstBlock ()
 unset _isReceiving flag
void setIsFinished ()
 set _isFinished flag
void unsetIsFinished ()
 unset _isFinished flag
void unsetVerboseOn ()
 unset _verboseOn flag
void unsetLog ()
 unset _log flag
void unsetfdBad ()
 unset _fdBad flag
const char * device ()
 get device path
FILE * laserPort ()
 get FILE* of device
int fd ()
 get file descriptor of device
bool SCIP2 ()
 get _SCIP2 flag
bool firstBlock ()
 get _isReceiving flag
bool isFinished ()
 get _isFinished flag
bool verboseOn ()
 return _verboseOn flag
bool log ()
 return _log flag
bool fdBad ()
 return _fdBad flag


Detailed Description

rapresents the commands of a URG04LX range sensor

Contains those methods that perform (or are usueful to perform) communication with real sensor. Communication is actually realized by localFSM. There are also some get and set functions for private attributes Scan operations are not implemented here.

Author:
Antonio Franchi and Marco Barbalinardo - email:barba82@yahoo.it
Date:
2008/11/07
Bug:
crashes if laser is not connected
Todo:
bug solving

Constructor & Destructor Documentation

MipResources::URG04LXCommand::URG04LXCommand (  )  [inline]

defalut constructor

MipResources::URG04LXCommand::~URG04LXCommand (  )  [inline]

destructor


Member Function Documentation

string MipResources::URG04LXCommand::getObjectName (  )  const [inline, virtual]

Gets the name for debugging purposes.

Returns:
URG04LX.

Implements MIPObject.

void MipResources::URG04LXCommand::setDevice ( const char *  device  )  [inline]

change device path, FILE*, file descriptor

Parameters:
device new device path

int MipResources::URG04LXCommand::writeCmd ( char *  s  ) 

send a command contained in an appropriate ExtString

Parameters:
s pointer to the first character of the ExtString containing the command to send
Returns:
the number of actually sent characters

Writing Error

int MipResources::URG04LXCommand::readCmd ( char *  s  ) 

receive the answer of the sensor to a command

Parameters:
s pointer to the first character of the ExtString containing the answer of the sensor
Returns:
the number of actually read characters

ExtString MipResources::URG04LXCommand::int2string ( int  bytes,
int  value 
)

converts an int into a strig made of a fixed number of characters

Parameters:
bytes number of characters of the string
value int value to convert
Returns:
a string rapresenting the value inserted

bool MipResources::URG04LXCommand::checkEcho ( ExtString  command,
ExtString  response 
)

verifies that the echo of the responses is equal to the commad sent to URG

Parameters:
command command sent
response response received
Returns:
true if command is equal to echo, false otherwise

bool MipResources::URG04LXCommand::checkStatus ( ExtString  command,
ExtString  response 
)

compare the STATUS camp of the response with status param

Parameters:
command command sent
response response received
Returns:
true if STATUS camp in response is does not imply a malfunction/error

void MipResources::URG04LXCommand::changeProtocol (  ) 

changes protocol to SCIP2.0

void MipResources::URG04LXCommand::on (  ) 

turn on laser for scanning

void MipResources::URG04LXCommand::off (  ) 

turn off laser for scanning

void MipResources::URG04LXCommand::reset ( void   ) 

reset sensor switching off laser and resetting all parameters to default values

Time MipResources::URG04LXCommand::timeMatch ( ExtString  testString  ) 

useful to match host and sensor time and to evaluate avg data TX time

Parameters:
testString parameter for avg data TX time evaluation
Returns:
sensor time

bool MipResources::URG04LXCommand::localFSM ( char *  _command,
ExtString _output 
)

implements a FSM locally called for I/O opeations

Parameters:
_command command to send
_output response received
Note:
_output is returned by reference
Returns:
true if I/O operation was finished

void MipResources::URG04LXCommand::setSCIP2 (  )  [inline]

set _SCIP2 flag

void MipResources::URG04LXCommand::unsetSCIP2 (  )  [inline]

unset _SCIP2 flag

void MipResources::URG04LXCommand::setFirstBlock (  )  [inline]

set _isReceiving flag

void MipResources::URG04LXCommand::setVerboseOn (  )  [inline]

set _verboseOn flag

void MipResources::URG04LXCommand::setLog (  )  [inline]

set _log flag

void MipResources::URG04LXCommand::setfdBad (  )  [inline]

set _fdBad flag

void MipResources::URG04LXCommand::unsetFirstBlock (  )  [inline]

unset _isReceiving flag

void MipResources::URG04LXCommand::setIsFinished (  )  [inline]

set _isFinished flag

void MipResources::URG04LXCommand::unsetIsFinished (  )  [inline]

unset _isFinished flag

void MipResources::URG04LXCommand::unsetVerboseOn (  )  [inline]

unset _verboseOn flag

void MipResources::URG04LXCommand::unsetLog (  )  [inline]

unset _log flag

void MipResources::URG04LXCommand::unsetfdBad (  )  [inline]

unset _fdBad flag

const char* MipResources::URG04LXCommand::device (  )  [inline]

get device path

FILE* MipResources::URG04LXCommand::laserPort (  )  [inline]

get FILE* of device

int MipResources::URG04LXCommand::fd (  )  [inline]

get file descriptor of device

bool MipResources::URG04LXCommand::SCIP2 (  )  [inline]

get _SCIP2 flag

bool MipResources::URG04LXCommand::firstBlock (  )  [inline]

get _isReceiving flag

bool MipResources::URG04LXCommand::isFinished (  )  [inline]

get _isFinished flag

bool MipResources::URG04LXCommand::verboseOn (  )  [inline]

return _verboseOn flag

bool MipResources::URG04LXCommand::log (  )  [inline]

return _log flag

bool MipResources::URG04LXCommand::fdBad (  )  [inline]

return _fdBad flag


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