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 <rclcpp/rclcpp.hpp>
24 #if __has_include(<autoware_perception_msgs/msg/traffic_signal_array.hpp>)
25 #include <autoware_perception_msgs/msg/traffic_signal_array.hpp>
28 #if __has_include(<autoware_perception_msgs/msg/traffic_light_group_array.hpp>)
29 #include <autoware_perception_msgs/msg/traffic_light_group_array.hpp>
34 namespace traffic_lights
44 template <
typename NodeType>
46 : publisher_ptr_(makePublisher(node, architecture_type))
51 const rclcpp::Time & current_ros_time,
52 const simulation_api_schema::UpdateTrafficLightsRequest & request) ->
void
54 publisher_ptr_->publish(current_ros_time, request);
58 template <
typename NodeType>
59 auto makePublisher(NodeType & node,
const std::string & architecture_type)
60 -> std::unique_ptr<traffic_simulator::TrafficLightPublisherBase>
70 if (architecture_type ==
"awf/universe") {
72 "This version of scenario_simulator_v2 does not support ", std::quoted(architecture_type),
73 " as ", std::quoted(
"architecture_type"),
". Please use older version.");
74 #if __has_include(<autoware_perception_msgs/msg/traffic_signal_array.hpp>)
75 }
else if (architecture_type ==
"awf/universe/20230906") {
76 using Message = autoware_perception_msgs::msg::TrafficSignalArray;
77 return std::make_unique<traffic_simulator::TrafficLightPublisher<Message>>(
78 &node,
"/perception/traffic_light_recognition/internal/traffic_signals");
80 #if __has_include(<autoware_perception_msgs/msg/traffic_light_group_array.hpp>)
81 }
else if (architecture_type >=
"awf/universe/20240605") {
82 using Message = autoware_perception_msgs::msg::TrafficLightGroupArray;
83 return std::make_unique<traffic_simulator::TrafficLightPublisher<Message>>(
84 &node,
"/perception/traffic_light_recognition/internal/traffic_signals");
88 ss <<
"Unexpected architecture_type " << std::quoted(architecture_type)
89 <<
" given for traffic light.";
90 throw std::invalid_argument(ss.str());
94 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:42
TrafficLightsDetector(NodeType &node, const std::string &architecture_type)
Definition: traffic_lights_detector.hpp:45
auto updateFrame(const rclcpp::Time ¤t_ros_time, const simulation_api_schema::UpdateTrafficLightsRequest &request) -> void
Definition: traffic_lights_detector.hpp:50
Definition: constants.hpp:19
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