Skip to content

Commit

Permalink
chore(pid_longitudinal_controller): change the condition from emergen…
Browse files Browse the repository at this point in the history
…cy to stopped

Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>
  • Loading branch information
takayuki5168 committed Dec 16, 2023
1 parent 5895d73 commit 1dd0347
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -646,10 +646,11 @@ void PidLongitudinalController::updateControlState(const ControlData & control_d

// in EMERGENCY state
if (m_control_state == ControlState::EMERGENCY) {
if (stopped_condition) {
return changeState(ControlState::STOPPED);
}

if (!emergency_condition) {

Check notice on line 653 in control/pid_longitudinal_controller/src/pid_longitudinal_controller.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

ℹ Getting worse: Bumpy Road Ahead

PidLongitudinalController::updateControlState increases from 8 to 9 logical blocks with deeply nested code, threshold is one single block per function. The Bumpy Road code smell is a function that contains multiple chunks of nested conditional logic. The deeper the nesting and the more bumps, the lower the code health.
if (stopped_condition) {
return changeState(ControlState::STOPPED);
}
if (!is_under_control) {
// NOTE: On manual driving, no need stopping to exit the emergency.
return changeState(ControlState::DRIVE);
Expand Down

0 comments on commit 1dd0347

Please sign in to comment.