scanner.h
Go to the documentation of this file.
1 // Copyright (c) 2019-2020 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 
16 #ifndef PSEN_SCAN_SCANNER_H
17 #define PSEN_SCAN_SCANNER_H
18 
19 #include <memory>
20 
23 #include "psen_scan/laserscan.h"
24 
25 namespace psen_scan
26 {
27 // LCOV_EXCL_START
28 class vScanner
29 {
30 public:
31  virtual ~vScanner() = default;
32  virtual void start() = 0;
33  virtual void stop() = 0;
34  virtual LaserScan getCompleteScan() = 0;
35 };
36 // LCOV_EXCL_STOP
37 
42 class Scanner : public vScanner
43 {
44 public:
45  Scanner(const std::string& scanner_ip,
46  const uint32_t& host_ip,
47  const uint32_t& host_udp_port,
48  const std::string& password,
49  const PSENscanInternalAngle& angle_start,
50  const PSENscanInternalAngle& angle_end,
51  std::unique_ptr<ScannerCommunicationInterface> communication_interface);
52 
53  void start();
54  void stop();
56 
57 private:
58  std::string scanner_ip_;
64  std::unique_ptr<ScannerCommunicationInterface> communication_interface_;
65 
66 private:
67  MonitoringFrame fetchMonitoringFrame(std::chrono::steady_clock::duration timeout);
68  bool isDiagnosticInformationOk(const DiagnosticInformation& diag_info);
69  bool parseFields(const MonitoringFrame& monitoring_frame);
70 };
71 
72 } // namespace psen_scan
73 
74 #endif // PSEN_SCAN_SCANNER_H
Frame containing all necessary fields for a Start Monitoring Command.
std::string scanner_ip_
Definition: scanner.h:58
virtual ~vScanner()=default
DiagnosticInformation Bitfield for DiagnosticArea.
virtual void stop()=0
MonitoringFrame as coming from Laserscanner.
StopMonitoringFrame stop_monitoring_frame_
Definition: scanner.h:60
Class to hold the data for one laserscan without depencies to ROS.
Definition: laserscan.h:29
MonitoringFrame previous_monitoring_frame_
Definition: scanner.h:63
virtual LaserScan getCompleteScan()=0
Frame containing all necessary fields for a Stop Monitoring Command.
Class for Modeling a PSENscan safety laser scanner.
Definition: scanner.h:42
PSENscanInternalAngle angle_end_
Definition: scanner.h:62
Class to model angles in PSENscan internal format (tenth of degrees)
virtual void start()=0
PSENscanInternalAngle angle_start_
Definition: scanner.h:61
StartMonitoringFrame start_monitoring_frame_
Definition: scanner.h:59
std::unique_ptr< ScannerCommunicationInterface > communication_interface_
Definition: scanner.h:64


psen_scan
Author(s):
autogenerated on Mon Feb 28 2022 23:16:20