qrk::UrgCtrl Class Reference

URG sensor control. More...

#include <UrgCtrl.h>

Inheritance diagram for qrk::UrgCtrl:
Inheritance graph
[legend]

List of all members.

Public Types

enum  {
  DefaultBaudrate = 115200, DefaultRetryTimes = 8, Infinity = 0, Off = 0,
  On = 1
}
 

Parameter of options.

More...

Public Member Functions

int capture (std::vector< long > &data, long *timestamp=NULL)
 Get data.
RangeCaptureMode captureMode (void)
 Data acquisition mode.
int captureWithIntensity (std::vector< long > &data, std::vector< long > &intensity_data, long *timestamp=NULL)
bool connect (const char *device, long baudrate=DefaultBaudrate)
 Connection.
Connectionconnection (void)
 Get connection object.
void disconnect (void)
 Disconnect.
double index2rad (const int index) const
 Radian to angle conversion of data index.
bool isConnected (void) const
 Returns connection status.
bool loadParameter (void)
 Again read the URG parameter.
long maxDistance (void) const
 Get valid maximum distance.
int maxScanLines (void) const
 Get Max scan index.
long minDistance (void) const
 Get valid minimum distance.
RangeSensorParameter parameter (void) const
 Get URG parameter.
int rad2index (const double radian) const
 radian Convert angle in radian to data index
bool reboot (void)
 Reboot URG.
long recentTimestamp (void) const
 Latest time stamp value.
size_t remainCaptureTimes (void)
 Get number of remaining capture times.
bool reset (void)
 Reboot URG.
int scanMsec (void) const
 Time taken for 1scan.
void setCaptureFrameInterval (size_t interval)
 Acquisition interval of scanning data.
void setCaptureMode (RangeCaptureMode mode)
 Specification of data acquisition mode.
void setCaptureRange (int begin_index, int end_index)
 Specifies the range of data acquisition.
void setCaptureSkipLines (size_t skip_lines)
 Specify the number of scanline to be skipped.
void setCapturesSize (size_t size)
 Set number of scan data stored internally.
void setCaptureTimes (size_t times)
 Specify the frequency of data acquisition.
void setConnection (Connection *con)
 Specifies the connection object.
bool setLaserOutput (bool on)
 Laser turn Off/ turn On.
void setParameter (const RangeSensorParameter &parameter)
 Update URG parameter.
void setRetryTimes (size_t times)
 Set number of retry times when connection failed.
bool setTimestamp (int timestamp=0, int *response_msec=NULL, int *force_delay_msec=NULL)
 Sets the timestamp value. Sensor returs this timestamp value.
void stop (void)
 Stop data acquisition.
 UrgCtrl (void)
bool versionLines (std::vector< std::string > &lines)
 Get version information.
const char * what (void) const
 Returns internal status.
virtual ~UrgCtrl (void)

Protected Member Functions

virtual void captureReceived (void)

Private Member Functions

UrgCtrloperator= (const UrgCtrl &rhs)
 UrgCtrl (const UrgCtrl &rhs)

Private Attributes

std::auto_ptr< pImpl > pimpl

Detailed Description

URG sensor control.

Definition at line 23 of file UrgCtrl.h.


Member Enumeration Documentation

anonymous enum

Parameter of options.

Enumerator:
DefaultBaudrate 

[bps]

DefaultRetryTimes 
Infinity 
Off 

Laser is off.

On 

Laser is on.

Definition at line 28 of file UrgCtrl.h.


Constructor & Destructor Documentation

qrk::UrgCtrl::UrgCtrl ( void   ) 
virtual qrk::UrgCtrl::~UrgCtrl ( void   )  [virtual]
qrk::UrgCtrl::UrgCtrl ( const UrgCtrl rhs  )  [private]

Member Function Documentation

int qrk::UrgCtrl::capture ( std::vector< long > &  data,
long *  timestamp = NULL 
) [virtual]

Get data.

Get data and store it in buffer.

Parameters:
[out] data Buffer to store data
[out] timestamp Time stamp
Returns:
Number of data recieved.
Return values:
<0 Receiving failed

Implements qrk::RangeSensor.

RangeCaptureMode qrk::UrgCtrl::captureMode ( void   )  [virtual]

Data acquisition mode.

Returns:
Present data acquisition mode
See also:
setCaptureMode()

Implements qrk::RangeSensor.

virtual void qrk::UrgCtrl::captureReceived ( void   )  [protected, virtual]
int qrk::UrgCtrl::captureWithIntensity ( std::vector< long > &  data,
std::vector< long > &  intensity_data,
long *  timestamp = NULL 
) [virtual]

Implements qrk::RangeSensor.

bool qrk::UrgCtrl::connect ( const char *  device,
long  baudrate = DefaultBaudrate 
) [virtual]

Connection.

Parameters:
[in] device Connected device name
[in] baudrate Baudrate
Return values:
true Success
false Failure

Example

const char device[] = "/dev/ttyACM0";
const long baudrate = 115200;
UrgCtrl sensor;

// Connect to specified device
if (! sensor.connect(device, baudrate)) {
  printf("connect: %s\n", sensor.what());
  exit(1);
} 

Implements qrk::RangeSensor.

Connection* qrk::UrgCtrl::connection ( void   )  [virtual]

Get connection object.

Returns:
Connection object

Implements qrk::RangeSensor.

void qrk::UrgCtrl::disconnect ( void   )  [virtual]

Disconnect.

Implements qrk::RangeSensor.

double qrk::UrgCtrl::index2rad ( const int  index  )  const [virtual]

Radian to angle conversion of data index.

Front of sensor is considered as 0.0 in radians.

Parameters:
[in] index Data index
Returns:
angle [radian]
sensor_radian.png

upper view

See also:
index2deg(), rad2index(), deg2index()

Implements qrk::RangeSensor.

bool qrk::UrgCtrl::isConnected ( void   )  const [virtual]

Returns connection status.

Return values:
true If connected.
false if disconnected.

Implements qrk::RangeSensor.

bool qrk::UrgCtrl::loadParameter ( void   ) 

Again read the URG parameter.

Return values:
true success
false error
long qrk::UrgCtrl::maxDistance ( void   )  const [virtual]

Get valid maximum distance.

Returns:
Valid maximum distance

Implements qrk::RangeSensor.

int qrk::UrgCtrl::maxScanLines ( void   )  const [virtual]

Get Max scan index.

Returns:
Max scan index

Implements qrk::RangeSensor.

long qrk::UrgCtrl::minDistance ( void   )  const [virtual]

Get valid minimum distance.

Returns:
valid minimum distance

Implements qrk::RangeSensor.

UrgCtrl& qrk::UrgCtrl::operator= ( const UrgCtrl rhs  )  [private]
RangeSensorParameter qrk::UrgCtrl::parameter ( void   )  const [virtual]

Get URG parameter.

Returns:
URG parameter

Implements qrk::RangeSensor.

int qrk::UrgCtrl::rad2index ( const double  radian  )  const [virtual]

radian Convert angle in radian to data index

Front of sensor is considered as 0.0 in radians.

Parameters:
[in] radian angle [radian]
Returns:
Data index
See also:
deg2index(), index2rad(), index2deg()

Implements qrk::RangeSensor.

bool qrk::UrgCtrl::reboot ( void   ) 

Reboot URG.

Attention:
Only Top-URG (2010-02-04)
long qrk::UrgCtrl::recentTimestamp ( void   )  const [virtual]

Latest time stamp value.

Returns:
Time stamp value

Reimplemented from qrk::RangeSensor.

size_t qrk::UrgCtrl::remainCaptureTimes ( void   ) 

Get number of remaining capture times.

Returns:
number of remaining capture times
Attention:
Data acquisition mode is valid only at AutoCapture, IntensityCapture
bool qrk::UrgCtrl::reset ( void   ) 

Reboot URG.

Deprecated:
use reboot() function.
int qrk::UrgCtrl::scanMsec ( void   )  const [virtual]

Time taken for 1scan.

Returns:
Time taken for 1scan.[msec]

Implements qrk::RangeSensor.

void qrk::UrgCtrl::setCaptureFrameInterval ( size_t  interval  ) 

Acquisition interval of scanning data.

The data traffic between URG and the library can be decreased by lowering the frequency of data acquisition. refer to scip_capture_parameter_section

Parameters:
[in] interval capture interval
void qrk::UrgCtrl::setCaptureMode ( RangeCaptureMode  mode  )  [virtual]

Specification of data acquisition mode.

Parameters:
[in] mode The mode defined by RangeCaptureMode can be specified
See also:
captureMode()

Implements qrk::RangeSensor.

void qrk::UrgCtrl::setCaptureRange ( int  begin_index,
int  end_index 
)

Specifies the range of data acquisition.

Refer to scip_capture_parameter_section.

Parameters:
[in] begin_index Measurement beginning position
[in] end_index Measurement end position
void qrk::UrgCtrl::setCaptureSkipLines ( size_t  skip_lines  ) 

Specify the number of scanline to be skipped.

The number of thinning out of acquisition data in one scanning is specified.

Parameters:
[in] skip_lines number of scanline to be skipped.

For example, if number of scan lines to be skipped = 1 , then will be

100, 101, 103, 104, 105, 100, ... 

In case, number of scanlines to be skipped = 2, then acquired data will be

100, 103, 100, ... 

(The shortest distance data is returned. )
As a result, the data traffic between URG and the library can be decreased. However, the volume of data that capture() returns doesnot change. Returns

100, 100, 103, 103, 100, 100, ... 

To guarantee the operation of rad2index() and index2rad(), volume of data does not changing :.

void qrk::UrgCtrl::setCapturesSize ( size_t  size  ) 

Set number of scan data stored internally.

Parameters:
[in] size Number of scanning data to be stored
void qrk::UrgCtrl::setCaptureTimes ( size_t  times  ) 

Specify the frequency of data acquisition.

Refer to scip_capture_parameter_section

Parameters:
[in] times Frequency of data acquisition
Attention:
Data acquisition mode is valid only at AutoCapture, IntensityCapture
void qrk::UrgCtrl::setConnection ( Connection con  )  [virtual]

Specifies the connection object.

Parameters:
[in] con Connection object

Implements qrk::RangeSensor.

bool qrk::UrgCtrl::setLaserOutput ( bool  on  )  [virtual]

Laser turn Off/ turn On.

Parameters:
[in] on true to turn On , false to turn off

Implements qrk::RangeSensor.

void qrk::UrgCtrl::setParameter ( const RangeSensorParameter parameter  )  [virtual]

Update URG parameter.

Parameters:
[in] parameter data used to update URG parameter

Implements qrk::RangeSensor.

void qrk::UrgCtrl::setRetryTimes ( size_t  times  ) 

Set number of retry times when connection failed.

The retry counter is cleared when connect normaly.

Parameters:
[in] times retry times
Attention:
Data acquisition mode is valid only at AutoCapture
bool qrk::UrgCtrl::setTimestamp ( int  timestamp = 0,
int *  response_msec = NULL,
int *  force_delay_msec = NULL 
) [virtual]

Sets the timestamp value. Sensor returs this timestamp value.

Sets the time stamp that can be acquired with capture().

Parameters:
[in] ticks Set value of time stamp at that time
[out] response_msec Response time for sending and receiving message [msec]
[in] force_delay_msec Forced delay
Return values:
true Success
false Failure

Implements qrk::RangeSensor.

void qrk::UrgCtrl::stop ( void   ) 

Stop data acquisition.

Attention:
Data acquisition mode is valid only at AutoCapture, IntensityCapture
bool qrk::UrgCtrl::versionLines ( std::vector< std::string > &  lines  ) 

Get version information.

Parameters:
[out] lines Storage location of version information
Return values:
true success
false error

Example

  • viewVvSample::cpp
const char* qrk::UrgCtrl::what ( void   )  const [virtual]

Returns internal status.

Returns:
String that represent internal status

Example

UrgCtrl sensor;
if (! sensor.connect(device, baudrate)) {
  // Displays error message when connection is failed.
  printf("connect: %s\n", sensor.what());
  exit(1);
} 

Implements qrk::RangeSensor.


Member Data Documentation

std::auto_ptr<pImpl> qrk::UrgCtrl::pimpl [private]

Reimplemented from qrk::Coordinate.

Definition at line 259 of file UrgCtrl.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Defines


libhokuyo_urg
Author(s): Alexander Bubeck
autogenerated on Fri Jan 11 09:14:15 2013