Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef Class Reference

Definition of the scanner protocol. It is initialized using the StateMachineArgs class. More...

#include <scanner_state_machine.h>

Inheritance diagram for psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef:
Inheritance graph
[legend]

Classes

class  InternalScannerReplyError
 Exception thrown when something goes wrong with the scanner reply. More...
 
struct  transition_table
 Table describing the state machine which is specified in the scanner protocol. More...
 

Public Types

typedef Idle initial_state
 
typedef ScannerProtocolDef m
 

Public Member Functions

template<class FSM , class Event >
void exception_caught (Event const &event, FSM &fsm, std::exception &exception)
 
void handleMonitoringFrame (const scanner_events::RawMonitoringFrameReceived &event)
 
void handleMonitoringFrameTimeout (const scanner_events::MonitoringFrameTimeout &event)
 
void handleStartRequestTimeout (const scanner_events::StartTimeout &event)
 
bool isAcceptedStartReply (scanner_events::RawReplyReceived const &reply_event)
 
bool isAcceptedStopReply (scanner_events::RawReplyReceived const &reply_event)
 
bool isRefusedStartReply (scanner_events::RawReplyReceived const &reply_event)
 
bool isRefusedStopReply (scanner_events::RawReplyReceived const &reply_event)
 
bool isUnknownStartReply (scanner_events::RawReplyReceived const &reply_event)
 
bool isUnknownStopReply (scanner_events::RawReplyReceived const &reply_event)
 
template<class FSM , class Event >
void no_transition (Event const &event, FSM &, int state)
 
template<class FSM >
void no_transition (const scanner_events::RawMonitoringFrameReceived &, FSM &, int state)
 
void notifyUserAboutRefusedStartReply (scanner_events::RawReplyReceived const &reply_event)
 
void notifyUserAboutRefusedStopReply (scanner_events::RawReplyReceived const &reply_event)
 
void notifyUserAboutStart (scanner_events::RawReplyReceived const &reply_event)
 
void notifyUserAboutStop (scanner_events::RawReplyReceived const &reply_event)
 
void notifyUserAboutUnknownStartReply (scanner_events::RawReplyReceived const &reply_event)
 
void notifyUserAboutUnknownStopReply (scanner_events::RawReplyReceived const &reply_event)
 
 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)
 
template<class T >
void sendStartRequest (const T &event)
 
template<class T >
void sendStopRequest (const T &event)
 
 STATE (Idle)
 
 STATE (WaitForStartReply)
 
 STATE (WaitForMonitoringFrame)
 
 STATE (WaitForStopReply)
 
 STATE (Stopped)
 
 STATE (Error)
 

Private Member Functions

void checkForChangedActiveZoneset (const data_conversion_layer::monitoring_frame::Message &msg)
 
void checkForDiagnosticErrors (const data_conversion_layer::monitoring_frame::Message &msg)
 
void checkForInternalErrors (const data_conversion_layer::scanner_reply::Message &msg)
 
bool framesContainMeasurements (const std::vector< data_conversion_layer::monitoring_frame::MessageStamped > &stamped_msg)
 
void informUserAboutTheScanData (const data_conversion_layer::monitoring_frame::MessageStamped &stamped_msg)
 
bool isAcceptedReply (data_conversion_layer::scanner_reply::Message const &msg)
 
bool isRefusedReply (data_conversion_layer::scanner_reply::Message const &msg)
 
bool isStartReply (data_conversion_layer::scanner_reply::Message const &msg)
 
bool isStopReply (data_conversion_layer::scanner_reply::Message const &msg)
 
bool isUnknownReply (data_conversion_layer::scanner_reply::Message const &msg)
 
void sendMessageWithMeasurements (const std::vector< data_conversion_layer::monitoring_frame::MessageStamped > &stamped_msg)
 

Private Attributes

ScannerConfiguration config_
 
communication_layer::UdpClientImpl control_client_
 
communication_layer::UdpClientImpl data_client_
 
const InformUserAboutLaserScanCallback inform_user_about_laser_scan_callback_
 
const std::function< void()> monitoring_frame_timeout_callback_
 
std::unique_ptr< util::Watchdogmonitoring_frame_watchdog_ {}
 
ScanBuffer scan_buffer_ { DEFAULT_NUM_MSG_PER_ROUND }
 
const ScannerStartedCallback scanner_started_callback_
 
const ScannerStoppedCallback scanner_stopped_callback_
 
const StartErrorCallback start_error_callback_
 
std::unique_ptr< util::Watchdogstart_reply_watchdog_ {}
 
const std::function< void()> start_timeout_callback_
 
const StopErrorCallback stop_error_callback_
 
WatchdogFactory watchdog_factory_ {}
 
boost::optional< data_conversion_layer::monitoring_frame::Messagezoneset_reference_msg_
 

Detailed Description

Definition of the scanner protocol. It is initialized using the StateMachineArgs class.

This class interacts with UdpClientImpl in order to perform its actions. These include sending a start request, a stop request and handling incoming messages such as a start reply, a stop reply and a monitoring frame.

Precisely, the StateMachineArgs::control_client_ is used for the starting-/stopping procedure and the StateMachineArgs::data_client_ for receiving monitoring frames.

It also checks for internal errors of incoming messages and handles timeouts of the above mentioned actions by creating watchdogs via IWatchdogFactory.

See also
data_conversion_layer::start_request::Message
data_conversion_layer::stop_request
data_conversion_layer::scanner_reply::Message
data_conversion_layer::monitoring_frame::Message

Definition at line 145 of file scanner_state_machine.h.

Member Typedef Documentation

◆ initial_state

Definition at line 204 of file scanner_state_machine.h.

◆ m

Definition at line 205 of file scanner_state_machine.h.

Constructor & Destructor Documentation

◆ ScannerProtocolDef()

psen_scan_v2_standalone::protocol_layer::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 
)
inline

Definition at line 23 of file scanner_state_machine_def.h.

Member Function Documentation

◆ checkForChangedActiveZoneset()

void psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::checkForChangedActiveZoneset ( const data_conversion_layer::monitoring_frame::Message msg)
inlineprivate
Exceptions
data_conversion_layer::monitoring_frame::AdditionalFieldMissingif scan_counter or active_zoneset is not set.

Definition at line 238 of file scanner_state_machine_def.h.

◆ checkForDiagnosticErrors()

void psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::checkForDiagnosticErrors ( const data_conversion_layer::monitoring_frame::Message msg)
inlineprivate

Definition at line 228 of file scanner_state_machine_def.h.

◆ checkForInternalErrors()

void psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::checkForInternalErrors ( const data_conversion_layer::scanner_reply::Message msg)
inlineprivate

Definition at line 318 of file scanner_state_machine_def.h.

◆ exception_caught()

template<class FSM , class Event >
void psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::exception_caught ( Event const &  event,
FSM &  fsm,
std::exception &  exception 
)

Definition at line 430 of file scanner_state_machine_def.h.

◆ framesContainMeasurements()

bool psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::framesContainMeasurements ( const std::vector< data_conversion_layer::monitoring_frame::MessageStamped > &  stamped_msg)
inlineprivate
Exceptions
data_conversion_layer::monitoring_frame::AdditionalFieldMissingif measurements is not set in one of the msgs.

Definition at line 287 of file scanner_state_machine_def.h.

◆ handleMonitoringFrame()

void psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::handleMonitoringFrame ( const scanner_events::RawMonitoringFrameReceived event)
inline

Definition at line 171 of file scanner_state_machine_def.h.

◆ handleMonitoringFrameTimeout()

void psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::handleMonitoringFrameTimeout ( const scanner_events::MonitoringFrameTimeout event)
inline

Definition at line 300 of file scanner_state_machine_def.h.

◆ handleStartRequestTimeout()

void psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::handleStartRequestTimeout ( const scanner_events::StartTimeout event)
inline

Definition at line 154 of file scanner_state_machine_def.h.

◆ informUserAboutTheScanData()

void psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::informUserAboutTheScanData ( const data_conversion_layer::monitoring_frame::MessageStamped stamped_msg)
inlineprivate
Exceptions
data_conversion_layer::monitoring_frame::AdditionalFieldMissingif scan_counter, active_zoneset or measurements is not set.

Definition at line 248 of file scanner_state_machine_def.h.

◆ isAcceptedReply()

bool psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::isAcceptedReply ( data_conversion_layer::scanner_reply::Message const &  msg)
inlineprivate

Definition at line 381 of file scanner_state_machine_def.h.

◆ isAcceptedStartReply()

bool psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::isAcceptedStartReply ( scanner_events::RawReplyReceived const &  reply_event)
inline

Definition at line 339 of file scanner_state_machine_def.h.

◆ isAcceptedStopReply()

bool psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::isAcceptedStopReply ( scanner_events::RawReplyReceived const &  reply_event)
inline

Definition at line 360 of file scanner_state_machine_def.h.

◆ isRefusedReply()

bool psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::isRefusedReply ( data_conversion_layer::scanner_reply::Message const &  msg)
inlineprivate

Definition at line 391 of file scanner_state_machine_def.h.

◆ isRefusedStartReply()

bool psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::isRefusedStartReply ( scanner_events::RawReplyReceived const &  reply_event)
inline

Definition at line 353 of file scanner_state_machine_def.h.

◆ isRefusedStopReply()

bool psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::isRefusedStopReply ( scanner_events::RawReplyReceived const &  reply_event)
inline

Definition at line 374 of file scanner_state_machine_def.h.

◆ isStartReply()

bool psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::isStartReply ( data_conversion_layer::scanner_reply::Message const &  msg)
inlineprivate

Definition at line 396 of file scanner_state_machine_def.h.

◆ isStopReply()

bool psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::isStopReply ( data_conversion_layer::scanner_reply::Message const &  msg)
inlineprivate

Definition at line 401 of file scanner_state_machine_def.h.

◆ isUnknownReply()

bool psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::isUnknownReply ( data_conversion_layer::scanner_reply::Message const &  msg)
inlineprivate

Definition at line 386 of file scanner_state_machine_def.h.

◆ isUnknownStartReply()

bool psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::isUnknownStartReply ( scanner_events::RawReplyReceived const &  reply_event)
inline

Definition at line 346 of file scanner_state_machine_def.h.

◆ isUnknownStopReply()

bool psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::isUnknownStopReply ( scanner_events::RawReplyReceived const &  reply_event)
inline

Definition at line 367 of file scanner_state_machine_def.h.

◆ no_transition() [1/2]

template<class FSM , class Event >
void psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::no_transition ( Event const &  event,
FSM &  ,
int  state 
)

Definition at line 439 of file scanner_state_machine_def.h.

◆ no_transition() [2/2]

template<class FSM >
void psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::no_transition ( const scanner_events::RawMonitoringFrameReceived ,
FSM &  ,
int  state 
)

Definition at line 448 of file scanner_state_machine_def.h.

◆ notifyUserAboutRefusedStartReply()

void psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::notifyUserAboutRefusedStartReply ( scanner_events::RawReplyReceived const &  reply_event)
inline

Definition at line 211 of file scanner_state_machine_def.h.

◆ notifyUserAboutRefusedStopReply()

void psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::notifyUserAboutRefusedStopReply ( scanner_events::RawReplyReceived const &  reply_event)
inline

Definition at line 223 of file scanner_state_machine_def.h.

◆ notifyUserAboutStart()

void psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::notifyUserAboutStart ( scanner_events::RawReplyReceived const &  reply_event)
inline

Definition at line 193 of file scanner_state_machine_def.h.

◆ notifyUserAboutStop()

void psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::notifyUserAboutStop ( scanner_events::RawReplyReceived const &  reply_event)
inline

Definition at line 198 of file scanner_state_machine_def.h.

◆ notifyUserAboutUnknownStartReply()

void psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::notifyUserAboutUnknownStartReply ( scanner_events::RawReplyReceived const &  reply_event)
inline

Definition at line 203 of file scanner_state_machine_def.h.

◆ notifyUserAboutUnknownStopReply()

void psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::notifyUserAboutUnknownStopReply ( scanner_events::RawReplyReceived const &  reply_event)
inline

Definition at line 216 of file scanner_state_machine_def.h.

◆ sendMessageWithMeasurements()

void psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::sendMessageWithMeasurements ( const std::vector< data_conversion_layer::monitoring_frame::MessageStamped > &  stamped_msg)
inlineprivate
Exceptions
data_conversion_layer::monitoring_frame::AdditionalFieldMissingif scan_counter, active_zoneset or measurements is not set in one of the msgs.

Definition at line 269 of file scanner_state_machine_def.h.

◆ sendStartRequest()

template<class T >
void psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::sendStartRequest ( const T &  event)
inline

Definition at line 140 of file scanner_state_machine_def.h.

◆ sendStopRequest()

template<class T >
void psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::sendStopRequest ( const T &  event)
inline

Definition at line 164 of file scanner_state_machine_def.h.

◆ STATE() [1/6]

psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::STATE ( Idle  )

◆ STATE() [2/6]

psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::STATE ( WaitForStartReply  )

◆ STATE() [3/6]

psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::STATE ( WaitForMonitoringFrame  )

◆ STATE() [4/6]

psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::STATE ( WaitForStopReply  )

◆ STATE() [5/6]

psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::STATE ( Stopped  )

◆ STATE() [6/6]

psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::STATE ( Error  )

Member Data Documentation

◆ config_

ScannerConfiguration psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::config_
private

Definition at line 279 of file scanner_state_machine.h.

◆ control_client_

communication_layer::UdpClientImpl psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::control_client_
private

Definition at line 288 of file scanner_state_machine.h.

◆ data_client_

communication_layer::UdpClientImpl psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::data_client_
private

Definition at line 289 of file scanner_state_machine.h.

◆ inform_user_about_laser_scan_callback_

const InformUserAboutLaserScanCallback psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::inform_user_about_laser_scan_callback_
private

Definition at line 296 of file scanner_state_machine.h.

◆ monitoring_frame_timeout_callback_

const std::function<void()> psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::monitoring_frame_timeout_callback_
private

Definition at line 300 of file scanner_state_machine.h.

◆ monitoring_frame_watchdog_

std::unique_ptr<util::Watchdog> psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::monitoring_frame_watchdog_ {}
private

Definition at line 283 of file scanner_state_machine.h.

◆ scan_buffer_

ScanBuffer psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::scan_buffer_ { DEFAULT_NUM_MSG_PER_ROUND }
private

Definition at line 284 of file scanner_state_machine.h.

◆ scanner_started_callback_

const ScannerStartedCallback psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::scanner_started_callback_
private

Definition at line 292 of file scanner_state_machine.h.

◆ scanner_stopped_callback_

const ScannerStoppedCallback psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::scanner_stopped_callback_
private

Definition at line 293 of file scanner_state_machine.h.

◆ start_error_callback_

const StartErrorCallback psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::start_error_callback_
private

Definition at line 294 of file scanner_state_machine.h.

◆ start_reply_watchdog_

std::unique_ptr<util::Watchdog> psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::start_reply_watchdog_ {}
private

Definition at line 281 of file scanner_state_machine.h.

◆ start_timeout_callback_

const std::function<void()> psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::start_timeout_callback_
private

Definition at line 299 of file scanner_state_machine.h.

◆ stop_error_callback_

const StopErrorCallback psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::stop_error_callback_
private

Definition at line 295 of file scanner_state_machine.h.

◆ watchdog_factory_

WatchdogFactory psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::watchdog_factory_ {}
private

Definition at line 303 of file scanner_state_machine.h.

◆ zoneset_reference_msg_

boost::optional<data_conversion_layer::monitoring_frame::Message> psen_scan_v2_standalone::protocol_layer::ScannerProtocolDef::zoneset_reference_msg_
private

Definition at line 285 of file scanner_state_machine.h.


The documentation for this class was generated from the following files:


psen_scan_v2
Author(s): Pilz GmbH + Co. KG
autogenerated on Sat Nov 5 2022 02:13:36