Range sensor interface. More...
#include <RangeSensor.h>
Public Member Functions | |
virtual int | capture (std::vector< long > &data, long *timestamp)=0 |
Get data. | |
virtual RangeCaptureMode | captureMode (void)=0 |
virtual int | captureWithIntensity (std::vector< long > &data, std::vector< long > &intensity_data, long *timestamp)=0 |
virtual bool | connect (const char *device, long baudrate)=0 |
Connection. | |
virtual Connection * | connection (void)=0 |
Get connection object. | |
int | deg2index (const int degree) const |
Angle conversion of data index. | |
virtual void | disconnect (void)=0 |
Disconnect. | |
int | index2deg (const int index) const |
Degree to angle conversion of data index. | |
virtual double | index2rad (const int index) const =0 |
Radian to angle conversion of data index. | |
virtual bool | isConnected (void) const =0 |
Returns connection status. | |
virtual long | maxDistance (void) const =0 |
Get valid maximum distance. | |
virtual int | maxScanLines (void) const =0 |
Get Max scan index. | |
virtual long | minDistance (void) const =0 |
Get valid minimum distance. | |
virtual RangeSensorParameter | parameter (void) const =0 |
Get URG parameter. | |
virtual int | rad2index (const double radian) const =0 |
radian Convert angle in radian to data index | |
virtual long | recentTimestamp (void) const |
Latest time stamp value. | |
virtual int | scanMsec (void) const =0 |
virtual void | setCaptureMode (RangeCaptureMode mode)=0 |
virtual void | setConnection (Connection *con)=0 |
Specifies the connection object. | |
virtual bool | setLaserOutput (bool on)=0 |
virtual void | setParameter (const RangeSensorParameter ¶meter)=0 |
Update URG parameter. | |
virtual bool | setTimestamp (int timestamp=0, int *response_msec=NULL, int *force_delay_msec=NULL)=0 |
Sets the timestamp value. Sensor returs this timestamp value. | |
virtual const char * | what (void) const =0 |
Returns internal status. | |
virtual | ~RangeSensor (void) |
Range sensor interface.
Definition at line 26 of file RangeSensor.h.
virtual qrk::RangeSensor::~RangeSensor | ( | void | ) | [inline, virtual] |
Definition at line 29 of file RangeSensor.h.
virtual int qrk::RangeSensor::capture | ( | std::vector< long > & | data, | |
long * | timestamp | |||
) | [pure virtual] |
Get data.
Get data and store it in buffer.
[out] | data | Buffer to store data |
[out] | timestamp | Time stamp |
<0 | Receiving failed |
Implemented in qrk::mUrgCtrl, and qrk::UrgCtrl.
virtual RangeCaptureMode qrk::RangeSensor::captureMode | ( | void | ) | [pure virtual] |
Implemented in qrk::mUrgCtrl, and qrk::UrgCtrl.
virtual int qrk::RangeSensor::captureWithIntensity | ( | std::vector< long > & | data, | |
std::vector< long > & | intensity_data, | |||
long * | timestamp | |||
) | [pure virtual] |
Implemented in qrk::mUrgCtrl, and qrk::UrgCtrl.
virtual bool qrk::RangeSensor::connect | ( | const char * | device, | |
long | baudrate | |||
) | [pure 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); }
Implemented in qrk::mUrgCtrl, and qrk::UrgCtrl.
virtual Connection* qrk::RangeSensor::connection | ( | void | ) | [pure virtual] |
int qrk::RangeSensor::deg2index | ( | const int | degree | ) | const [inline] |
Angle conversion of data index.
Front of sensor is considered as 0.0 in radians.
[in] | degree | angle [degree] |
Definition at line 242 of file RangeSensor.h.
virtual void qrk::RangeSensor::disconnect | ( | void | ) | [pure virtual] |
Disconnect.
Implemented in qrk::mUrgCtrl, and qrk::UrgCtrl.
int qrk::RangeSensor::index2deg | ( | const int | index | ) | const [inline] |
Degree to angle conversion of data index.
Front of sensor is considered as 0.0 in radians.
[in] | index | Data index |
upper view
Definition at line 211 of file RangeSensor.h.
virtual double qrk::RangeSensor::index2rad | ( | const int | index | ) | const [pure virtual] |
Radian to angle conversion of data index.
Front of sensor is considered as 0.0 in radians.
[in] | index | Data index |
upper view
Implemented in qrk::mUrgCtrl, and qrk::UrgCtrl.
virtual bool qrk::RangeSensor::isConnected | ( | void | ) | const [pure virtual] |
Returns connection status.
true | If connected. | |
false | if disconnected. |
Implemented in qrk::mUrgCtrl, and qrk::UrgCtrl.
virtual long qrk::RangeSensor::maxDistance | ( | void | ) | const [pure virtual] |
Get valid maximum distance.
Implemented in qrk::mUrgCtrl, and qrk::UrgCtrl.
virtual int qrk::RangeSensor::maxScanLines | ( | void | ) | const [pure virtual] |
virtual long qrk::RangeSensor::minDistance | ( | void | ) | const [pure virtual] |
Get valid minimum distance.
Implemented in qrk::mUrgCtrl, and qrk::UrgCtrl.
virtual RangeSensorParameter qrk::RangeSensor::parameter | ( | void | ) | const [pure virtual] |
virtual int qrk::RangeSensor::rad2index | ( | const double | radian | ) | const [pure virtual] |
radian Convert angle in radian to data index
Front of sensor is considered as 0.0 in radians.
[in] | radian | angle [radian] |
Implemented in qrk::mUrgCtrl, and qrk::UrgCtrl.
virtual long qrk::RangeSensor::recentTimestamp | ( | void | ) | const [inline, virtual] |
Latest time stamp value.
Reimplemented in qrk::UrgCtrl.
Definition at line 173 of file RangeSensor.h.
virtual int qrk::RangeSensor::scanMsec | ( | void | ) | const [pure virtual] |
Implemented in qrk::mUrgCtrl, and qrk::UrgCtrl.
virtual void qrk::RangeSensor::setCaptureMode | ( | RangeCaptureMode | mode | ) | [pure virtual] |
Implemented in qrk::mUrgCtrl, and qrk::UrgCtrl.
virtual void qrk::RangeSensor::setConnection | ( | Connection * | con | ) | [pure virtual] |
Specifies the connection object.
[in] | con | Connection object |
Implemented in qrk::mUrgCtrl, and qrk::UrgCtrl.
virtual bool qrk::RangeSensor::setLaserOutput | ( | bool | on | ) | [pure virtual] |
Implemented in qrk::mUrgCtrl, and qrk::UrgCtrl.
virtual void qrk::RangeSensor::setParameter | ( | const RangeSensorParameter & | parameter | ) | [pure virtual] |
Update URG parameter.
[in] | parameter | data used to update URG parameter |
Implemented in qrk::mUrgCtrl, and qrk::UrgCtrl.
virtual bool qrk::RangeSensor::setTimestamp | ( | int | timestamp = 0 , |
|
int * | response_msec = NULL , |
|||
int * | force_delay_msec = NULL | |||
) | [pure 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 |
Implemented in qrk::mUrgCtrl, and qrk::UrgCtrl.
virtual const char* qrk::RangeSensor::what | ( | void | ) | const [pure 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); }
Implemented in qrk::mUrgCtrl, and qrk::UrgCtrl.