15 #ifndef TRAFFIC_SIMULATOR__TRAFFIC_LIGHTS__TRAFFIC_LIGHTS_HPP_
16 #define TRAFFIC_SIMULATOR__TRAFFIC_LIGHTS__TRAFFIC_LIGHTS_HPP_
18 #include <autoware_auto_perception_msgs/msg/traffic_signal_array.hpp>
19 #include <autoware_perception_msgs/msg/traffic_signal_array.hpp>
21 #if __has_include(<autoware_perception_msgs/msg/traffic_light_group_array.hpp>)
22 #include <autoware_perception_msgs/msg/traffic_light_group_array.hpp>
33 template <
typename NodeTypePo
inter>
35 const NodeTypePointer & node_ptr,
const std::shared_ptr<hdmap_utils::HdMapUtils> &
hdmap_utils)
37 backward_compatible_publisher_ptr_(
39 node_ptr,
"/simulation/traffic_lights"))
46 auto update() const ->
void
48 backward_compatible_publisher_ptr_->publish(
56 const std::unique_ptr<TrafficLightPublisherBase> backward_compatible_publisher_ptr_;
62 template <
typename NodeTypePo
inter>
64 const NodeTypePointer & node_ptr,
const std::shared_ptr<hdmap_utils::HdMapUtils> &
hdmap_utils,
67 publisher_ptr_(makePublisher(
68 node_ptr, architecture_type,
69 "/perception/traffic_light_recognition/external/traffic_signals")),
70 legacy_topic_publisher_ptr_(makePublisher(node_ptr, architecture_type,
"/v2x/traffic_signals"))
77 auto update() const ->
void override
81 publisher_ptr_->publish(now, request);
82 legacy_topic_publisher_ptr_->publish(now, request);
89 template <
typename NodeTypePo
inter>
91 const NodeTypePointer & node_ptr,
const std::string & architecture_type,
92 const std::string & topic_name) -> std::unique_ptr<TrafficLightPublisherBase>
102 if (architecture_type <=
"awf/universe/20230906") {
103 return std::make_unique<
105 node_ptr, topic_name);
106 #if __has_include(<autoware_perception_msgs/msg/traffic_light_group_array.hpp>)
107 }
else if (architecture_type >=
"awf/universe/20240605") {
108 return std::make_unique<
109 TrafficLightPublisher<autoware_perception_msgs::msg::TrafficLightGroupArray>>(
110 node_ptr, topic_name);
114 "Unexpected architecture_type ", std::quoted(architecture_type),
115 " given for V2I traffic lights simulation.");
119 const std::unique_ptr<TrafficLightPublisherBase> publisher_ptr_;
120 const std::unique_ptr<TrafficLightPublisherBase> legacy_topic_publisher_ptr_;
126 template <
typename NodeTypePo
inter>
128 const NodeTypePointer & node_ptr,
const std::shared_ptr<hdmap_utils::HdMapUtils> &
hdmap_utils,
130 : conventional_traffic_lights_(
140 const double conventional_traffic_light_update_rate,
141 const double v2i_traffic_lights_update_rate) -> void;
Definition: traffic_lights.hpp:31
ConventionalTrafficLights(const NodeTypePointer &node_ptr, const std::shared_ptr< hdmap_utils::HdMapUtils > &hdmap_utils)
Definition: traffic_lights.hpp:34
~ConventionalTrafficLights() override=default
Definition: traffic_light_publisher.hpp:38
Definition: traffic_lights_base.hpp:39
auto isAnyTrafficLightChanged() const -> bool
Definition: traffic_lights_base.cpp:30
auto generateUpdateTrafficLightsRequest() const -> simulation_api_schema::UpdateTrafficLightsRequest
Definition: traffic_lights_base.cpp:96
const rclcpp::Clock::SharedPtr clock_ptr_
Definition: traffic_lights_base.hpp:90
const std::unique_ptr< TrafficLightMarkerPublisher > marker_publisher_ptr_
Definition: traffic_lights_base.hpp:93
std::unordered_map< lanelet::Id, TrafficLight > traffic_lights_map_
Definition: traffic_lights_base.hpp:92
Definition: traffic_lights.hpp:124
auto getV2ITrafficLights() const -> std::shared_ptr< V2ITrafficLights >
Definition: traffic_lights.cpp:39
TrafficLights(const NodeTypePointer &node_ptr, const std::shared_ptr< hdmap_utils::HdMapUtils > &hdmap_utils, const std::string &architecture_type)
Definition: traffic_lights.hpp:127
auto startTrafficLightsUpdate(const double conventional_traffic_light_update_rate, const double v2i_traffic_lights_update_rate) -> void
Definition: traffic_lights.cpp:25
auto getConventionalTrafficLights() const -> std::shared_ptr< ConventionalTrafficLights >
Definition: traffic_lights.cpp:33
auto isAnyTrafficLightChanged() -> bool
Definition: traffic_lights.cpp:19
Definition: traffic_lights.hpp:60
V2ITrafficLights(const NodeTypePointer &node_ptr, const std::shared_ptr< hdmap_utils::HdMapUtils > &hdmap_utils, const std::string &architecture_type)
Definition: traffic_lights.hpp:63
~V2ITrafficLights() override=default
std::string string
Definition: junit5.hpp:26
Although there were no syntactic errors in the description of the scenario, differences in meaning an...
Definition: exception.hpp:44