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
std::vector< unsigned long > safety3_
Definition: zoneset.h:76
bool operator!=(const ZoneSetSpeedRange &rhs) const
Definition: zoneset.h:61
std::vector< unsigned long > safety2_
Definition: zoneset.h:75
boost::optional< ZoneSetSpeedRange > speed_range_
Definition: zoneset.h:86
std::vector< unsigned long > safety1_
Definition: zoneset.h:74
std::vector< unsigned long > warn1_
Definition: zoneset.h:77
Root namespace in which the software components to communicate with the scanner (firmware-version: 2)...
Definition: udp_client.h:41
std::vector< unsigned long > muting1_
Definition: zoneset.h:79
A set of simultanously active zones.
Definition: zoneset.h:71
std::vector< unsigned long > muting2_
Definition: zoneset.h:80
The speedrange at which a ZoneSet is active.
Definition: zoneset.h:44
std::vector< unsigned long > warn2_
Definition: zoneset.h:78
bool operator==(const ZoneSetSpeedRange &rhs) const
Definition: zoneset.h:57
bool operator==(const Rotation &a, const Rotation &b)
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