15 #ifndef TRAFFIC_SIMULATOR__TRAFFIC_LIGHTS__TRAFFIC_LIGHTS_HPP_
16 #define TRAFFIC_SIMULATOR__TRAFFIC_LIGHTS__TRAFFIC_LIGHTS_HPP_
19 #if __has_include(<autoware_perception_msgs/msg/traffic_signal_array.hpp>)
20 #include <autoware_perception_msgs/msg/traffic_signal_array.hpp>
23 #if __has_include(<autoware_perception_msgs/msg/traffic_light_group_array.hpp>)
24 #include <autoware_perception_msgs/msg/traffic_light_group_array.hpp>
35 template <
typename NodeTypePo
inter>
37 const NodeTypePointer & node_ptr,
const std::shared_ptr<hdmap_utils::HdMapUtils> &
hdmap_utils)
39 backward_compatible_publisher_ptr_(
41 node_ptr,
"/simulation/traffic_lights"))
48 auto update() const ->
void
50 backward_compatible_publisher_ptr_->publish(
58 const std::unique_ptr<TrafficLightPublisherBase> backward_compatible_publisher_ptr_;
64 template <
typename NodeTypePo
inter>
66 const NodeTypePointer & node_ptr,
const std::shared_ptr<hdmap_utils::HdMapUtils> &
hdmap_utils,
69 publisher_ptr_(makePublisher(
70 node_ptr, architecture_type,
71 "/perception/traffic_light_recognition/external/traffic_signals")),
72 legacy_topic_publisher_ptr_(makePublisher(node_ptr, architecture_type,
"/v2x/traffic_signals"))
79 auto update() const ->
void override
83 publisher_ptr_->publish(now, request);
84 legacy_topic_publisher_ptr_->publish(now, request);
91 template <
typename NodeTypePo
inter>
93 const NodeTypePointer & node_ptr,
const std::string & architecture_type,
94 const std::string & topic_name) -> std::unique_ptr<TrafficLightPublisherBase>
104 if (architecture_type ==
"awf/universe") {
106 "This version of scenario_simulator_v2 does not support ", std::quoted(architecture_type),
107 " as ", std::quoted(
"architecture_type"),
". Please use older version.");
108 #if __has_include(<autoware_perception_msgs/msg/traffic_signal_array.hpp>)
109 }
else if (architecture_type <=
"awf/universe/20230906") {
110 return std::make_unique<
111 TrafficLightPublisher<autoware_perception_msgs::msg::TrafficSignalArray>>(
112 node_ptr, topic_name);
114 #if __has_include(<autoware_perception_msgs/msg/traffic_light_group_array.hpp>)
115 }
else if (architecture_type >=
"awf/universe/20240605") {
116 return std::make_unique<
117 TrafficLightPublisher<autoware_perception_msgs::msg::TrafficLightGroupArray>>(
118 node_ptr, topic_name);
122 "Unexpected architecture_type ", std::quoted(architecture_type),
123 " given for V2I traffic lights simulation.");
127 const std::unique_ptr<TrafficLightPublisherBase> publisher_ptr_;
128 const std::unique_ptr<TrafficLightPublisherBase> legacy_topic_publisher_ptr_;
134 template <
typename NodeTypePo
inter>
136 const NodeTypePointer & node_ptr,
const std::shared_ptr<hdmap_utils::HdMapUtils> &
hdmap_utils,
138 : conventional_traffic_lights_(
148 const double conventional_traffic_light_update_rate,
149 const double v2i_traffic_lights_update_rate) -> void;
Definition: traffic_lights.hpp:33
ConventionalTrafficLights(const NodeTypePointer &node_ptr, const std::shared_ptr< hdmap_utils::HdMapUtils > &hdmap_utils)
Definition: traffic_lights.hpp:36
~ConventionalTrafficLights() override=default
Definition: traffic_light_publisher.hpp:39
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:132
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:135
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:62
V2ITrafficLights(const NodeTypePointer &node_ptr, const std::shared_ptr< hdmap_utils::HdMapUtils > &hdmap_utils, const std::string &architecture_type)
Definition: traffic_lights.hpp:65
~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