Skip to content

Commit c50a5e2

Browse files
authored
feat(behavior_velocity_traffic_light): ensure stopping if a signal, once received, is not received again (#6468)
* feat(behavior_velocity_traffic_light): ensure stopping if a signal, once received, is not received again." Signed-off-by: Tomohito Ando <tomohito.ando@tier4.jp> * add comments for clarity Signed-off-by: Tomohito Ando <tomohito.ando@tier4.jp> * fix comments for clarity Signed-off-by: Tomohito Ando <tomohito.ando@tier4.jp> --------- Signed-off-by: Tomohito Ando <tomohito.ando@tier4.jp>
1 parent c3b7841 commit c50a5e2

File tree

3 files changed

+17
-2
lines changed
  • planning
    • behavior_velocity_planner/src
    • behavior_velocity_planner_common/include/behavior_velocity_planner_common
    • behavior_velocity_traffic_light_module/src

3 files changed

+17
-2
lines changed

planning/behavior_velocity_planner/src/node.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,8 @@ void BehaviorVelocityPlannerNode::onTrafficSignals(
323323
{
324324
std::lock_guard<std::mutex> lock(mutex_);
325325

326+
planner_data_.has_received_signal_ = true;
327+
326328
// clear previous observation
327329
planner_data_.traffic_light_id_map_raw_.clear();
328330
const auto traffic_light_id_map_last_observed_old =

planning/behavior_velocity_planner_common/include/behavior_velocity_planner_common/planner_data.hpp

+3
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ struct PlannerData
8383
std::optional<tier4_planning_msgs::msg::VelocityLimit> external_velocity_limit;
8484
tier4_v2x_msgs::msg::VirtualTrafficLightStateArray::ConstSharedPtr virtual_traffic_light_states;
8585

86+
// this value becomes true once the signal message is received
87+
bool has_received_signal_ = false;
88+
8689
// velocity smoother
8790
std::shared_ptr<motion_velocity_smoother::SmootherBase> velocity_smoother_;
8891
// route handler

planning/behavior_velocity_traffic_light_module/src/scene.cpp

+12-2
Original file line numberDiff line numberDiff line change
@@ -281,15 +281,25 @@ bool TrafficLightModule::isStopSignal()
281281
{
282282
updateTrafficSignal();
283283

284-
// If it never receives traffic signal, it will PASS.
285-
if (!traffic_signal_stamp_) {
284+
// Pass through if no traffic signal information has been received yet
285+
// This is to prevent stopping on the planning simulator
286+
if (!planner_data_->has_received_signal_) {
286287
return false;
287288
}
288289

290+
// Stop if there is no upcoming traffic signal information
291+
// This is to safely stop in cases such that traffic light recognition is not working properly or
292+
// the map is incorrect
293+
if (!traffic_signal_stamp_) {
294+
return true;
295+
}
296+
297+
// Stop if the traffic signal information has timed out
289298
if (isTrafficSignalTimedOut()) {
290299
return true;
291300
}
292301

302+
// Check if the current traffic signal state requires stopping
293303
return traffic_light_utils::isTrafficSignalStop(lane_, looking_tl_state_);
294304
}
295305

0 commit comments

Comments
 (0)