From df33eb0273d134891540f1f25deeeb7bc1b7cd13 Mon Sep 17 00:00:00 2001 From: Mamoru Sobue Date: Mon, 26 Feb 2024 22:12:33 +0900 Subject: [PATCH] fix(start_planner): start prepare blinker when autonomous mode is available (#6470) Signed-off-by: Mamoru Sobue --- .../start_planner_module.hpp | 2 +- .../src/start_planner_module.cpp | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/planning/behavior_path_start_planner_module/include/behavior_path_start_planner_module/start_planner_module.hpp b/planning/behavior_path_start_planner_module/include/behavior_path_start_planner_module/start_planner_module.hpp index 641907bbb5ed9..eafe8d02617f7 100644 --- a/planning/behavior_path_start_planner_module/include/behavior_path_start_planner_module/start_planner_module.hpp +++ b/planning/behavior_path_start_planner_module/include/behavior_path_start_planner_module/start_planner_module.hpp @@ -71,7 +71,7 @@ struct PullOutStatus bool has_stop_point{false}; std::optional stop_pose{std::nullopt}; //! record the first time when the state changed from !isActivated() to isActivated() - std::optional first_approved_time{std::nullopt}; + std::optional first_engaged_time{std::nullopt}; PullOutStatus() {} }; diff --git a/planning/behavior_path_start_planner_module/src/start_planner_module.cpp b/planning/behavior_path_start_planner_module/src/start_planner_module.cpp index b6da9acee05de..338082e7d3c01 100644 --- a/planning/behavior_path_start_planner_module/src/start_planner_module.cpp +++ b/planning/behavior_path_start_planner_module/src/start_planner_module.cpp @@ -161,8 +161,10 @@ void StartPlannerModule::updateData() DEBUG_PRINT("StartPlannerModule::updateData() received new route, reset status"); } - if (!status_.first_approved_time && isActivated()) { - status_.first_approved_time = clock_->now(); + if ( + planner_data_->operation_mode->mode == OperationModeState::AUTONOMOUS && + !status_.first_engaged_time) { + status_.first_engaged_time = clock_->now(); } if (hasFinishedBackwardDriving()) { @@ -968,11 +970,11 @@ bool StartPlannerModule::hasFinishedPullOut() const bool StartPlannerModule::needToPrepareBlinkerBeforeStart() const { - if (!status_.first_approved_time) { + if (!status_.first_engaged_time) { return true; } - const auto first_approved_time = status_.first_approved_time.value(); - const double elapsed = rclcpp::Duration(clock_->now() - first_approved_time).seconds(); + const auto first_engaged_time = status_.first_engaged_time.value(); + const double elapsed = rclcpp::Duration(clock_->now() - first_engaged_time).seconds(); return elapsed < parameters_->prepare_time_before_start; }