zoneset.h
Go to the documentation of this file.
1 // Copyright (c) 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 
16 #ifndef PSEN_SCAN_V2_ZONESET_H
17 #define PSEN_SCAN_V2_ZONESET_H
18 
19 #include <vector>
20 
21 #include <fmt/format.h>
22 
23 #include <boost/optional.hpp>
24 
27 
29 {
30 namespace configuration
31 {
32 class ZoneSetSpeedRangeException : public std::runtime_error
33 {
34 public:
35  ZoneSetSpeedRangeException(const std::string& msg) : std::runtime_error(msg)
36  {
37  }
38 };
39 
45 {
46 public:
47  ZoneSetSpeedRange(short min, short max) : min_(min), max_(max)
48  {
49  if (min > max)
50  {
51  throw ZoneSetSpeedRangeException(fmt::format("Invalid speedrange min: {} > max: {}", min, max));
52  }
53  };
54  short min_{ 0 };
55  short max_{ 0 };
56 
57  bool operator==(const ZoneSetSpeedRange& rhs) const
58  {
59  return (min_ == rhs.min_) && (max_ == rhs.max_);
60  }
61  bool operator!=(const ZoneSetSpeedRange& rhs) const
62  {
63  return !operator==(rhs);
64  }
65 };
66 
71 class ZoneSet
72 {
73 public:
74  std::vector<unsigned long> safety1_;
75  std::vector<unsigned long> safety2_;
76  std::vector<unsigned long> safety3_;
77  std::vector<unsigned long> warn1_;
78  std::vector<unsigned long> warn2_;
79  std::vector<unsigned long> muting1_;
80  std::vector<unsigned long> muting2_;
81  std::vector<unsigned long> safety1_Sub0_;
82  std::vector<unsigned long> safety2_Sub0_;
83  std::vector<unsigned long> safety3_Sub0_;
84  std::vector<unsigned long> warn1_Sub0_;
85  std::vector<unsigned long> warn2_Sub0_;
86  std::vector<unsigned long> muting1_Sub0_;
87  std::vector<unsigned long> muting2_Sub0_;
88  std::vector<unsigned long> safety1_Sub1_;
89  std::vector<unsigned long> safety2_Sub1_;
90  std::vector<unsigned long> safety3_Sub1_;
91  std::vector<unsigned long> warn1_Sub1_;
92  std::vector<unsigned long> warn2_Sub1_;
93  std::vector<unsigned long> muting1_Sub1_;
94  std::vector<unsigned long> muting2_Sub1_;
95  std::vector<unsigned long> safety1_Sub2_;
96  std::vector<unsigned long> safety2_Sub2_;
97  std::vector<unsigned long> safety3_Sub2_;
98  std::vector<unsigned long> warn1_Sub2_;
99  std::vector<unsigned long> warn2_Sub2_;
100  std::vector<unsigned long> muting1_Sub2_;
101  std::vector<unsigned long> muting2_Sub2_;
102 
106 
107  boost::optional<ZoneSetSpeedRange> speed_range_;
108 };
109 
110 } // namespace configuration
111 } // namespace psen_scan_v2_standalone
112 
113 #endif // PSEN_SCAN_V2_ZONESET_H
psen_scan_v2_standalone::configuration::ZoneSet::muting2_Sub1_
std::vector< unsigned long > muting2_Sub1_
Definition: zoneset.h:94
psen_scan_v2_standalone::configuration::ZoneSet::warn1_Sub2_
std::vector< unsigned long > warn1_Sub2_
Definition: zoneset.h:98
min
int min(int a, int b)
psen_scan_v2_standalone::configuration::ZoneSetSpeedRange::operator==
bool operator==(const ZoneSetSpeedRange &rhs) const
Definition: zoneset.h:57
psen_scan_v2_standalone::configuration::ZoneSet::warn2_Sub1_
std::vector< unsigned long > warn2_Sub1_
Definition: zoneset.h:92
psen_scan_v2_standalone::configuration::ZoneSet::warn2_Sub0_
std::vector< unsigned long > warn2_Sub0_
Definition: zoneset.h:85
psen_scan_v2_standalone::configuration::ZoneSet::muting2_Sub0_
std::vector< unsigned long > muting2_Sub0_
Definition: zoneset.h:87
psen_scan_v2_standalone::configuration::ZoneSet::muting1_Sub1_
std::vector< unsigned long > muting1_Sub1_
Definition: zoneset.h:93
psen_scan_v2_standalone::configuration::ZoneSet::warn1_Sub0_
std::vector< unsigned long > warn1_Sub0_
Definition: zoneset.h:84
psen_scan_v2_standalone::configuration::ZoneSetSpeedRangeException::ZoneSetSpeedRangeException
ZoneSetSpeedRangeException(const std::string &msg)
Definition: zoneset.h:35
psen_scan_v2_standalone::configuration::ZoneSet::muting1_Sub0_
std::vector< unsigned long > muting1_Sub0_
Definition: zoneset.h:86
psen_scan_v2_standalone::configuration::ZoneSet::safety3_Sub0_
std::vector< unsigned long > safety3_Sub0_
Definition: zoneset.h:83
psen_scan_v2_standalone::configuration::ZoneSet::safety2_Sub0_
std::vector< unsigned long > safety2_Sub0_
Definition: zoneset.h:82
psen_scan_v2_standalone::configuration::ZoneSetSpeedRange::max_
short max_
Definition: zoneset.h:55
psen_scan_v2_standalone::configuration::ZoneSetSpeedRange::ZoneSetSpeedRange
ZoneSetSpeedRange(short min, short max)
Definition: zoneset.h:47
psen_scan_v2_standalone::configuration::ZoneSet::safety2_
std::vector< unsigned long > safety2_
Definition: zoneset.h:75
psen_scan_v2_standalone::configuration::ZoneSetSpeedRange::min_
short min_
Definition: zoneset.h:54
psen_scan_v2_standalone::configuration::ZoneSet::safety1_
std::vector< unsigned long > safety1_
Definition: zoneset.h:74
psen_scan_v2_standalone::configuration::ZoneSet::speed_range_
boost::optional< ZoneSetSpeedRange > speed_range_
Definition: zoneset.h:107
psen_scan_v2_standalone::configuration::ZoneSet::safety1_Sub2_
std::vector< unsigned long > safety1_Sub2_
Definition: zoneset.h:95
tenth_of_degree.h
psen_scan_v2_standalone::configuration::ZoneSet::muting1_
std::vector< unsigned long > muting1_
Definition: zoneset.h:79
psen_scan_v2_standalone::configuration::ZoneSet::muting2_Sub2_
std::vector< unsigned long > muting2_Sub2_
Definition: zoneset.h:101
psen_scan_v2_standalone::configuration::ZoneSet::muting1_Sub2_
std::vector< unsigned long > muting1_Sub2_
Definition: zoneset.h:100
psen_scan_v2_standalone::configuration::ZoneSet::warn1_
std::vector< unsigned long > warn1_
Definition: zoneset.h:77
psen_scan_v2_standalone::configuration::ZoneSet::safety1_Sub0_
std::vector< unsigned long > safety1_Sub0_
Definition: zoneset.h:81
psen_scan_v2_standalone::configuration::ZoneSet::muting2_
std::vector< unsigned long > muting2_
Definition: zoneset.h:80
psen_scan_v2_standalone::configuration::ZoneSet::warn2_Sub2_
std::vector< unsigned long > warn2_Sub2_
Definition: zoneset.h:99
psen_scan_v2_standalone::configuration::ZoneSet::safety2_Sub2_
std::vector< unsigned long > safety2_Sub2_
Definition: zoneset.h:96
default_parameters.h
std
psen_scan_v2_standalone::configuration::ZoneSet::resolution_
util::TenthOfDegree resolution_
Definition: zoneset.h:105
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::configuration::ZoneSet::warn2_
std::vector< unsigned long > warn2_
Definition: zoneset.h:78
psen_scan_v2_standalone::configuration::ZoneSet
A set of simultanously active zones.
Definition: zoneset.h:71
psen_scan_v2_standalone::configuration::ZoneSetSpeedRangeException
Definition: zoneset.h:32
psen_scan_v2_standalone::configuration::ZoneSet::warn1_Sub1_
std::vector< unsigned long > warn1_Sub1_
Definition: zoneset.h:91
psen_scan_v2_standalone::configuration::ZoneSet::safety3_Sub2_
std::vector< unsigned long > safety3_Sub2_
Definition: zoneset.h:97
psen_scan_v2_standalone::configuration::ZoneSetSpeedRange::operator!=
bool operator!=(const ZoneSetSpeedRange &rhs) const
Definition: zoneset.h:61
psen_scan_v2_standalone::configuration::ZoneSet::safety2_Sub1_
std::vector< unsigned long > safety2_Sub1_
Definition: zoneset.h:89
psen_scan_v2_standalone::configuration::ZoneSetSpeedRange
The speedrange at which a ZoneSet is active.
Definition: zoneset.h:44
psen_scan_v2_standalone::configuration::ZoneSet::safety3_Sub1_
std::vector< unsigned long > safety3_Sub1_
Definition: zoneset.h:90
psen_scan_v2_standalone::util::TenthOfDegree
Helper class representing angles in tenth of degree.
Definition: tenth_of_degree.h:34
psen_scan_v2_standalone::configuration::ZoneSet::safety3_
std::vector< unsigned long > safety3_
Definition: zoneset.h:76
psen_scan_v2_standalone::configuration::ZoneSet::safety1_Sub1_
std::vector< unsigned long > safety1_Sub1_
Definition: zoneset.h:88


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