From 48a42ed656433a147b1eea0bf15708133d4d5a58 Mon Sep 17 00:00:00 2001 From: Berkay Karaman Date: Tue, 16 May 2023 00:35:51 +0300 Subject: [PATCH] refactor(pid_longitudinal_controller): set stopped state if ego is not in autonomous mode (#3644) Signed-off-by: Berkay Karaman --- .../src/pid_longitudinal_controller.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/control/pid_longitudinal_controller/src/pid_longitudinal_controller.cpp b/control/pid_longitudinal_controller/src/pid_longitudinal_controller.cpp index b435e5e4f589f..78e47edb2cf48 100644 --- a/control/pid_longitudinal_controller/src/pid_longitudinal_controller.cpp +++ b/control/pid_longitudinal_controller/src/pid_longitudinal_controller.cpp @@ -526,6 +526,11 @@ void PidLongitudinalController::updateControlState(const ControlData & control_d RCLCPP_INFO_SKIPFIRST_THROTTLE(node_->get_logger(), *node_->get_clock(), 5000, "%s", s); }; + // if current operation mode is not autonomous mode, then change state to stopped + if (m_current_operation_mode.mode != OperationModeState::AUTONOMOUS) { + return changeState(ControlState::STOPPED); + } + // transit state // in DRIVE state if (m_control_state == ControlState::DRIVE) {