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 
19 
20 namespace traffic_simulator
21 {
23 {
24  const rclcpp::Publisher<visualization_msgs::msg::MarkerArray>::SharedPtr marker_pub_;
25  const std::string map_frame_;
26  const rclcpp::Clock::SharedPtr clock_ptr_;
27  const std::shared_ptr<TrafficLightManager> traffic_light_manager_;
28 
29  auto deleteAllMarkers() const -> void;
30  auto drawMarkers() const -> void;
31 
32 public:
33  template <typename NodePointer>
35  const std::shared_ptr<TrafficLightManager> & traffic_light_manager, const NodePointer & node,
36  const std::string & map_frame = "map")
37  : marker_pub_(rclcpp::create_publisher<visualization_msgs::msg::MarkerArray>(
38  node, "traffic_light/marker", rclcpp::QoS(1).transient_local())),
39  map_frame_(map_frame),
40  clock_ptr_(node->get_clock()),
41  traffic_light_manager_(traffic_light_manager)
42  {
43  }
44 
45  auto publish() -> void;
46 };
47 
48 } // namespace traffic_simulator
49 #endif // TRAFFIC_SIMULATOR__TRAFFIC_LIGHTS__TRAFFIC_LIGHT_MARKER_PUBLISHER_HPP
Definition: traffic_light_marker_publisher.hpp:23
auto publish() -> void
Definition: traffic_light_marker_publisher.cpp:45
TrafficLightMarkerPublisher(const std::shared_ptr< TrafficLightManager > &traffic_light_manager, const NodePointer &node, const std::string &map_frame="map")
Definition: traffic_light_marker_publisher.hpp:34
Definition: api.hpp:48
std::string string
Definition: junit5.hpp:26