28 #define BIND_EVENT(event_name)\ 29 std::bind(&ScannerV2::triggerEvent<event_name>, this) 31 #define BIND_RAW_DATA_EVENT(event_name)\ 32 [this](const data_conversion_layer::RawDataConstPtr& data, const std::size_t& num_bytes, const int64_t& timestamp){ triggerEventWithParam(event_name(data, num_bytes, timestamp)); } 36 const std::function<
void()>& timeout_callback)
38 return std::unique_ptr<util::Watchdog>(
new util::Watchdog(timeout, timeout_callback));
42 :
IScanner(scanner_config, laser_scan_callback)
49 std::bind(&
ScannerV2::scannerStartErrorCallback, this,
std::placeholders::_1),
50 std::bind(&
ScannerV2::scannerStopErrorCallback, this,
std::placeholders::_1),
79 return std::future<void>();
97 return std::future<void>();
113 PSENSCAN_INFO(
"ScannerController",
"Scanner started successfully.");
123 PSENSCAN_INFO(
"ScannerController",
"Scanner stopped successfully.");
131 scanner_has_started_.value().set_exception(std::make_exception_ptr(std::runtime_error(error_msg)));
138 scanner_has_stopped_.value().set_exception(std::make_exception_ptr(std::runtime_error(error_msg)));
std::mutex member_mutex_
This Mutex protects ALL members of the Scanner against concurrent access. So far there exist at least...
void scannerStoppedCallback()
std::unique_ptr< util::Watchdog > create(const util::Watchdog::Timeout &timeout, const TimeoutCallback &timeout_callback) override
void laserScanCallback(const LaserScan &scan)
msm::back::state_machine< ScannerProtocolDef > ScannerStateMachine
State machine handling all events according to the scanner protocol and error handling specification...
const std::chrono::high_resolution_clock::duration Timeout
User requests scanner to start.
Contains the events needed to define and implement the scanner protocol.
ScannerV2(const ScannerConfiguration &scanner_config, const LaserScanCallback &laser_scan_callback)
Triggered whenever the receiving of a reply message failes.
OptionalPromise scanner_has_started_
#define PSENSCAN_DEBUG(name,...)
Higher level data type storing the configuration details of the scanner like scanner IP...
User requests scanner to stop.
OptionalPromise scanner_has_stopped_
#define PSENSCAN_INFO(name,...)
Timeout while waiting for MonitoringFrame.
void scannerStartedCallback()
Root namespace in which the software components to communicate with the scanner (firmware-version: 2)...
Received Start- or Stop-Reply message from scanner device.
void scannerStopErrorCallback(const std::string &error_msg)
#define BIND_RAW_DATA_EVENT(event_name)
This is the implementation of the Scanner API defined by IScanner.
std::function< void(const LaserScan &)> LaserScanCallback
Represents the user-provided callback for processing incoming scan data.
std::future< void > start() override
An exception is set in the returned future if the scanner start was not successful.
Timeout while waiting for scanner device to start.
Watchdog which continuously calls the specified timeout callback.
void scannerStartErrorCallback(const std::string &error_msg)
This is the API definition for external interaction with the scanner driver.
#define BIND_EVENT(event_name)
std::unique_ptr< ScannerStateMachine > sm_
Triggered whenever the receiving of a monitoring frame failes.
std::future< void > stop() override
An exception is set in the returned future if the scanner stop was not successful.
Received monitoring frame from scanner device.