URG sensor control. More...
#include <UrgDevice.h>

Public Types | |
| enum | { DefaultBaudrate = 115200, DefaultRetryTimes = 8, Infinity = 0, Off = 0, On = 1 } |
| 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. | |
| Connection * | connection (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 |
| Get Max scan index. | |
| void | setRetryTimes (size_t times) |
| Set number of retry times when connection failed. | |
| 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) |
| Get number of remaining capture times. | |
| 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. | |
| int | captureWithIntensity (std::vector< long > &data, std::vector< long > &intensity_data, long *timestamp=NULL) |
| void | stop (void) |
| Stop data acquisition. | |
| bool | setTimestamp (int timestamp=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 ¶meter) |
| 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. | |
| bool | reboot (void) |
| Reboot URG. | |
Protected Member Functions | |
| virtual void | captureReceived (void) |
URG sensor control.
acquire_data.cpp, and serialId.cpp.
Definition at line 23 of file UrgDevice.h.
| anonymous enum |
Parameter of options.
Definition at line 28 of file UrgDevice.h.
| const char * UrgDevice::what | ( | void | ) | const [virtual] |
Returns 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.
Definition at line 751 of file UrgDevice.cpp.
| bool UrgDevice::connect | ( | const char * | device, |
| long | baudrate = DefaultBaudrate |
||
| ) | [virtual] |
| [in] | device | Connected device name |
| [in] | baudrate | Baudrate |
| 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.
Definition at line 757 of file UrgDevice.cpp.
| void UrgDevice::setConnection | ( | Connection * | con | ) | [virtual] |
Specifies the connection object.
| [in] | con | Connection object |
Implements qrk::RangeSensor.
Definition at line 763 of file UrgDevice.cpp.
| Connection * UrgDevice::connection | ( | void | ) | [virtual] |
Get connection object.
Implements qrk::RangeSensor.
Definition at line 771 of file UrgDevice.cpp.
| void UrgDevice::disconnect | ( | void | ) | [virtual] |
| bool UrgDevice::isConnected | ( | void | ) | const [virtual] |
Returns connection status.
| true | If connected. |
| false | if disconnected. |
Implements qrk::RangeSensor.
Definition at line 783 of file UrgDevice.cpp.
| long UrgDevice::minDistance | ( | void | ) | const [virtual] |
Get valid minimum distance.
Implements qrk::RangeSensor.
Definition at line 789 of file UrgDevice.cpp.
| long UrgDevice::maxDistance | ( | void | ) | const [virtual] |
Get valid maximum distance.
Implements qrk::RangeSensor.
Definition at line 795 of file UrgDevice.cpp.
| int UrgDevice::maxScanLines | ( | void | ) | const [virtual] |
Get Max scan index.
Implements qrk::RangeSensor.
Definition at line 801 of file UrgDevice.cpp.
| void UrgDevice::setRetryTimes | ( | size_t | times | ) |
Set number of retry times when connection failed.
The retry counter is cleared when connect normaly.
| [in] | times | retry times |
Definition at line 808 of file UrgDevice.cpp.
| void UrgDevice::setCapturesSize | ( | size_t | size | ) |
Set number of scan data stored internally.
| [in] | size | Number of scanning data to be stored |
Definition at line 814 of file UrgDevice.cpp.
| int UrgDevice::scanMsec | ( | void | ) | const [virtual] |
Time taken for 1scan.
Implements qrk::RangeSensor.
Definition at line 826 of file UrgDevice.cpp.
| void UrgDevice::setCaptureMode | ( | RangeCaptureMode | mode | ) | [virtual] |
Specification of data acquisition mode.
| [in] | mode | The mode defined by RangeCaptureMode can be specified |
Implements qrk::RangeSensor.
Definition at line 833 of file UrgDevice.cpp.
| RangeCaptureMode UrgDevice::captureMode | ( | void | ) | [virtual] |
Data acquisition mode.
Implements qrk::RangeSensor.
Definition at line 853 of file UrgDevice.cpp.
| void UrgDevice::setCaptureRange | ( | int | begin_index, |
| int | end_index | ||
| ) |
Specifies the range of data acquisition.
Refer to scip_capture_parameter_section.
| [in] | begin_index | Measurement beginning position |
| [in] | end_index | Measurement end position |
Definition at line 859 of file UrgDevice.cpp.
| void UrgDevice::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
| [in] | interval | capture interval |
Definition at line 872 of file UrgDevice.cpp.
| void UrgDevice::setCaptureTimes | ( | size_t | times | ) |
Specify the frequency of data acquisition.
Refer to scip_capture_parameter_section
| [in] | times | Frequency of data acquisition |
Definition at line 884 of file UrgDevice.cpp.
| size_t UrgDevice::remainCaptureTimes | ( | void | ) |
Get number of remaining capture times.
Definition at line 820 of file UrgDevice.cpp.
| void UrgDevice::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.
| [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 :.
Definition at line 898 of file UrgDevice.cpp.
| int UrgDevice::capture | ( | std::vector< long > & | data, |
| long * | timestamp = NULL |
||
| ) | [virtual] |
Get data.
Get data and store it in buffer.
| [out] | data | Buffer to store data |
| [out] | timestamp | Time stamp |
| <0 | Receiving failed |
Implements qrk::RangeSensor.
Definition at line 908 of file UrgDevice.cpp.
| void UrgDevice::stop | ( | void | ) |
Stop data acquisition.
Definition at line 925 of file UrgDevice.cpp.
| bool UrgDevice::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().
| [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 |
| true | Success |
| false | Failure |
Implements qrk::RangeSensor.
Definition at line 931 of file UrgDevice.cpp.
| long UrgDevice::recentTimestamp | ( | void | ) | const [virtual] |
Latest time stamp value.
Reimplemented from qrk::RangeSensor.
Definition at line 940 of file UrgDevice.cpp.
| bool UrgDevice::setLaserOutput | ( | bool | on | ) | [virtual] |
Laser turn Off/ turn On.
| [in] | on | true to turn On , false to turn off |
Implements qrk::RangeSensor.
Definition at line 946 of file UrgDevice.cpp.
| double UrgDevice::index2rad | ( | const int | index | ) | const [virtual] |
Radian to angle conversion of data index.
Front of sensor is considered as 0.0 in radians.
| [in] | index | Data index |
Implements qrk::RangeSensor.
Definition at line 954 of file UrgDevice.cpp.
| int UrgDevice::rad2index | ( | const double | radian | ) | const [virtual] |
radian Convert angle in radian to data index
Front of sensor is considered as 0.0 in radians.
| [in] | radian | angle [radian] |
Implements qrk::RangeSensor.
Definition at line 961 of file UrgDevice.cpp.
| void UrgDevice::setParameter | ( | const RangeSensorParameter & | parameter | ) | [virtual] |
Update URG parameter.
| [in] | parameter | data used to update URG parameter |
Implements qrk::RangeSensor.
Definition at line 967 of file UrgDevice.cpp.
| RangeSensorParameter UrgDevice::parameter | ( | void | ) | const [virtual] |
Get URG parameter.
Implements qrk::RangeSensor.
Definition at line 974 of file UrgDevice.cpp.
| bool UrgDevice::loadParameter | ( | void | ) |
Again read the URG parameter.
| true | success |
| false | error |
Definition at line 980 of file UrgDevice.cpp.
| bool UrgDevice::versionLines | ( | std::vector< std::string > & | lines | ) |
Get version information.
| [out] | lines | Storage location of version information |
| true | success |
| false | error |
Example
Definition at line 986 of file UrgDevice.cpp.
| bool UrgDevice::reboot | ( | void | ) |
1.7.5.1-20111119