MipResources::URG04LXmmCommand Class Reference
[Range sensor]

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

#include <URG04LXmm.h>

Inheritance diagram for MipResources::URG04LXmmCommand:

MIPObject

List of all members.

Public Member Functions

 URG04LXmmCommand ()
 Default constructor.
 ~URG04LXmmCommand ()
 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::URG04LXmmCommand::URG04LXmmCommand (  ) 

Default constructor.

MipResources::URG04LXmmCommand::~URG04LXmmCommand (  ) 

Destructor.


Member Function Documentation

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

Gets the name for debugging purposes.

Returns:
A string containing "URG04LXmm".

Implements MIPObject.

void MipResources::URG04LXmmCommand::setDevice ( const char *  device  ) 

Change device path, FILE*, file descriptor.

Parameters:
[in] *device New device path.

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

Send a command contained in an appropriate ExtString.

Parameters:
[in] *s Pointer to the first character of the ExtString containing the command to send.
Returns:
The number of actually sent characters.

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

Receive the answer of the sensor to a command.

Parameters:
[in] *s Pointer to the first character of the ExtString containing the answer of the sensor.
Returns:
The number of actually read characters.

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

Converts an int into a strig made of a fixed number of characters.

Parameters:
[in] bytes Number of characters of the string.
[in] value Int value to convert.
Returns:
A string rapresenting the value inserted.

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

Verifies that the echo of the responses is equal to the commad sent to URG.

Parameters:
[in] command Command sent.
[out] response Response received.
Returns:
true if command is equal to echo, false otherwise.

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

Compare the STATUS camp of the response with status param.

Parameters:
[in] command Command sent.
[out] response Response received.
Returns:
true if STATUS camp in response is does not imply a malfunction/error.

void MipResources::URG04LXmmCommand::changeProtocol (  ) 

Changes protocol to SCIP2.0.

void MipResources::URG04LXmmCommand::on (  ) 

Turn on laser for scanning.

void MipResources::URG04LXmmCommand::off (  ) 

Turn off laser for scanning.

void MipResources::URG04LXmmCommand::reset ( void   ) 

Reset sensor switching off laser and resetting all parameters to default values.

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

Useful to match host and sensor time and to evaluate avg data TX time.

Parameters:
[in] testString Parameter for avg data TX time evaluation.
Returns:
Sensor time.

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

Implements a FSM locally called for I/O opeations.

Parameters:
[in] *_command Command to send.
[out] &_output Response received.
Note:
_output is returned by reference.
Returns:
true if I/O operation was finished, false otherwise.

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

Set _SCIP2 flag.

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

Unset _SCIP2 flag.

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

Set _isReceiving flag.

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

Set _verboseOn flag.

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

Set _log flag.

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

Set _fdBad flag.

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

Unset _isReceiving flag.

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

Set _isFinished flag.

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

Unset _isFinished flag.

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

Unset _verboseOn flag.

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

Unset _log flag.

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

Unset _fdBad flag.

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

get device path

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

get FILE* of device

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

get file descriptor of device

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

get _SCIP2 flag

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

get _isReceiving flag

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

get _isFinished flag

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

return _verboseOn flag

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

return _log flag

bool MipResources::URG04LXmmCommand::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