Skip to content

Commit c5a5436

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

File tree

3 files changed

+16
-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

+16
-2
lines changed

planning/behavior_velocity_planner/src/node.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,8 @@ void BehaviorVelocityPlannerNode::onTrafficSignals(
327327
{
328328
std::lock_guard<std::mutex> lock(mutex_);
329329

330+
planner_data_.has_received_signal_ = true;
331+
330332
for (const auto & signal : msg->signals) {
331333
TrafficSignalStamped traffic_signal;
332334
traffic_signal.stamp = msg->stamp;

planning/behavior_velocity_planner_common/include/behavior_velocity_planner_common/planner_data.hpp

+3
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ struct PlannerData
8282
std::map<int, TrafficSignalTimeToRedStamped> traffic_light_time_to_red_id_map;
8383
tier4_v2x_msgs::msg::VirtualTrafficLightStateArray::ConstSharedPtr virtual_traffic_light_states;
8484

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

planning/behavior_velocity_traffic_light_module/src/scene.cpp

+11-2
Original file line numberDiff line numberDiff line change
@@ -303,11 +303,20 @@ bool TrafficLightModule::isStopSignal()
303303
{
304304
updateTrafficSignal();
305305

306-
// If it never receives traffic signal, it will PASS.
307-
if (!traffic_signal_stamp_) {
306+
// Pass through if no traffic signal information has been received yet
307+
// This is to prevent stopping on the planning simulator
308+
if (!planner_data_->has_received_signal_) {
308309
return false;
309310
}
310311

312+
// Stop if there is no upcoming traffic signal information
313+
// This is to safely stop in cases such that traffic light recognition is not working properly or
314+
// the map is incorrect
315+
if (!traffic_signal_stamp_) {
316+
return true;
317+
}
318+
319+
// Stop if the traffic signal information has timed out
311320
if (isTrafficSignalTimedOut()) {
312321
return true;
313322
}

0 commit comments

Comments
 (0)