diff --git a/common/tier4_traffic_light_rviz_plugin/src/traffic_light_publish_panel.cpp b/common/tier4_traffic_light_rviz_plugin/src/traffic_light_publish_panel.cpp index 6bac29c51ed80..8fcbbe278a694 100644 --- a/common/tier4_traffic_light_rviz_plugin/src/traffic_light_publish_panel.cpp +++ b/common/tier4_traffic_light_rviz_plugin/src/traffic_light_publish_panel.cpp @@ -31,6 +31,7 @@ #include #include +#include #include namespace rviz_plugins @@ -131,8 +132,8 @@ TrafficLightPublishPanel::TrafficLightPublishPanel(QWidget * parent) : rviz_comm void TrafficLightPublishPanel::onSetTrafficLightState() { - // const auto traffic_light_id = traffic_light_id_input_->value(); - const auto traffic_light_id = 0; // TODO(Mamoru Sobue): use select from items + const auto traffic_light_id_str = traffic_light_id_input_->currentText(); + const auto traffic_light_id = std::stoi(traffic_light_id_str.toStdString()); const auto color = light_color_combo_->currentText(); const auto shape = light_shape_combo_->currentText(); const auto status = light_status_combo_->currentText(); @@ -369,14 +370,14 @@ void TrafficLightPublishPanel::onVectorMap( lanelet::LaneletMapPtr lanelet_map(new lanelet::LaneletMap); lanelet::utils::conversion::fromBinMsg(*msg, lanelet_map); lanelet::ConstLanelets all_lanelets = lanelet::utils::query::laneletLayer(lanelet_map); - // TODO(Mamoru Sobue) extract from tl_reg_elem.trafficLights() std::vector tl_reg_elems = lanelet::utils::query::trafficLights(all_lanelets); - std::string info = "traffic light ids = "; + std::string info = "Fetching traffic lights :"; + std::string delim = " "; for (auto && tl_reg_elem_ptr : tl_reg_elems) { for (auto && traffic_light : tl_reg_elem_ptr->trafficLights()) { auto id = static_cast(traffic_light.id()); - info += (std::to_string(id) + ", "); + info += (std::exchange(delim, ", ") + std::to_string(id)); traffic_light_ids_.insert(id); } }