start_request.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 #ifndef PSEN_SCAN_V2_STANDALONE_START_REQUEST_H
16 #define PSEN_SCAN_V2_STANDALONE_START_REQUEST_H
17 
18 #include <array>
19 #include <cstdint>
20 
24 
26 {
27 class ScannerConfiguration;
28 
29 namespace data_conversion_layer
30 {
34 namespace start_request
35 {
42 class Message
43 {
44 public:
45  Message(const ScannerConfiguration& scanner_configuration);
46 
48  const uint32_t& seq_number);
49 
50 private:
57  {
58  public:
59  constexpr LaserScanSettings() = default;
60  constexpr LaserScanSettings(const ScanRange& scan_range, const util::TenthOfDegree& resolution);
61 
62  public:
63  constexpr const ScanRange& scanRange() const;
64  constexpr util::TenthOfDegree resolution() const;
65 
66  private:
69  };
70 
75  {
76  public:
77  constexpr DeviceSettings(const bool diagnostics_enabled,
78  const bool intensities_enabled,
79  const uint8_t nr_subscribers);
80 
81  public:
82  constexpr bool diagnosticsEnabled() const;
83  constexpr bool intensitiesEnabled() const;
84  constexpr uint8_t nrSubscribers() const;
85 
86  private:
89  const uint8_t nr_subscribers_;
90  };
91 
92 private:
93  static constexpr std::size_t NUM_SUBSCRIBERS{ 3 };
94 
95 private:
96  const uint32_t host_ip_;
97  const uint16_t host_udp_port_data_;
98 
101  const std::array<LaserScanSettings, NUM_SUBSCRIBERS> subscribers_; // Note: This refers to the scanner type
102  // subscriber, *not* a ros subscriber
103 };
104 
106  const util::TenthOfDegree& resolution)
107  : scan_range_(scan_range), resolution_(resolution)
108 {
109 }
110 
112 {
113  return scan_range_;
114 };
115 
117 {
118  return resolution_;
119 };
120 
121 constexpr Message::DeviceSettings::DeviceSettings(const bool diagnostics_enabled,
122  const bool intensities_enabled,
123  const uint8_t nr_subscribers)
124  : diagnostics_enabled_(diagnostics_enabled)
125  , intensities_enabled_(intensities_enabled)
126  , nr_subscribers_(nr_subscribers)
127 {
128 }
129 
131 {
132  return diagnostics_enabled_;
133 };
134 
136 {
137  return intensities_enabled_;
138 };
139 
140 constexpr uint8_t Message::DeviceSettings::nrSubscribers() const
141 {
142  return nr_subscribers_;
143 };
144 
145 } // namespace start_request
146 } // namespace data_conversion_layer
147 } // namespace psen_scan_v2_standalone
148 
149 #endif // PSEN_SCAN_V2_STANDALONE_START_REQUEST_H
scan_range.h
psen_scan_v2_standalone::data_conversion_layer::start_request::Message::LaserScanSettings::scanRange
constexpr const ScanRange & scanRange() const
Definition: start_request.h:111
psen_scan_v2_standalone::data_conversion_layer::start_request::Message::master_device_settings_
const DeviceSettings master_device_settings_
Definition: start_request.h:99
psen_scan_v2_standalone::data_conversion_layer::start_request::Message::DeviceSettings::diagnosticsEnabled
constexpr bool diagnosticsEnabled() const
Definition: start_request.h:130
psen_scan_v2_standalone::data_conversion_layer::start_request::Message::LaserScanSettings::resolution_
const util::TenthOfDegree resolution_
Definition: start_request.h:68
psen_scan_v2_standalone::data_conversion_layer::start_request::Message::serialize
friend data_conversion_layer::RawData serialize(const data_conversion_layer::start_request::Message &msg, const uint32_t &seq_number)
psen_scan_v2_standalone::data_conversion_layer::start_request::Message::DeviceSettings::nr_subscribers_
const uint8_t nr_subscribers_
Definition: start_request.h:89
tenth_of_degree.h
psen_scan_v2_standalone::data_conversion_layer::start_request::Message::DeviceSettings::nrSubscribers
constexpr uint8_t nrSubscribers() const
Definition: start_request.h:140
psen_scan_v2_standalone::data_conversion_layer::start_request::Message::subscribers_
const std::array< LaserScanSettings, NUM_SUBSCRIBERS > subscribers_
Definition: start_request.h:101
psen_scan_v2_standalone::data_conversion_layer::start_request::Message::DeviceSettings::intensities_enabled_
const bool intensities_enabled_
Definition: start_request.h:88
psen_scan_v2_standalone::data_conversion_layer::start_request::Message::host_udp_port_data_
const uint16_t host_udp_port_data_
Definition: start_request.h:97
psen_scan_v2_standalone::data_conversion_layer::start_request::Message::DeviceSettings::intensitiesEnabled
constexpr bool intensitiesEnabled() const
Definition: start_request.h:135
raw_scanner_data.h
psen_scan_v2_standalone::data_conversion_layer::start_request::Message::LaserScanSettings::scan_range_
const ScanRange scan_range_
Definition: start_request.h:67
psen_scan_v2_standalone::data_conversion_layer::start_request::Message::DeviceSettings
Class describing the fundamental settings of the master and subscriber devices, like id and diagnosti...
Definition: start_request.h:74
psen_scan_v2_standalone::data_conversion_layer::start_request::Message::host_ip_
const uint32_t host_ip_
network byte order = big endian
Definition: start_request.h:96
psen_scan_v2_standalone::data_conversion_layer::start_request::Message::DeviceSettings::DeviceSettings
constexpr DeviceSettings(const bool diagnostics_enabled, const bool intensities_enabled, const uint8_t nr_subscribers)
Definition: start_request.h:121
psen_scan_v2_standalone::data_conversion_layer::start_request::Message::master_
const LaserScanSettings master_
Definition: start_request.h:100
psen_scan_v2_standalone::data_conversion_layer::start_request::Message::LaserScanSettings::resolution
constexpr util::TenthOfDegree resolution() const
Definition: start_request.h:116
psen_scan_v2_standalone::data_conversion_layer::start_request::Message::NUM_SUBSCRIBERS
static constexpr std::size_t NUM_SUBSCRIBERS
Definition: start_request.h:93
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::data_conversion_layer::start_request::Message::LaserScanSettings::LaserScanSettings
constexpr LaserScanSettings()=default
psen_scan_v2_standalone::data_conversion_layer::start_request::Message::Message
Message(const ScannerConfiguration &scanner_configuration)
Definition: start_request.cpp:26
psen_scan_v2_standalone::ScanRangeTemplated
Higher level data type storing the range in which the scanner takes measurements.
Definition: scan_range.h:31
psen_scan_v2_standalone::data_conversion_layer::RawData
std::vector< char > RawData
Definition: raw_scanner_data.h:25
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::util::TenthOfDegree
Helper class representing angles in tenth of degree.
Definition: tenth_of_degree.h:34
psen_scan_v2_standalone::data_conversion_layer::start_request::Message::LaserScanSettings
Class describing the scan settings of the master and subscriber devices.
Definition: start_request.h:56
psen_scan_v2_standalone::data_conversion_layer::start_request::Message::DeviceSettings::diagnostics_enabled_
const bool diagnostics_enabled_
Definition: start_request.h:87
psen_scan_v2_standalone::ScanRangeTemplated::createInvalidScanRange
static constexpr ScanRangeTemplated< min_allowed_angle, max_allowed_angle > createInvalidScanRange()
Definition: scan_range.h:88
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