Skip to content

Commit d6d26ee

Browse files
committed
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>
1 parent 871f8f2 commit d6d26ee

File tree

3 files changed

+11
-1
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

+11
-1
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

+6-1
Original file line numberDiff line numberDiff line change
@@ -282,10 +282,15 @@ bool TrafficLightModule::isStopSignal()
282282
updateTrafficSignal();
283283

284284
// If it never receives traffic signal, it will PASS.
285-
if (!traffic_signal_stamp_) {
285+
if (!planner_data_->has_received_signal_) {
286286
return false;
287287
}
288288

289+
// If the signal data is not received, the ego stops.
290+
if (!traffic_signal_stamp_) {
291+
return true;
292+
}
293+
289294
if (isTrafficSignalTimedOut()) {
290295
return true;
291296
}

0 commit comments

Comments
 (0)