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 
85 
86  boost::optional<ZoneSetSpeedRange> speed_range_;
87 };
88 
89 } // namespace configuration
90 } // namespace psen_scan_v2_standalone
91 
92 #endif // PSEN_SCAN_V2_ZONESET_H
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::ZoneSetSpeedRangeException::ZoneSetSpeedRangeException
ZoneSetSpeedRangeException(const std::string &msg)
Definition: zoneset.h:35
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:86
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::warn1_
std::vector< unsigned long > warn1_
Definition: zoneset.h:77
psen_scan_v2_standalone::configuration::ZoneSet::muting2_
std::vector< unsigned long > muting2_
Definition: zoneset.h:80
default_parameters.h
std
psen_scan_v2_standalone::configuration::ZoneSet::resolution_
util::TenthOfDegree resolution_
Definition: zoneset.h:84
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::ZoneSetSpeedRange::operator!=
bool operator!=(const ZoneSetSpeedRange &rhs) const
Definition: zoneset.h:61
psen_scan_v2_standalone::configuration::ZoneSetSpeedRange
The speedrange at which a ZoneSet is active.
Definition: zoneset.h:44
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
Author(s): Pilz GmbH + Co. KG
autogenerated on Sat Nov 25 2023 03:46:26