scanner_frames.h
Go to the documentation of this file.
1 // Copyright (c) 2019 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_FRAMES_H
17 #define PSEN_SCAN_SCANNER_FRAMES_H
18 
19 #include <cstdint>
20 #include <array>
21 
23 
24 namespace psen_scan
25 {
26 #pragma pack(push, 1) // Don't allow padding
27 
32 typedef struct StartMonitoringFrame
33 {
34  uint32_t crc_;
35  uint32_t const RESERVED_;
36  char password_[8];
37  uint32_t const OPCODE_;
38  uint32_t host_ip_;
39  uint32_t host_udp_port_;
40  uint64_t const FIXED_SEQUENCE_;
41  std::array<uint16_t, 12> const RESERVED2_;
43  StartMonitoringFrame(const std::string& password = "",
44  const uint32_t& host_ip = 0,
45  const uint32_t& host_udp_port = 0);
46 
48 
53 typedef struct StopMonitoringFrame
54 {
55  uint32_t crc_;
56  uint32_t const RESERVED_;
57  char password_[8];
58  uint32_t const OPCODE_;
60  StopMonitoringFrame(const std::string& password = "");
61 
63 
68 typedef struct PhysicalInputs
69 {
70  uint32_t time_stamp_;
71  std::array<uint8_t, 10> input_signals_;
73 
78 typedef struct LogicalInputs
79 {
80  uint32_t time_stamp_;
81  std::array<uint8_t, 8> input_signals_;
83 
88 typedef struct InputStateArea
89 {
90  std::array<PhysicalInputs, 3> physical_inputs_;
93 
98 typedef struct OutputStateArea
99 {
100  uint32_t time_stamp_;
101  uint32_t outputs_;
103 
108 typedef struct DiagnosticInformation
109 {
110  uint8_t internal_error_1_ : 5;
113  uint8_t ossd1_short_circuit_ : 1;
114 
115  uint8_t : 2;
116  uint8_t internal_error_2_ : 2;
118  uint8_t network_problem_ : 1;
121 
125  uint8_t incoherence_data_ : 1;
126  uint8_t internal_error_3_ : 3;
127  uint8_t measure_problem_ : 1;
128 
130  uint8_t internal_error_5_ : 2;
132  uint8_t generic_error_ : 1;
133  uint8_t internal_error_4_ : 2;
135 
137  uint8_t out_of_range_error_ : 1;
138  uint8_t configuration_error_ : 1;
139  uint8_t : 5;
140 
141  std::array<uint8_t, 15> unused;
143 
148 typedef struct DiagnosticArea
149 {
150  uint32_t time_stamp_;
153 
158 typedef struct MonitoringFrame
159 {
160  uint32_t device_status_;
161  uint32_t opcode_;
162  uint32_t working_mode_;
163  uint32_t transaction_type_;
167  uint8_t scanner_id_;
168  uint8_t resolution_;
171  uint16_t from_theta_;
176  std::array<uint16_t, 550> measures_;
179  uint32_t scan_counter_;
181  {
182  return PSENscanInternalAngle(from_theta_ + static_cast<uint16_t>(resolution_) * number_of_samples_);
183  }
185 
186 #pragma pack(pop)
187 } // namespace psen_scan
188 
189 #endif // PSEN_SCAN_SCANNER_FRAMES_H
DiagnosticInformation diagnostic_information_
Frame containing all necessary fields for a Start Monitoring Command.
std::array< uint16_t, 550 > measures_
DiagnosticInformation Bitfield for DiagnosticArea.
std::array< uint16_t, 12 > const RESERVED2_
MonitoringFrame as coming from Laserscanner.
OutputStateArea Field for MonitoringFrame.
struct psen_scan::DiagnosticInformation DiagnosticInformation
DiagnosticInformation Bitfield for DiagnosticArea.
OutputStateArea output_state_area_
struct psen_scan::OutputStateArea OutputStateArea
OutputStateArea Field for MonitoringFrame.
Logical Inputs Field for InputStateArea.
InputStateArea Field for MonitoringFrame.
struct psen_scan::DiagnosticArea DiagnosticArea
DiagnosticArea Field for MonitoringFrame.
struct psen_scan::LogicalInputs LogicalInputs
Logical Inputs Field for InputStateArea.
std::array< uint8_t, 15 > unused
DiagnosticArea diagnostic_area_
std::array< uint8_t, 8 > input_signals_
DiagnosticArea Field for MonitoringFrame.
std::array< PhysicalInputs, 3 > physical_inputs_
StartMonitoringFrame(const std::string &password="", const uint32_t &host_ip=0, const uint32_t &host_udp_port=0)
Construct a new Start Monitoring Frame:: Start Monitoring Frame object.
Frame containing all necessary fields for a Stop Monitoring Command.
struct psen_scan::MonitoringFrame MonitoringFrame
MonitoringFrame as coming from Laserscanner.
struct psen_scan::StopMonitoringFrame StopMonitoringFrame
Frame containing all necessary fields for a Stop Monitoring Command.
std::array< uint8_t, 10 > input_signals_
struct psen_scan::InputStateArea InputStateArea
InputStateArea Field for MonitoringFrame.
PSENscanInternalAngle to_theta() const
Class to model angles in PSENscan internal format (tenth of degrees)
Physical Inputs Field for InputStateArea.
InputStateArea input_state_area_
struct psen_scan::PhysicalInputs PhysicalInputs
Physical Inputs Field for InputStateArea.
LogicalInputs logical_inputs_


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