Driver for the laserscanner R2000 of Pepperl+Fuchs. More...
#include <r2000_driver.h>
Public Member Functions | |
bool | checkConnection () |
bool | connect (const std::string hostname, int port=80) |
void | disconnect () |
Disconnect from the laserscanner and reset internal state. More... | |
void | feedWatchdog (bool feed_always=false) |
Feed the watchdog with the current handle ID, to keep the data connection alive. More... | |
ScanData | getFullScan () |
std::size_t | getFullScansAvailable () const |
Get the total number of fully received laserscans available. More... | |
const std::map< std::string, std::string > & | getParameters () |
const std::map< std::string, std::string > & | getParametersCached () const |
const ProtocolInfo & | getProtocolInfo () |
ScanData | getScan () |
std::size_t | getScansAvailable () const |
Get the total number of laserscans available (even scans which are not fully reveived yet) More... | |
bool | isCapturing () |
bool | isConnected () |
Return connection status. More... | |
R2000Driver () | |
Initialize driver. More... | |
bool | rebootDevice () |
bool | resetParameters (const std::vector< std::string > &names) |
bool | setParameter (const std::string &name, const std::string &value) |
bool | setSamplesPerScan (unsigned int samples) |
bool | setScanFrequency (unsigned int frequency) |
bool | startCapturingTCP () |
bool | startCapturingUDP () |
bool | stopCapturing () |
~R2000Driver () | |
Cleanly disconnect in case of destruction. More... | |
Private Attributes | |
HttpCommandInterface * | command_interface_ |
HTTP/JSON interface of the scanner. More... | |
ScanDataReceiver * | data_receiver_ |
Asynchronous data receiver. More... | |
double | food_timeout_ |
Feeding interval (in seconds) More... | |
boost::optional< HandleInfo > | handle_info_ |
Handle information about data connection. More... | |
bool | is_capturing_ |
Internal capturing state. More... | |
bool | is_connected_ |
Internal connection state. More... | |
std::map< std::string, std::string > | parameters_ |
Cached version of all parameter values. More... | |
ProtocolInfo | protocol_info_ |
Cached version of the protocol info. More... | |
double | watchdog_feed_time_ |
Last time the watchdog was fed. More... | |
Driver for the laserscanner R2000 of Pepperl+Fuchs.
Definition at line 47 of file r2000_driver.h.
pepperl_fuchs::R2000Driver::R2000Driver | ( | ) |
Initialize driver.
Definition at line 39 of file r2000_driver.cpp.
pepperl_fuchs::R2000Driver::~R2000Driver | ( | ) |
Cleanly disconnect in case of destruction.
Definition at line 72 of file r2000_driver.cpp.
bool pepperl_fuchs::R2000Driver::checkConnection | ( | ) |
Actively check connection to laserscanner
Definition at line 136 of file r2000_driver.cpp.
bool pepperl_fuchs::R2000Driver::connect | ( | const std::string | hostname, |
int | port = 80 |
||
) |
Connects to a given laserscanner, gets and checks protocol info of scanner, retrieves values of all parameters
ip | IP or hostname of laserscanner |
port | Port to use for HTTP-Interface (defaults to 80) |
Definition at line 49 of file r2000_driver.cpp.
void pepperl_fuchs::R2000Driver::disconnect | ( | ) |
Disconnect from the laserscanner and reset internal state.
Definition at line 197 of file r2000_driver.cpp.
void pepperl_fuchs::R2000Driver::feedWatchdog | ( | bool | feed_always = false | ) |
Feed the watchdog with the current handle ID, to keep the data connection alive.
Definition at line 270 of file r2000_driver.cpp.
ScanData pepperl_fuchs::R2000Driver::getFullScan | ( | ) |
Pop a single full scan out of the driver's internal FIFO queue if there is any If no full scan is available yet, blocks until a full scan is available
Definition at line 160 of file r2000_driver.cpp.
std::size_t pepperl_fuchs::R2000Driver::getFullScansAvailable | ( | ) | const |
Get the total number of fully received laserscans available.
Definition at line 185 of file r2000_driver.cpp.
const std::map< std::string, std::string > & pepperl_fuchs::R2000Driver::getParameters | ( | ) |
Read all parameter values from the scanner
Definition at line 222 of file r2000_driver.cpp.
|
inline |
Get cached parameter values of the scanner
Definition at line 97 of file r2000_driver.h.
|
inline |
Retrieve Protocol information of the scanner
Definition at line 89 of file r2000_driver.h.
ScanData pepperl_fuchs::R2000Driver::getScan | ( | ) |
Pop a single scan out of the driver's interal FIFO queue CAUTION: Returns also unfinished scans for which a full rotation is not received yet Call getFullScansAvailable() first to see how many full scans are available
Definition at line 147 of file r2000_driver.cpp.
std::size_t pepperl_fuchs::R2000Driver::getScansAvailable | ( | ) | const |
Get the total number of laserscans available (even scans which are not fully reveived yet)
Definition at line 173 of file r2000_driver.cpp.
bool pepperl_fuchs::R2000Driver::isCapturing | ( | ) |
Return capture status
Definition at line 216 of file r2000_driver.cpp.
|
inline |
Return connection status.
Definition at line 65 of file r2000_driver.h.
bool pepperl_fuchs::R2000Driver::rebootDevice | ( | ) |
Reboot Laserscanner (Takes ~60s)
Definition at line 246 of file r2000_driver.cpp.
bool pepperl_fuchs::R2000Driver::resetParameters | ( | const std::vector< std::string > & | names | ) |
Reset certain parameters to factory default
names | Names of parameters to reset |
Definition at line 254 of file r2000_driver.cpp.
bool pepperl_fuchs::R2000Driver::setParameter | ( | const std::string & | name, |
const std::string & | value | ||
) |
Set a parameter by name and value
Definition at line 262 of file r2000_driver.cpp.
bool pepperl_fuchs::R2000Driver::setSamplesPerScan | ( | unsigned int | samples | ) |
Set number of samples per scan/rotation
samples | Only certain values are allowed (see Manual). Examples are 72, 360, 720, 1440, 1800, 3600, 7200, 10080, 25200 |
Definition at line 238 of file r2000_driver.cpp.
bool pepperl_fuchs::R2000Driver::setScanFrequency | ( | unsigned int | frequency | ) |
Set scan frequency (rotation speed of scanner head)
frequency | Frequency in Hz |
Definition at line 230 of file r2000_driver.cpp.
bool pepperl_fuchs::R2000Driver::startCapturingTCP | ( | ) |
Start capturing laserdata: Requests a handle and begin retrieving data from the scanner
Definition at line 78 of file r2000_driver.cpp.
bool pepperl_fuchs::R2000Driver::startCapturingUDP | ( | ) |
Start capturing laserdata: Requests a handle and begin retrieving data from the scanner
Definition at line 97 of file r2000_driver.cpp.
bool pepperl_fuchs::R2000Driver::stopCapturing | ( | ) |
Stop capturing laserdata: Release handle and stop retrieving data from the scanner
Definition at line 117 of file r2000_driver.cpp.
|
private |
HTTP/JSON interface of the scanner.
Definition at line 143 of file r2000_driver.h.
|
private |
Asynchronous data receiver.
Definition at line 146 of file r2000_driver.h.
|
private |
Feeding interval (in seconds)
Definition at line 158 of file r2000_driver.h.
|
private |
Handle information about data connection.
Definition at line 161 of file r2000_driver.h.
|
private |
Internal capturing state.
Definition at line 152 of file r2000_driver.h.
|
private |
Internal connection state.
Definition at line 149 of file r2000_driver.h.
|
private |
Cached version of all parameter values.
Definition at line 167 of file r2000_driver.h.
|
private |
Cached version of the protocol info.
Definition at line 164 of file r2000_driver.h.
|
private |
Last time the watchdog was fed.
Definition at line 155 of file r2000_driver.h.