scanner_configuration.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_SCANNER_CONFIGURATION_H
16 #define PSEN_SCAN_V2_STANDALONE_SCANNER_CONFIGURATION_H
17 
18 #include <boost/optional.hpp>
19 
23 
25 {
35 {
36 private:
37  ScannerConfiguration() = default;
38 
39 public:
40  boost::optional<uint32_t> hostIp() const;
41  uint16_t hostUDPPortData() const;
42  uint16_t hostUDPPortControl() const;
43 
44  uint32_t clientIp() const;
45  uint16_t scannerDataPort() const;
46  uint16_t scannerControlPort() const;
47 
48  const ScanRange& scanRange() const;
49  const util::TenthOfDegree& scanResolution() const;
50 
51  bool diagnosticsEnabled() const;
52  bool intensitiesEnabled() const;
53 
54  bool fragmentedScansEnabled() const;
55  uint8_t nrSubscribers() const;
56 
58  [[deprecated("use void hostIp(const uint32_t& host_ip) instead")]] void setHostIp(const uint32_t& host_ip);
59  void hostIp(const uint32_t& host_ip);
60 
61 private:
63 
64 private:
65  bool isComplete() const;
66  bool isValid() const;
67 
68 private:
69  boost::optional<uint32_t> host_ip_;
72 
73  boost::optional<uint32_t> scanner_ip_;
76 
77  boost::optional<ScanRange> scan_range_{};
84 };
85 
87 {
88  return scanner_ip_ && scan_range_;
89 }
90 
91 inline bool ScannerConfiguration::isValid() const
92 {
94  {
95  PSENSCAN_ERROR("ScannerConfiguration", "Requires a resolution of min: 0.2 degree when intensities are enabled");
96  return false;
97  }
98  return true;
99 }
100 
101 inline boost::optional<uint32_t> ScannerConfiguration::hostIp() const
102 {
103  return host_ip_;
104 }
105 
107 {
108  return host_data_port_;
109 }
110 
112 {
113  return host_control_port_;
114 }
115 
116 inline uint32_t ScannerConfiguration::clientIp() const
117 {
118  return *scanner_ip_;
119 }
120 
122 {
123  return scanner_data_port_;
124 }
125 
127 {
128  return scanner_control_port_;
129 }
130 
132 {
133  return *scan_range_;
134 }
135 
137 {
138  return scan_resolution_;
139 }
140 
142 {
143  return diagnostics_enabled_;
144 }
145 
147 {
148  return intensities_enabled_;
149 }
150 
152 {
153  return fragmented_scans_;
154 }
155 
157 {
158  return nr_subscribers_;
159 }
160 
161 inline void ScannerConfiguration::hostIp(const uint32_t& host_ip)
162 {
163  host_ip_ = host_ip;
164 }
165 
166 inline void ScannerConfiguration::setHostIp(const uint32_t& host_ip)
167 {
168  this->hostIp(host_ip);
169 }
170 
171 } // namespace psen_scan_v2_standalone
172 
173 #endif // PSEN_SCAN_V2_STANDALONE_SCANNER_CONFIGURATION_H
psen_scan_v2_standalone::configuration::DATA_PORT_OF_HOST_DEVICE
static constexpr unsigned short DATA_PORT_OF_HOST_DEVICE
Definition: default_parameters.h:32
psen_scan_v2_standalone::ScannerConfiguration::hostUDPPortData
uint16_t hostUDPPortData() const
Definition: scanner_configuration.h:106
scan_range.h
psen_scan_v2_standalone::ScannerConfiguration::intensitiesEnabled
bool intensitiesEnabled() const
Definition: scanner_configuration.h:146
psen_scan_v2_standalone::ScannerConfiguration::scannerDataPort
uint16_t scannerDataPort() const
Definition: scanner_configuration.h:121
psen_scan_v2_standalone::ScannerConfiguration::scanner_control_port_
uint16_t scanner_control_port_
Definition: scanner_configuration.h:75
psen_scan_v2_standalone::data_conversion_layer::radToTenthDegree
static int16_t radToTenthDegree(const double &angle_in_rad)
Definition: angle_conversions.h:51
psen_scan_v2_standalone::configuration::DEFAULT_SCAN_ANGLE_RESOLUTION
static constexpr double DEFAULT_SCAN_ANGLE_RESOLUTION(data_conversion_layer::degreeToRadian(0.1))
psen_scan_v2_standalone::ScannerConfiguration::scanner_ip_
boost::optional< uint32_t > scanner_ip_
Definition: scanner_configuration.h:73
psen_scan_v2_standalone::ScannerConfiguration::fragmented_scans_
bool fragmented_scans_
Definition: scanner_configuration.h:82
psen_scan_v2_standalone::ScannerConfiguration::scannerControlPort
uint16_t scannerControlPort() const
Definition: scanner_configuration.h:126
psen_scan_v2_standalone::configuration::CONTROL_PORT_OF_HOST_DEVICE
static constexpr unsigned short CONTROL_PORT_OF_HOST_DEVICE
Definition: default_parameters.h:33
psen_scan_v2_standalone::ScannerConfiguration::host_ip_
boost::optional< uint32_t > host_ip_
Definition: scanner_configuration.h:69
psen_scan_v2_standalone::ScannerConfiguration::diagnostics_enabled_
bool diagnostics_enabled_
Definition: scanner_configuration.h:80
psen_scan_v2_standalone::configuration::INTENSITIES
static constexpr bool INTENSITIES
Definition: default_parameters.h:36
psen_scan_v2_standalone::ScannerConfiguration::ScannerConfiguration
ScannerConfiguration()=default
psen_scan_v2_standalone::configuration::CONTROL_PORT_OF_SCANNER_DEVICE
static constexpr unsigned short CONTROL_PORT_OF_SCANNER_DEVICE
Definition: default_parameters.h:30
psen_scan_v2_standalone::ScannerConfiguration::scanRange
const ScanRange & scanRange() const
Definition: scanner_configuration.h:131
psen_scan_v2_standalone::ScannerConfiguration::diagnosticsEnabled
bool diagnosticsEnabled() const
Definition: scanner_configuration.h:141
psen_scan_v2_standalone::ScannerConfiguration::nrSubscribers
uint8_t nrSubscribers() const
Definition: scanner_configuration.h:156
psen_scan_v2_standalone::ScannerConfiguration::clientIp
uint32_t clientIp() const
Definition: scanner_configuration.h:116
psen_scan_v2_standalone::ScannerConfiguration::isComplete
bool isComplete() const
Definition: scanner_configuration.h:86
psen_scan_v2_standalone::ScannerConfiguration::scan_resolution_
util::TenthOfDegree scan_resolution_
Definition: scanner_configuration.h:78
psen_scan_v2_standalone::ScannerConfiguration::scanResolution
const util::TenthOfDegree & scanResolution() const
Definition: scanner_configuration.h:136
psen_scan_v2_standalone::ScannerConfiguration::scanner_data_port_
uint16_t scanner_data_port_
Definition: scanner_configuration.h:74
psen_scan_v2_standalone::ScannerConfiguration::hostIp
boost::optional< uint32_t > hostIp() const
Definition: scanner_configuration.h:101
default_parameters.h
psen_scan_v2_standalone::configuration::DIAGNOSTICS
static constexpr bool DIAGNOSTICS
Definition: default_parameters.h:37
psen_scan_v2_standalone::ScannerConfigurationBuilder
Helper class to simplify/improve the construction of the psen_scan_v2_standalone::ScannerConfiguratio...
Definition: scanner_config_builder.h:35
psen_scan_v2_standalone::ScannerConfiguration::fragmentedScansEnabled
bool fragmentedScansEnabled() const
Definition: scanner_configuration.h:151
logging.h
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::ScannerConfiguration::setHostIp
void setHostIp(const uint32_t &host_ip)
Definition: scanner_configuration.h:166
psen_scan_v2_standalone::ScannerConfiguration::scan_range_
boost::optional< ScanRange > scan_range_
Definition: scanner_configuration.h:77
PSENSCAN_ERROR
#define PSENSCAN_ERROR(name,...)
Definition: logging.h:60
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::configuration::NR_SUBSCRIBERS
static constexpr unsigned short NR_SUBSCRIBERS
Definition: default_parameters.h:50
psen_scan_v2_standalone::configuration::DATA_PORT_OF_SCANNER_DEVICE
static constexpr unsigned short DATA_PORT_OF_SCANNER_DEVICE
Definition: default_parameters.h:29
psen_scan_v2_standalone::ScannerConfiguration::host_control_port_
uint16_t host_control_port_
Definition: scanner_configuration.h:71
psen_scan_v2_standalone::configuration::FRAGMENTED_SCANS
static constexpr bool FRAGMENTED_SCANS
Definition: default_parameters.h:35
psen_scan_v2_standalone::util::TenthOfDegree
Helper class representing angles in tenth of degree.
Definition: tenth_of_degree.h:34
psen_scan_v2_standalone::ScannerConfiguration::intensities_enabled_
bool intensities_enabled_
Definition: scanner_configuration.h:81
psen_scan_v2_standalone::ScannerConfiguration::nr_subscribers_
uint8_t nr_subscribers_
Definition: scanner_configuration.h:83
psen_scan_v2_standalone::ScannerConfiguration::host_data_port_
uint16_t host_data_port_
Definition: scanner_configuration.h:70
psen_scan_v2_standalone::ScannerConfiguration::hostUDPPortControl
uint16_t hostUDPPortControl() const
Definition: scanner_configuration.h:111
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_standalone::ScannerConfiguration::isValid
bool isValid() const
Definition: scanner_configuration.h:91


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