active_zoneset_node.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_ACTIVE_ZONESET_NODE_H
17 #define PSEN_SCAN_V2_ACTIVE_ZONESET_NODE_H
18 
19 #include <string>
20 #include <vector>
21 #include <boost/optional.hpp>
22 
23 #include <ros/ros.h>
24 #include <visualization_msgs/Marker.h>
25 #include <std_msgs/UInt8.h>
26 
27 #include "psen_scan_v2/ZoneSetConfiguration.h"
28 
29 namespace psen_scan_v2
30 {
31 static const std::string DEFAULT_ACTIVE_ZONESET_TOPIC = "active_zoneset";
32 static const std::string DEFAULT_ZONECONFIGURATION_TOPIC = "zoneconfiguration";
33 static const std::string DEFAULT_ZONESET_MARKER_ARRAY_TOPIC = "active_zoneset_markers";
34 
44 {
45 public:
52 
53 public:
54  void zonesetCallback(const ZoneSetConfiguration& zoneset_config);
55  void activeZonesetCallback(const std_msgs::UInt8& zoneset_config);
56 
57 private:
58  void updateMarkers();
59  bool isAllInformationAvailable() const;
60 
62  [[deprecated("use ZoneSet activeZoneset() const instead")]] ZoneSet getActiveZoneset() const;
63  ZoneSet activeZoneset() const;
64 
65  void addMarkers(std::vector<visualization_msgs::Marker>& new_markers);
66  void publishCurrentMarkers();
68 
69 private:
74 
75  boost::optional<ZoneSetConfiguration> zoneset_config_;
76  boost::optional<std_msgs::UInt8> active_zoneset_id_;
77  std::vector<visualization_msgs::Marker> last_markers_;
78  std::vector<visualization_msgs::Marker> current_markers_;
79 };
80 
81 } // namespace psen_scan_v2
82 
83 #endif // PSEN_SCAN_V2_ACTIVE_ZONESET_NODE_H
static const std::string DEFAULT_ACTIVE_ZONESET_TOPIC
void addMarkers(std::vector< visualization_msgs::Marker > &new_markers)
void zonesetCallback(const ZoneSetConfiguration &zoneset_config)
static const std::string DEFAULT_ZONECONFIGURATION_TOPIC
ROS Node that continuously publishes a marker for the active_zoneset.
void activeZonesetCallback(const std_msgs::UInt8 &zoneset_config)
boost::optional< ZoneSetConfiguration > zoneset_config_
Root namespace for the ROS part.
boost::optional< std_msgs::UInt8 > active_zoneset_id_
static const std::string DEFAULT_ZONESET_MARKER_ARRAY_TOPIC
std::vector< visualization_msgs::Marker > current_markers_
ActiveZonesetNode(ros::NodeHandle &nh)
Constructor.
std::vector< visualization_msgs::Marker > last_markers_


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