scenario_simulator_v2 C++ API
traffic_light_marker_publisher.hpp
Go to the documentation of this file.
1 // Copyright 2015 TIER IV, Inc. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef TRAFFIC_SIMULATOR__TRAFFIC_LIGHTS__TRAFFIC_LIGHT_MARKER_PUBLISHER_HPP
16 #define TRAFFIC_SIMULATOR__TRAFFIC_LIGHTS__TRAFFIC_LIGHT_MARKER_PUBLISHER_HPP
17 
18 #include <rclcpp/rclcpp.hpp>
20 #include <visualization_msgs/msg/marker_array.hpp>
21 
22 namespace traffic_simulator
23 {
25 {
26 public:
27  template <typename NodeTypePointer>
29  const NodeTypePointer & node_ptr, const std::string & frame = "map")
30  : frame_(frame),
31  clock_ptr_(node_ptr->get_clock()),
32  publisher_(rclcpp::create_publisher<visualization_msgs::msg::MarkerArray>(
33  node_ptr, "traffic_light/marker", rclcpp::QoS(1).transient_local()))
34  {
35  }
36 
37  auto deleteMarkers() const -> void;
38 
39  auto drawMarkers(const std::unordered_map<lanelet::Id, TrafficLight> & traffic_lights_map) const
40  -> void;
41 
42 private:
43  const std::string frame_;
44  const rclcpp::Clock::SharedPtr clock_ptr_;
45  const rclcpp::Publisher<visualization_msgs::msg::MarkerArray>::SharedPtr publisher_;
46 };
47 } // namespace traffic_simulator
48 #endif // TRAFFIC_SIMULATOR__TRAFFIC_LIGHTS__TRAFFIC_LIGHT_MARKER_PUBLISHER_HPP
Definition: traffic_light_marker_publisher.hpp:25
auto drawMarkers(const std::unordered_map< lanelet::Id, TrafficLight > &traffic_lights_map) const -> void
Definition: traffic_light_marker_publisher.cpp:29
auto deleteMarkers() const -> void
Definition: traffic_light_marker_publisher.cpp:20
TrafficLightMarkerPublisher(const NodeTypePointer &node_ptr, const std::string &frame="map")
Definition: traffic_light_marker_publisher.hpp:28
Definition: lanelet_wrapper.hpp:43
Definition: api.hpp:33
std::string string
Definition: junit5.hpp:26
Definition: traffic_light.hpp:43