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 
21 namespace traffic_simulator
22 {
24 {
25 public:
26  template <typename NodeTypePointer>
28  const NodeTypePointer & node_ptr, const std::string & frame = "map")
29  : frame_(frame),
30  clock_ptr_(node_ptr->get_clock()),
31  publisher_(rclcpp::create_publisher<visualization_msgs::msg::MarkerArray>(
32  node_ptr, "traffic_light/marker", rclcpp::QoS(1).transient_local()))
33  {
34  }
35 
36  auto deleteMarkers() const -> void;
37 
38  auto drawMarkers(const std::unordered_map<lanelet::Id, TrafficLight> & traffic_lights_map) const
39  -> void;
40 
41 private:
42  const std::string frame_;
43  const rclcpp::Clock::SharedPtr clock_ptr_;
44  const rclcpp::Publisher<visualization_msgs::msg::MarkerArray>::SharedPtr publisher_;
45 };
46 } // namespace traffic_simulator
47 #endif // TRAFFIC_SIMULATOR__TRAFFIC_LIGHTS__TRAFFIC_LIGHT_MARKER_PUBLISHER_HPP
Definition: traffic_light_marker_publisher.hpp:24
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:27
Definition: cache.hpp:27
Definition: api.hpp:48
std::string string
Definition: junit5.hpp:26
Definition: traffic_light.hpp:42