scanner_state_machine_def.h
Go to the documentation of this file.
1 // Copyright (c) 2020-2021 Pilz GmbH & Co. KG
2 //
3 // This program is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU Lesser General Public License as published by
5 // the Free Software Foundation, either version 3 of the License, or
6 // (at your option) any later version.
7 //
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public License
14 // along with this program. If not, see <https://www.gnu.org/licenses/>.
15 
20 {
21 namespace protocol_layer
22 {
24  const communication_layer::NewMessageCallback& control_msg_callback,
25  const communication_layer::ErrorCallback& control_error_callback,
26  const communication_layer::ErrorCallback& start_error_callback,
27  const communication_layer::ErrorCallback& stop_error_callback,
28  const communication_layer::NewMessageCallback& data_msg_callback,
29  const communication_layer::ErrorCallback& data_error_callback,
30  const ScannerStartedCallback& scanner_started_callback,
31  const ScannerStoppedCallback& scanner_stopped_callback,
32  const InformUserAboutLaserScanCallback& laser_scan_callback,
33  const TimeoutCallback& start_timeout_callback,
34  const TimeoutCallback& monitoring_frame_timeout_callback)
35  : config_(config)
36  , control_client_(control_msg_callback,
37  control_error_callback,
38  config_.hostUDPPortControl(), // LCOV_EXCL_LINE Lcov bug?
39  config_.clientIp(),
40  config_.scannerControlPort())
41  , data_client_(data_msg_callback,
42  data_error_callback,
43  config_.hostUDPPortData(), // LCOV_EXCL_LINE Lcov bug?
44  config_.clientIp(),
45  config_.scannerDataPort())
46  , scanner_started_callback_(scanner_started_callback)
47  , scanner_stopped_callback_(scanner_stopped_callback)
48  , start_error_callback_(start_error_callback)
49  , stop_error_callback_(stop_error_callback)
50  , inform_user_about_laser_scan_callback_(laser_scan_callback)
51  , start_timeout_callback_(start_timeout_callback)
52  , monitoring_frame_timeout_callback_(monitoring_frame_timeout_callback)
53 {
54  scan_buffers_.insert(std::make_pair(ScannerId::master, ScanBuffer(DEFAULT_NUM_MSG_PER_ROUND)));
55  for (int i = 0; i < config.nrSubscribers(); i++)
56  {
58  scan_buffers_.insert(std::make_pair(id, ScanBuffer(1)));
59  }
60 }
61 
62 //+++++++++++++++++++++++++++++++++ States ++++++++++++++++++++++++++++++++++++
63 
64 // clang-format off
65 #define DEFAULT_ON_ENTRY_IMPL(state_name)\
66  template <class Event, class FSM>\
67  void ScannerProtocolDef::state_name::on_entry(Event const&, FSM& fsm)\
68  {\
69  PSENSCAN_DEBUG("StateMachine", "Entering state: " #state_name);\
70  }\
71 
72 #define DEFAULT_ON_EXIT_IMPL(state_name)\
73  template <class Event, class FSM>\
74  void ScannerProtocolDef::state_name::on_exit(Event const&, FSM& fsm)\
75  {\
76  PSENSCAN_DEBUG("StateMachine", "Exiting state: " #state_name);\
77  }
78 
79 #define DEFAULT_STATE_IMPL(state_name)\
80  DEFAULT_ON_ENTRY_IMPL(state_name)\
81  DEFAULT_ON_EXIT_IMPL(state_name)
82 // clang-format on
83 
84 DEFAULT_STATE_IMPL(WaitForStopReply)
85 
87 
88 // \cond Ignore "was not declared or defined" warnings from doxygen
89 template <class Event, class FSM>
90 void ScannerProtocolDef::Idle::on_exit(Event const& /*unused*/, FSM& fsm) // NOLINT
91 {
92  PSENSCAN_DEBUG("StateMachine", "Exiting state: Idle");
93  fsm.control_client_.startAsyncReceiving();
94  fsm.data_client_.startAsyncReceiving();
95 }
96 
97 template <class Event, class FSM>
98 void ScannerProtocolDef::WaitForStartReply::on_entry(Event const& /*unused*/, FSM& fsm) // NOLINT
99 {
100  PSENSCAN_DEBUG("StateMachine", "Entering state: WaitForStartReply");
101  // Start watchdog...
102  fsm.start_reply_watchdog_ = fsm.watchdog_factory_.create(WATCHDOG_TIMEOUT, fsm.start_timeout_callback_);
103 }
104 
105 template <class Event, class FSM>
106 void ScannerProtocolDef::WaitForStartReply::on_exit(Event const& /*unused*/, FSM& fsm) // NOLINT
107 {
108  PSENSCAN_DEBUG("StateMachine", "Exiting state: WaitForStartReply");
109  // Stops the watchdog by resetting the pointer
110  fsm.start_reply_watchdog_.reset();
111 }
112 
113 template <class Event, class FSM>
114 void ScannerProtocolDef::WaitForMonitoringFrame::on_entry(Event const& /*unused*/, FSM& fsm) // NOLINT
115 {
116  PSENSCAN_DEBUG("StateMachine", "Entering state: WaitForMonitoringFrame");
117  for (auto& sb : fsm.scan_buffers_)
118  sb.second.reset();
119 
120  // Start watchdog...
121  fsm.monitoring_frame_watchdog_ =
122  fsm.watchdog_factory_.create(WATCHDOG_TIMEOUT, fsm.monitoring_frame_timeout_callback_);
123 }
124 
125 template <class Event, class FSM>
126 void ScannerProtocolDef::WaitForMonitoringFrame::on_exit(Event const& /*unused*/, FSM& fsm) // NOLINT
127 {
128  PSENSCAN_DEBUG("StateMachine", "Exiting state: WaitForMonitoringFrame");
129  // Stops the watchdog by resetting the pointer
130  fsm.monitoring_frame_watchdog_.reset();
131 }
132 
133 template <class Event, class FSM>
134 void ScannerProtocolDef::Stopped::on_entry(Event const& /*unused*/, FSM& /*unused*/) // NOLINT
135 {
136  PSENSCAN_DEBUG("StateMachine", "Entering state: Stopped");
137 }
138 
139 DEFAULT_ON_EXIT_IMPL(Stopped)
140 
143 
144 // \endcond
145 //+++++++++++++++++++++++++++++++++ Actions +++++++++++++++++++++++++++++++++++
146 
147 template <class T>
148 inline void ScannerProtocolDef::sendStartRequest(const T& event)
149 {
150  PSENSCAN_DEBUG("StateMachine", "Action: sendStartRequest");
151 
152  if (!config_.hostIp())
153  {
154  auto host_ip{ control_client_.hostIp() };
155  config_.hostIp(host_ip.to_ulong());
156  PSENSCAN_INFO("StateMachine", "No host ip set! Using local ip: {}", host_ip.to_string());
157  }
160 }
161 
163 {
164  PSENSCAN_DEBUG("StateMachine", "Action: handleStartRequestTimeout");
165  PSENSCAN_ERROR("StateMachine",
166  "Timeout while waiting for the scanner to start! Retrying... "
167  "(Please check the ethernet connection or contact PILZ support if the error persists.)");
168  sendStartRequest(event);
169 }
170 
171 template <class T>
172 inline void ScannerProtocolDef::sendStopRequest(const T& event)
173 {
174  PSENSCAN_DEBUG("StateMachine", "Action: sendStopRequest");
175  data_client_.stop();
177 }
178 
180 {
181  PSENSCAN_DEBUG("StateMachine", "Action: handleMonitoringFrame");
183 
184  try
185  {
187  *(event.data_), event.num_bytes_) };
190  const data_conversion_layer::monitoring_frame::MessageStamped stamped_msg{ msg, event.timestamp_ };
191  informUserAboutTheScanData(stamped_msg);
192  }
193  // LCOV_EXCL_START
195  {
196  PSENSCAN_ERROR("StateMachine", e.what());
197  }
198  // LCOV_EXCL_STOP
199 }
200 
202 {
204 }
205 
207 {
209 }
210 
212 {
214  *(reply_event.data_)) };
216  fmt::format("Unknown result code {:#04x} in start reply.", static_cast<uint32_t>(msg.result())));
217 }
218 
220 {
221  start_error_callback_("Start Request refused by device.");
222 }
223 
225 {
227  *(reply_event.data_)) };
228  stop_error_callback_(fmt::format("Unknown result code {:#04x} in stop reply.", static_cast<uint32_t>(msg.result())));
229 }
230 
232 {
233  stop_error_callback_("Stop Request refused by device.");
234 }
235 
237 {
238  if (msg.hasDiagnosticMessagesField() && !msg.diagnosticMessages().empty())
239  {
241  1 /* sec */, "StateMachine", "The scanner reports an error: {}", util::formatRange(msg.diagnosticMessages()));
242  }
243 }
244 
245 inline void
247 {
248  if (!zoneset_reference_msg_.is_initialized() || (msg.scanCounter() >= zoneset_reference_msg_->scanCounter() &&
249  msg.activeZoneset() != zoneset_reference_msg_->activeZoneset()))
250  {
251  PSENSCAN_INFO("Scanner", "The scanner switched to active zoneset {}", msg.activeZoneset() + 1);
253  }
254 }
255 
258 {
259  try
260  {
261  scan_buffers_.at(stamped_msg.msg_.scannerId()).add(stamped_msg);
262  if (!config_.fragmentedScansEnabled() && scan_buffers_.at(stamped_msg.msg_.scannerId()).isRoundComplete())
263  {
264  sendMessageWithMeasurements(scan_buffers_.at(stamped_msg.msg_.scannerId()).currentRound());
265  }
266  }
267  catch (const ScanRoundError& ex)
268  {
269  PSENSCAN_WARN("ScanBuffer", ex.what());
270  }
271  if (config_.fragmentedScansEnabled()) // Send the scan fragment in any case.
272  {
273  sendMessageWithMeasurements({ stamped_msg });
274  }
275 }
276 
278  const std::vector<data_conversion_layer::monitoring_frame::MessageStamped>& stamped_msgs)
279 {
280  if (framesContainMeasurements(stamped_msgs))
281  {
282  try
283  {
285  }
286  // LCOV_EXCL_START
288  {
289  PSENSCAN_ERROR("StateMachine", ex.what());
290  }
291  // LCOV_EXCL_STOP
292  }
293 }
294 
296  const std::vector<data_conversion_layer::monitoring_frame::MessageStamped>& stamped_msgs)
297 {
298  if (std::all_of(stamped_msgs.begin(), stamped_msgs.end(), [](const auto& stamped_msg) {
299  return stamped_msg.msg_.measurements().empty();
300  }))
301  {
302  PSENSCAN_DEBUG("StateMachine", "No measurement data in current monitoring frame(s), skipping laser scan callback.");
303  return false;
304  }
305  return true;
306 }
307 
309 {
310  PSENSCAN_DEBUG("StateMachine", "Action: handleMonitoringFrameTimeout");
311 
312  PSENSCAN_WARN("StateMachine",
313  "Timeout while waiting for MonitoringFrame message."
314  " (Please check the ethernet connection or contact PILZ support if the error persists.)");
315 }
316 
317 //+++++++++++++++++++++++++++++++++ Guards ++++++++++++++++++++++++++++++++++++
318 
319 // LCOV_EXCL_START
321  : std::runtime_error(error_msg)
322 {
323 }
324 // LCOV_EXCL_STOP
325 
327 {
328  // LCOV_EXCL_START
330  {
331  throw InternalScannerReplyError("Unexpected code in reply");
332  }
334  {
336  {
337  throw InternalScannerReplyError("Request refused by device.");
338  }
339  else
340  {
341  throw InternalScannerReplyError("Unknown operation result code.");
342  }
343  }
344  // LCOV_EXCL_STOP
345 }
346 
348 {
350  *(reply_event.data_)) };
351  return isStartReply(msg) && isAcceptedReply(msg);
352 }
353 
355 {
357  *(reply_event.data_)) };
358  return isStartReply(msg) && isUnknownReply(msg);
359 }
360 
362 {
364  *(reply_event.data_)) };
365  return isStartReply(msg) && isRefusedReply(msg);
366 }
367 
369 {
371  *(reply_event.data_)) };
372  return isStopReply(msg) && isAcceptedReply(msg);
373 }
374 
376 {
378  *(reply_event.data_)) };
379  return isStopReply(msg) && isUnknownReply(msg);
380 }
381 
383 {
385  *(reply_event.data_)) };
386  return isStopReply(msg) && isRefusedReply(msg);
387 }
388 
390 {
392 }
393 
395 {
397 }
398 
400 {
402 }
403 
405 {
407 }
408 
410 {
412 }
413 
414 //++++++++++++++++++++ Special transitions ++++++++++++++++++++++++++++++++++++
415 
416 template <class FSM>
417 static std::string getStateName(const int& state_id)
418 {
419  using recursive_transition_table = typename boost::msm::back::recursive_get_transition_table<FSM>::type;
420  using states = typename boost::msm::back::generate_state_set<recursive_transition_table>::type;
421 
422  std::string mangle_state_name;
423  boost::mpl::for_each<states, boost::msm::wrap<boost::mpl::placeholders::_1> >(
424  boost::msm::back::get_state_name<recursive_transition_table>(mangle_state_name, state_id));
425  const auto full_name{ boost::core::demangle(mangle_state_name.c_str()) };
426  return full_name.substr(full_name.rfind("::") + 2);
427 }
428 
429 template <class T>
430 static std::string classNameShort(const T& t)
431 {
432  const auto full_name{ boost::core::demangle(typeid(t).name()) };
433  return full_name.substr(full_name.rfind("::") + 2);
434 }
435 
436 // LCOV_EXCL_START
437 template <class FSM, class Event>
438 void ScannerProtocolDef::exception_caught(Event const& event, FSM& /*unused*/, std::exception& exception) // NOLINT
439 {
440  PSENSCAN_ERROR("StateMachine", "Received error \"{}\". Shutting down now.", exception.what());
441  sendStopRequest(event);
442  throw exception;
443 }
444 // LCOV_EXCL_STOP
445 
446 template <class FSM, class Event>
447 void ScannerProtocolDef::no_transition(Event const& event, FSM& /*unused*/, int state) // NOLINT
448 {
449  PSENSCAN_WARN("StateMachine",
450  "No transition in state \"{}\" for event \"{}\".",
451  getStateName<FSM>(state),
452  classNameShort(event));
453 }
454 
455 template <class FSM>
457  FSM& /*unused*/,
458  int state)
459 {
460  PSENSCAN_WARN("StateMachine", "Received monitoring frame despite not waiting for it");
461 }
462 
463 } // namespace protocol_layer
464 } // namespace psen_scan_v2_standalone
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::isAcceptedStopReply
bool isAcceptedStopReply(scanner_events::RawReplyReceived const &reply_event)
Definition: scanner_state_machine_def.h:368
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::config_
ScannerConfiguration config_
Definition: scanner_state_machine.h:281
psen_scan_v2_standalone::configuration::ScannerId
ScannerId
Definition: scanner_ids.h:27
psen_scan_v2_standalone::protocol_layer::scanner_events::RawMonitoringFrameReceived::num_bytes_
const std::size_t num_bytes_
Definition: scanner_events.h:82
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::MessageStamped::msg_
Message msg_
Definition: monitoring_frame_msg.h:111
PSENSCAN_WARN
#define PSENSCAN_WARN(name,...)
Definition: logging.h:62
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::notifyUserAboutRefusedStartReply
void notifyUserAboutRefusedStartReply(scanner_events::RawReplyReceived const &reply_event)
Definition: scanner_state_machine_def.h:219
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::Message::scannerId
configuration::ScannerId scannerId() const
Definition: monitoring_frame_msg.cpp:31
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::checkForInternalErrors
void checkForInternalErrors(const data_conversion_layer::scanner_reply::Message &msg)
Definition: scanner_state_machine_def.h:326
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::InternalScannerReplyError
Exception thrown when something goes wrong with the scanner reply.
Definition: scanner_state_machine.h:242
psen_scan_v2_standalone::data_conversion_layer::stop_request::serialize
RawData serialize()
Definition: stop_request_serialization.cpp:28
psen_scan_v2_standalone::data_conversion_layer::scanner_reply::Message::Type::start
@ start
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::isUnknownStartReply
bool isUnknownStartReply(scanner_events::RawReplyReceived const &reply_event)
Definition: scanner_state_machine_def.h:354
psen_scan_v2_standalone::data_conversion_layer::scanner_reply::Message::result
constexpr OperationResult result() const
Definition: scanner_reply_msg.h:99
start_request_serialization.h
DEFAULT_STATE_IMPL
#define DEFAULT_STATE_IMPL(state_name)
Definition: scanner_state_machine_def.h:79
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::scanner_started_callback_
const ScannerStartedCallback scanner_started_callback_
Definition: scanner_state_machine.h:297
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::notifyUserAboutUnknownStopReply
void notifyUserAboutUnknownStopReply(scanner_events::RawReplyReceived const &reply_event)
Definition: scanner_state_machine_def.h:224
psen_scan_v2_standalone::communication_layer::UdpClientImpl::write
void write(const data_conversion_layer::RawData &data)
Asynchronously sends the specified data to the other endpoint.
Definition: udp_client.h:275
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::AdditionalFieldMissing
Exception thrown if an additional field was missing during deserialization of a Message.
Definition: monitoring_frame_msg.h:49
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::isStartReply
bool isStartReply(data_conversion_layer::scanner_reply::Message const &msg)
Definition: scanner_state_machine_def.h:404
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::exception_caught
void exception_caught(Event const &event, FSM &fsm, std::exception &exception)
Definition: scanner_state_machine_def.h:438
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::framesContainMeasurements
bool framesContainMeasurements(const std::vector< data_conversion_layer::monitoring_frame::MessageStamped > &stamped_msg)
Definition: scanner_state_machine_def.h:295
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::data_client_
communication_layer::UdpClientImpl data_client_
Definition: scanner_state_machine.h:294
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::handleMonitoringFrame
void handleMonitoringFrame(const scanner_events::RawMonitoringFrameReceived &event)
Definition: scanner_state_machine_def.h:179
psen_scan_v2_standalone::protocol_layer::ScannerStoppedCallback
std::function< void()> ScannerStoppedCallback
Definition: scanner_state_machine.h:88
psen_scan_v2_standalone::communication_layer::UdpClientImpl::stop
void stop()
Stops the underlying io_service so that no messages are received anymore.
Definition: udp_client.h:212
scanner_configuration.h
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::InternalScannerReplyError::InternalScannerReplyError
InternalScannerReplyError(const std::string &error_msg)
Definition: scanner_state_machine_def.h:320
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::informUserAboutTheScanData
void informUserAboutTheScanData(const data_conversion_layer::monitoring_frame::MessageStamped &stamped_msg)
Definition: scanner_state_machine_def.h:256
psen_scan_v2_standalone::data_conversion_layer::start_request::serialize
RawData serialize(const data_conversion_layer::start_request::Message &start_request, const uint32_t &seq_number=DEFAULT_SEQ_NUMBER)
Definition: start_request_serialization.cpp:61
psen_scan_v2_standalone::protocol_layer::scanner_events::RawReplyReceived
Received Start- or Stop-Reply message from scanner device.
Definition: scanner_events.h:48
psen_scan_v2_standalone::protocol_layer::InformUserAboutLaserScanCallback
std::function< void(const LaserScan &)> InformUserAboutLaserScanCallback
Definition: scanner_state_machine.h:92
PSENSCAN_DEBUG
#define PSENSCAN_DEBUG(name,...)
Definition: logging.h:63
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::isRefusedReply
bool isRefusedReply(data_conversion_layer::scanner_reply::Message const &msg)
Definition: scanner_state_machine_def.h:399
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::sendMessageWithMeasurements
void sendMessageWithMeasurements(const std::vector< data_conversion_layer::monitoring_frame::MessageStamped > &stamped_msg)
Definition: scanner_state_machine_def.h:277
psen_scan_v2_standalone::protocol_layer::DEFAULT_NUM_MSG_PER_ROUND
static constexpr uint32_t DEFAULT_NUM_MSG_PER_ROUND
Definition: scanner_state_machine.h:85
psen_scan_v2_standalone::protocol_layer::scanner_events::StartTimeout
Timeout while waiting for scanner device to start.
Definition: scanner_events.h:43
psen_scan_v2_standalone::data_conversion_layer::ScannerProtocolViolationError
: Exception thrown if data received from the scanner hardware could not be processed according to pro...
Definition: laserscan_conversions.h:38
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::isRefusedStopReply
bool isRefusedStopReply(scanner_events::RawReplyReceived const &reply_event)
Definition: scanner_state_machine_def.h:382
psen_scan_v2_standalone::data_conversion_layer::scanner_reply::Message::type
constexpr Type type() const
Definition: scanner_reply_msg.h:94
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::isUnknownStopReply
bool isUnknownStopReply(scanner_events::RawReplyReceived const &reply_event)
Definition: scanner_state_machine_def.h:375
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::notifyUserAboutRefusedStopReply
void notifyUserAboutRefusedStopReply(scanner_events::RawReplyReceived const &reply_event)
Definition: scanner_state_machine_def.h:231
psen_scan_v2_standalone::data_conversion_layer::LaserScanConverter::toLaserScan
static LaserScan toLaserScan(const std::vector< data_conversion_layer::monitoring_frame::MessageStamped > &stamped_msgs)
Converts monitoring_frames of a scan_round to the user friendly LaserScan type sent by the IScanner::...
Definition: laserscan_conversions.h:87
DEFAULT_ON_ENTRY_IMPL
#define DEFAULT_ON_ENTRY_IMPL(state_name)
Definition: scanner_state_machine_def.h:65
psen_scan_v2_standalone::protocol_layer::ScannerStartedCallback
std::function< void()> ScannerStartedCallback
Definition: scanner_state_machine.h:87
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::Message::hasDiagnosticMessagesField
bool hasDiagnosticMessagesField() const
Definition: monitoring_frame_msg.cpp:143
psen_scan_v2_standalone::configuration::subscriber_number_to_scanner_id
static ScannerId subscriber_number_to_scanner_id(uint8_t nr)
Definition: scanner_ids.h:42
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::handleMonitoringFrameTimeout
void handleMonitoringFrameTimeout(const scanner_events::MonitoringFrameTimeout &event)
Definition: scanner_state_machine_def.h:308
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::monitoring_frame_watchdog_
std::unique_ptr< util::Watchdog > monitoring_frame_watchdog_
Definition: scanner_state_machine.h:285
psen_scan_v2_standalone::data_conversion_layer::scanner_reply::Message
Higher level data type representing a reply message from the scanner.
Definition: scanner_reply_msg.h:33
psen_scan_v2_standalone::protocol_layer::scanner_events::RawMonitoringFrameReceived::data_
const data_conversion_layer::RawDataConstPtr data_
Definition: scanner_events.h:81
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::checkForChangedActiveZoneset
void checkForChangedActiveZoneset(const data_conversion_layer::monitoring_frame::Message &msg)
Definition: scanner_state_machine_def.h:246
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::no_transition
void no_transition(Event const &event, FSM &, int state)
Definition: scanner_state_machine_def.h:447
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::notifyUserAboutStart
void notifyUserAboutStart(scanner_events::RawReplyReceived const &reply_event)
Definition: scanner_state_machine_def.h:201
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::Message::scanCounter
uint32_t scanCounter() const
Definition: monitoring_frame_msg.cpp:46
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::isUnknownReply
bool isUnknownReply(data_conversion_layer::scanner_reply::Message const &msg)
Definition: scanner_state_machine_def.h:394
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::MessageStamped
Wrapping class for a Message and its corresponding timestamp.
Definition: monitoring_frame_msg.h:109
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::isRefusedStartReply
bool isRefusedStartReply(scanner_events::RawReplyReceived const &reply_event)
Definition: scanner_state_machine_def.h:361
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::inform_user_about_laser_scan_callback_
const InformUserAboutLaserScanCallback inform_user_about_laser_scan_callback_
Definition: scanner_state_machine.h:301
PSENSCAN_INFO
#define PSENSCAN_INFO(name,...)
Definition: logging.h:61
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::ScannerProtocolDef
ScannerProtocolDef(const ScannerConfiguration &config, const communication_layer::NewMessageCallback &control_msg_callback, const communication_layer::ErrorCallback &control_error_callback, const communication_layer::ErrorCallback &start_error_callback, const communication_layer::ErrorCallback &stop_error_callback, const communication_layer::NewMessageCallback &data_msg_callback, const communication_layer::ErrorCallback &data_error_callback, const ScannerStartedCallback &scanner_started_callback, const ScannerStoppedCallback &scanner_stopped_callback, const InformUserAboutLaserScanCallback &laser_scan_callback, const TimeoutCallback &start_timeout_callback, const TimeoutCallback &monitoring_frame_timeout_callback)
Definition: scanner_state_machine_def.h:23
psen_scan_v2_standalone::data_conversion_layer::scanner_reply::deserialize
Message deserialize(const data_conversion_layer::RawData &data)
Definition: scanner_reply_serialization_deserialization.cpp:60
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::Message::diagnosticMessages
std::vector< diagnostic::Message > diagnosticMessages() const
Definition: monitoring_frame_msg.cpp:106
psen_scan_v2_standalone::protocol_layer::classNameShort
static std::string classNameShort(const T &t)
Definition: scanner_state_machine_def.h:430
psen_scan_v2_standalone::util::formatRange
std::string formatRange(const T &range)
Definition: format_range.h:38
DEFAULT_ON_EXIT_IMPL
#define DEFAULT_ON_EXIT_IMPL(state_name)
Definition: scanner_state_machine_def.h:72
PSENSCAN_WARN_THROTTLE
#define PSENSCAN_WARN_THROTTLE(period, name,...)
Definition: logging.h:78
psen_scan_v2_standalone::data_conversion_layer::scanner_reply::Message::OperationResult::accepted
@ accepted
psen_scan_v2_standalone::protocol_layer::scanner_events::MonitoringFrameTimeout
Timeout while waiting for MonitoringFrame.
Definition: scanner_events.h:87
psen_scan_v2_standalone::data_conversion_layer::scanner_reply::Message::Type::stop
@ stop
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::scanner_stopped_callback_
const ScannerStoppedCallback scanner_stopped_callback_
Definition: scanner_state_machine.h:298
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::start_error_callback_
const StartErrorCallback start_error_callback_
Definition: scanner_state_machine.h:299
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::Message::activeZoneset
uint8_t activeZoneset() const
Definition: monitoring_frame_msg.cpp:58
psen_scan_v2_standalone::protocol_layer::getStateName
static std::string getStateName(const int &state_id)
Definition: scanner_state_machine_def.h:417
psen_scan_v2_standalone::protocol_layer::scanner_events::RawMonitoringFrameReceived
Received monitoring frame from scanner device.
Definition: scanner_events.h:70
psen_scan_v2_standalone::protocol_layer::ScanRoundError
Exception indicating problems with the monitoring frames of a scan round.
Definition: scan_buffer.h:32
psen_scan_v2_standalone::ScannerConfiguration::hostIp
boost::optional< uint32_t > hostIp() const
Definition: scanner_configuration.h:101
psen_scan_v2_standalone::protocol_layer::WATCHDOG_TIMEOUT
static constexpr std::chrono::milliseconds WATCHDOG_TIMEOUT
Definition: scanner_state_machine.h:84
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::deserialize
monitoring_frame::Message deserialize(const data_conversion_layer::RawData &data, const std::size_t &num_bytes)
Definition: monitoring_frame_deserialization.cpp:79
std
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::handleStartRequestTimeout
void handleStartRequestTimeout(const scanner_events::StartTimeout &event)
Definition: scanner_state_machine_def.h:162
psen_scan_v2_standalone::ScannerConfiguration::fragmentedScansEnabled
bool fragmentedScansEnabled() const
Definition: scanner_configuration.h:151
psen_scan_v2_standalone
Root namespace in which the software components to communicate with the scanner (firmware-version: 2)...
Definition: udp_client.h:41
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::notifyUserAboutUnknownStartReply
void notifyUserAboutUnknownStartReply(scanner_events::RawReplyReceived const &reply_event)
Definition: scanner_state_machine_def.h:211
psen_scan_v2_standalone::communication_layer::UdpClientImpl::hostIp
boost::asio::ip::address_v4 hostIp()
Returns local ip address of current socket connection.
Definition: udp_client.h:242
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::scan_buffers_
std::unordered_map< ScannerId, ScanBuffer > scan_buffers_
Definition: scanner_state_machine.h:288
PSENSCAN_ERROR
#define PSENSCAN_ERROR(name,...)
Definition: logging.h:60
psen_scan_v2_standalone::data_conversion_layer::scanner_reply::Message::OperationResult::unknown
@ unknown
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::isStopReply
bool isStopReply(data_conversion_layer::scanner_reply::Message const &msg)
Definition: scanner_state_machine_def.h:409
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::stop_error_callback_
const StopErrorCallback stop_error_callback_
Definition: scanner_state_machine.h:300
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::Message
Higher level data type representing a single monitoring frame.
Definition: monitoring_frame_msg.h:62
psen_scan_v2_standalone::data_conversion_layer::scanner_reply::Message::Type::unknown
@ unknown
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::zoneset_reference_msg_
boost::optional< data_conversion_layer::monitoring_frame::Message > zoneset_reference_msg_
Definition: scanner_state_machine.h:290
psen_scan_v2_standalone::communication_layer::ErrorCallback
std::function< void(const std::string &)> ErrorCallback
Definition: udp_client.h:50
psen_scan_v2_standalone::communication_layer::NewMessageCallback
std::function< void(const data_conversion_layer::RawDataConstPtr &, const std::size_t &, const int64_t &timestamp)> NewMessageCallback
Definition: udp_client.h:49
psen_scan_v2_standalone::data_conversion_layer::scanner_reply::Message::OperationResult::refused
@ refused
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::checkForDiagnosticErrors
void checkForDiagnosticErrors(const data_conversion_layer::monitoring_frame::Message &msg)
Definition: scanner_state_machine_def.h:236
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::sendStopRequest
void sendStopRequest(const T &event)
Definition: scanner_state_machine_def.h:172
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::isAcceptedReply
bool isAcceptedReply(data_conversion_layer::scanner_reply::Message const &msg)
Definition: scanner_state_machine_def.h:389
psen_scan_v2_standalone::protocol_layer::TimeoutCallback
std::function< void()> TimeoutCallback
Definition: scanner_state_machine.h:91
udp_client.h
config
config
psen_scan_v2_standalone::data_conversion_layer::start_request::Message
Higher level data type representing a scanner start request.
Definition: start_request.h:42
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::sendStartRequest
void sendStartRequest(const T &event)
Definition: scanner_state_machine_def.h:148
psen_scan_v2_standalone::protocol_layer::scanner_events::RawReplyReceived::data_
const data_conversion_layer::RawDataConstPtr data_
Definition: scanner_events.h:59
psen_scan_v2_standalone::protocol_layer::scanner_events
Contains the events needed to define and implement the scanner protocol.
Definition: scanner_events.h:30
psen_scan_v2_standalone::protocol_layer::ScanBuffer
Buffers and validates monitoring frames for a scan round.
Definition: scan_buffer.h:80
t
geometry_msgs::TransformStamped t
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::control_client_
communication_layer::UdpClientImpl control_client_
Definition: scanner_state_machine.h:293
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::notifyUserAboutStop
void notifyUserAboutStop(scanner_events::RawReplyReceived const &reply_event)
Definition: scanner_state_machine_def.h:206
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::isAcceptedStartReply
bool isAcceptedStartReply(scanner_events::RawReplyReceived const &reply_event)
Definition: scanner_state_machine_def.h:347
psen_scan_v2_standalone::ScannerConfiguration
Higher level data type storing the configuration details of the scanner like scanner IP,...
Definition: scanner_configuration.h:34


psen_scan_v2
Author(s): Pilz GmbH + Co. KG
autogenerated on Sat Jun 22 2024 02:46:12