15 #ifndef SIMPLE_SENSOR_SIMULATOR__SENSOR_SIMULATION__TRAFFIC_LIGHTS__TRAFFIC_LIGHTS_DETECTOR_HPP_
16 #define SIMPLE_SENSOR_SIMULATOR__SENSOR_SIMULATION__TRAFFIC_LIGHTS__TRAFFIC_LIGHTS_DETECTOR_HPP_
18 #include <autoware_auto_perception_msgs/msg/traffic_signal_array.hpp>
19 #include <autoware_perception_msgs/msg/traffic_signal_array.hpp>
20 #include <rclcpp/rclcpp.hpp>
25 #if __has_include(<autoware_perception_msgs/msg/traffic_light_group_array.hpp>)
26 #include <autoware_perception_msgs/msg/traffic_light_group_array.hpp>
31 namespace traffic_lights
41 template <
typename NodeType>
43 : publisher_ptr_(makePublisher(node, architecture_type))
48 const rclcpp::Time & current_ros_time,
49 const simulation_api_schema::UpdateTrafficLightsRequest & request) ->
void
51 publisher_ptr_->publish(current_ros_time, request);
55 template <
typename NodeType>
56 auto makePublisher(NodeType & node,
const std::string & architecture_type)
57 -> std::unique_ptr<traffic_simulator::TrafficLightPublisherBase>
68 if (architecture_type ==
"awf/universe") {
69 using Message = autoware_auto_perception_msgs::msg::TrafficSignalArray;
70 return std::make_unique<traffic_simulator::TrafficLightPublisher<Message>>(
71 &node,
"/perception/traffic_light_recognition/traffic_signals");
72 }
else if (architecture_type ==
"awf/universe/20230906") {
73 using Message = autoware_perception_msgs::msg::TrafficSignalArray;
74 return std::make_unique<traffic_simulator::TrafficLightPublisher<Message>>(
75 &node,
"/perception/traffic_light_recognition/internal/traffic_signals");
76 #if __has_include(<autoware_perception_msgs/msg/traffic_light_group_array.hpp>)
77 }
else if (architecture_type >=
"awf/universe/20240605") {
78 using Message = autoware_perception_msgs::msg::TrafficLightGroupArray;
79 return std::make_unique<traffic_simulator::TrafficLightPublisher<Message>>(
80 &node,
"/perception/traffic_light_recognition/internal/traffic_signals");
84 ss <<
"Unexpected architecture_type " << std::quoted(architecture_type)
85 <<
" given for traffic light.";
86 throw std::invalid_argument(ss.str());
90 const std::unique_ptr<traffic_simulator::TrafficLightPublisherBase> publisher_ptr_;
Implements traffic lights detector mechanism simulation Currently it only allows to set traffic light...
Definition: traffic_lights_detector.hpp:39
TrafficLightsDetector(NodeType &node, const std::string &architecture_type)
Definition: traffic_lights_detector.hpp:42
auto updateFrame(const rclcpp::Time ¤t_ros_time, const simulation_api_schema::UpdateTrafficLightsRequest &request) -> void
Definition: traffic_lights_detector.hpp:47
Definition: constants.hpp:19
std::string string
Definition: junit5.hpp:26