qrk::UrgCtrl Class Reference

URG sensor control. More...

#include <UrgCtrl.h>

List of all members.



Public Types

enum  { DefaultBaudrate = 115200, Infinity = 0 }
 Parameter of options. More...

Public Member Functions

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

Static Public Attributes

static const bool Off = false
 Laser is off.
static const bool On = true
 Laser is on.

Protected Member Functions

virtual void captureReceived (void)

Detailed Description

URG sensor control.
Examples:

captureIntensitySample.cpp, gdCaptureSample.cpp, mdCaptureSample.cpp, multiMdScanSample.cpp, urg_acquire.cpp, viewPpSample.cpp, viewSerialIdSample.cpp, and viewVvSample.cpp.

Definition at line 24 of file UrgCtrl.h.


Member Enumeration Documentation

anonymous enum

Parameter of options.

Enumerator:
DefaultBaudrate  Default baudrate.
Infinity  Get data infinitely.

Definition at line 39 of file UrgCtrl.h.


Member Function Documentation

const char * 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.

Examples:
captureIntensitySample.cpp, gdCaptureSample.cpp, mdCaptureSample.cpp, multiMdScanSample.cpp, urg_acquire.cpp, viewPpSample.cpp, viewSerialIdSample.cpp, and viewVvSample.cpp.

Definition at line 685 of file UrgCtrl.cpp.

bool 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.

Examples:
captureIntensitySample.cpp, gdCaptureSample.cpp, mdCaptureSample.cpp, urg_acquire.cpp, viewPpSample.cpp, viewSerialIdSample.cpp, and viewVvSample.cpp.

Definition at line 691 of file UrgCtrl.cpp.

void UrgCtrl::setConnection ( Connection con  )  [virtual]

Specifies the connection object.

Parameters:
[in] con Connection object

Implements qrk::RangeSensor.

Definition at line 697 of file UrgCtrl.cpp.

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

Get connection object.

Returns:
Connection object

Implements qrk::RangeSensor.

Definition at line 703 of file UrgCtrl.cpp.

void UrgCtrl::disconnect ( void 
 )  [virtual]

Disconnect.

Implements qrk::RangeSensor.

Examples:
multiMdScanSample.cpp.

Definition at line 709 of file UrgCtrl.cpp.

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

Returns connection status.

Return values:

true If connected.

false if disconnected.

Implements qrk::RangeSensor.

Definition at line 715 of file UrgCtrl.cpp.

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

Get valid minimum distance.

Returns:
valid minimum distance

Implements qrk::RangeSensor.

Definition at line 721 of file UrgCtrl.cpp.

long UrgCtrl::maxDistance ( void 
 )  const [virtual]

Get valid maximum distance.

Returns:
Valid maximum distance

Implements qrk::RangeSensor.

Definition at line 727 of file UrgCtrl.cpp.

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

1周の最大スキャン数

Returns:
1周の最大スキャン数

Implements qrk::RangeSensor.

Definition at line 733 of file UrgCtrl.cpp.

void UrgCtrl::setCapturesSize ( size_t  size  ) 

Set number of scan data stored internally.

AutoCapture, IntensityCapture の各モードでは、UrgCtrl クラス内部でスキャンデータを保持している。このメソッドでは、そのスキャンデータの保持数を指定できる。

Parameters:
[in] size Number of scanning data to be stored

Definition at line 740 of file UrgCtrl.cpp.

int UrgCtrl::scanMsec ( void 
 )  const [virtual]

Time taken for 1scan.

Returns:
Time taken for 1scan.[msec]

Implements qrk::RangeSensor.

Examples:
captureIntensitySample.cpp, and mdCaptureSample.cpp.

Definition at line 752 of file UrgCtrl.cpp.

void 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.

Examples:
captureIntensitySample.cpp, mdCaptureSample.cpp, and multiMdScanSample.cpp.

Definition at line 760 of file UrgCtrl.cpp.

RangeCaptureMode UrgCtrl::captureMode ( void 
 )  [virtual]

Data acquisition mode.

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

Implements qrk::RangeSensor.

Definition at line 780 of file UrgCtrl.cpp.

void 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
Examples:
mdCaptureSample.cpp.

Definition at line 786 of file UrgCtrl.cpp.

void 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 何回に1回だけデータを取得するか

Definition at line 799 of file UrgCtrl.cpp.

void 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
Examples:
mdCaptureSample.cpp, and multiMdScanSample.cpp.

Definition at line 811 of file UrgCtrl.cpp.

size_t UrgCtrl::remainCaptureTimes ( void 
 ) 

残りデータ取得回数の取得

Returns:
残りデータ取得回数
Attention:
Data acquisition mode is valid only at AutoCapture, IntensityCapture

Definition at line 746 of file UrgCtrl.cpp.

void 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 :.

Examples:
mdCaptureSample.cpp.

Definition at line 825 of file UrgCtrl.cpp.

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.

Examples:
gdCaptureSample.cpp, mdCaptureSample.cpp, multiMdScanSample.cpp, and urg_acquire.cpp.

void UrgCtrl::stop ( void 
 ) 

Stop data acquisition.

Attention:
Data acquisition mode is valid only at AutoCapture, IntensityCapture

Definition at line 854 of file UrgCtrl.cpp.

bool UrgCtrl::setTimestamp ( int  ticks = 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.

Definition at line 860 of file UrgCtrl.cpp.

long UrgCtrl::recentTimestamp ( void 
 )  const [virtual]

Latest time stamp value.

Returns:
Time stamp value

Reimplemented from qrk::RangeSensor.

Definition at line 868 of file UrgCtrl.cpp.

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

Laser turn Off/ turn On.

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

Implements qrk::RangeSensor.

Definition at line 874 of file UrgCtrl.cpp.

double 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

センサ上面からの角度対応図

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

Implements qrk::RangeSensor.

Definition at line 882 of file UrgCtrl.cpp.

int 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.

Examples:
captureIntensitySample.cpp, and mdCaptureSample.cpp.

Definition at line 889 of file UrgCtrl.cpp.

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

Update URG parameter.

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

Implements qrk::RangeSensor.

Definition at line 895 of file UrgCtrl.cpp.

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

Get URG parameter.

Returns:
URG parameter

Implements qrk::RangeSensor.

Examples:
viewPpSample.cpp.

Definition at line 902 of file UrgCtrl.cpp.

bool UrgCtrl::loadParameter ( void 
 ) 

Again read the URG parameter.

Return values:

true success

false error

Definition at line 908 of file UrgCtrl.cpp.

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
Examples:
viewVvSample.cpp.


Member Data Documentation

const bool qrk::UrgCtrl::Off = false [static]

Laser is off.

Definition at line 44 of file UrgCtrl.h.

const bool qrk::UrgCtrl::On = true [static]

Laser is on.

Definition at line 45 of file UrgCtrl.h.


The documentation for this class was generated from the following files:
  • /home/satofumi/hyakuren/hokuyo_eng_html/libs/range_sensor/UrgCtrl.h
  • /home/satofumi/hyakuren/hokuyo_eng_html/libs/range_sensor/UrgCtrl.cpp
Comments