53 if( !opi || (*opi).version_major != 1 )
55 std::cerr <<
"ERROR: Could not connect to laser range finder!" << std::endl;
59 if( (*opi).version_major != 1 )
61 std::cerr <<
"ERROR: Wrong protocol version (version_major=" << (*opi).version_major <<
", version_minor=" << (*opi).version_minor <<
")" << std::endl;
140 std::cerr <<
"ERROR: No connection to laser range finder or connection lost!" << std::endl;
154 std::cerr <<
"ERROR: No scan capturing started!" << std::endl;
167 std::cerr <<
"ERROR: No scan capturing started!" << std::endl;
179 std::cerr <<
"ERROR: No scan capturing started!" << std::endl;
191 std::cerr <<
"ERROR: No scan capturing started!" << std::endl;
212 parameters_ = std::map< std::string, std::string >();
272 const double current_time = std::time(0);
277 std::cerr <<
"ERROR: Feeding watchdog failed!" << std::endl;
double watchdog_feed_time_
Last time the watchdog was fed.
ScanDataReceiver * data_receiver_
Asynchronous data receiver.
bool setParameter(const std::string name, const std::string value)
int getUDPPort() const
Get open and receiving UDP port.
bool startScanOutput(const std::string &handle)
Initiate output of scan data.
std::size_t getScansAvailable() const
Get the total number of laserscans available (even scans which are not fully reveived yet) ...
Information about the HTTP/JSON protocol.
bool resetParameters(const std::vector< std::string > &names)
boost::optional< HandleInfo > requestHandleTCP(int start_angle=-1800000)
bool resetParameters(const std::vector< std::string > &names)
~R2000Driver()
Cleanly disconnect in case of destruction.
std::size_t getFullScansAvailable() const
Get the total number of fully received laserscans available.
bool setSamplesPerScan(unsigned int samples)
bool releaseHandle(const std::string &handle)
Release handle.
std::size_t getScansAvailable() const
Get the total number of laserscans available (even scans which are not fully reveived yet) ...
bool setScanFrequency(unsigned int frequency)
HttpCommandInterface * command_interface_
HTTP/JSON interface of the scanner.
ProtocolInfo protocol_info_
Cached version of the protocol info.
std::map< std::string, std::string > getParameters(const std::vector< std::string > &names)
bool isConnected()
Return connection status.
void feedWatchdog(bool feed_always=false)
Feed the watchdog with the current handle ID, to keep the data connection alive.
bool rebootDevice()
Reboot laserscanner.
Normally contains one complete laserscan (a full rotation of the scanner head)
R2000Driver()
Initialize driver.
boost::optional< HandleInfo > requestHandleUDP(int port, std::string hostname=std::string(""), int start_angle=-1800000)
void disconnect()
Disconnect from the laserscanner and reset internal state.
Allows accessing the HTTP/JSON interface of the Pepperl+Fuchs Laserscanner R2000. ...
std::map< std::string, std::string > parameters_
Cached version of all parameter values.
boost::optional< ProtocolInfo > getProtocolInfo()
bool connect(const std::string hostname, int port=80)
bool stopScanOutput(const std::string &handle)
Terminate output of scan data.
bool setParameter(const std::string &name, const std::string &value)
std::vector< std::string > getParameterList()
bool is_connected_
Internal connection state.
bool isConnected() const
Return connection status.
boost::optional< HandleInfo > handle_info_
Handle information about data connection.
Receives data of the laser range finder via IP socket Receives the scanner data with asynchronous fun...
std::size_t getFullScansAvailable() const
Get the total number of fully received laserscans available.
bool feedWatchdog(const std::string &handle)
Feed the watchdog to keep the handle alive.
bool is_capturing_
Internal capturing state.
const std::map< std::string, std::string > & getParameters()
double food_timeout_
Feeding interval (in seconds)