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 
57  [[deprecated("use void hostIp(const uint32_t& host_ip) instead")]] void setHostIp(const uint32_t& host_ip);
58  void hostIp(const uint32_t& host_ip);
59 
60 private:
62 
63 private:
64  bool isComplete() const;
65  bool isValid() const;
66 
67 private:
68  boost::optional<uint32_t> host_ip_;
71 
72  boost::optional<uint32_t> scanner_ip_;
75 
76  boost::optional<ScanRange> scan_range_{};
82 };
83 
85 {
86  return scanner_ip_ && scan_range_;
87 }
88 
89 inline bool ScannerConfiguration::isValid() const
90 {
92  {
93  PSENSCAN_ERROR("ScannerConfiguration", "Requires a resolution of min: 0.2 degree when intensities are enabled");
94  return false;
95  }
96  return true;
97 }
98 
99 inline boost::optional<uint32_t> ScannerConfiguration::hostIp() const
100 {
101  return host_ip_;
102 }
103 
105 {
106  return host_data_port_;
107 }
108 
110 {
111  return host_control_port_;
112 }
113 
114 inline uint32_t ScannerConfiguration::clientIp() const
115 {
116  return *scanner_ip_;
117 }
118 
120 {
121  return scanner_data_port_;
122 }
123 
125 {
126  return scanner_control_port_;
127 }
128 
130 {
131  return *scan_range_;
132 }
133 
135 {
136  return scan_resolution_;
137 }
138 
140 {
141  return diagnostics_enabled_;
142 }
143 
145 {
146  return intensities_enabled_;
147 }
148 
150 {
151  return fragmented_scans_;
152 }
153 
154 inline void ScannerConfiguration::hostIp(const uint32_t& host_ip)
155 {
156  host_ip_ = host_ip;
157 }
158 
159 inline void ScannerConfiguration::setHostIp(const uint32_t& host_ip)
160 {
161  this->hostIp(host_ip);
162 }
163 
164 } // namespace psen_scan_v2_standalone
165 
166 #endif // PSEN_SCAN_V2_STANDALONE_SCANNER_CONFIGURATION_H
static constexpr unsigned short DATA_PORT_OF_HOST_DEVICE
static constexpr double DEFAULT_SCAN_ANGLE_RESOLUTION(data_conversion_layer::degreeToRadian(0.1))
static constexpr unsigned short CONTROL_PORT_OF_HOST_DEVICE
Higher level data type storing the configuration details of the scanner like scanner IP...
static constexpr unsigned short CONTROL_PORT_OF_SCANNER_DEVICE
const util::TenthOfDegree & scanResolution() const
Root namespace in which the software components to communicate with the scanner (firmware-version: 2)...
Definition: udp_client.h:41
Higher level data type storing the range in which the scanner takes measurements. ...
Definition: scan_range.h:31
#define PSENSCAN_ERROR(name,...)
Definition: logging.h:60
boost::optional< uint32_t > hostIp() const
Helper class to simplify/improve the construction of the psen_scan_v2_standalone::ScannerConfiguratio...
static int16_t radToTenthDegree(const double &angle_in_rad)
static constexpr unsigned short DATA_PORT_OF_SCANNER_DEVICE
Helper class representing angles in tenth of degree.


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