Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(pid_longitudinal_controller): change the condition from emergency to stopped #5892

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -646,10 +646,11 @@

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

Check warning on line 650 in control/pid_longitudinal_controller/src/pid_longitudinal_controller.cpp

View check run for this annotation

Codecov / codecov/patch

control/pid_longitudinal_controller/src/pid_longitudinal_controller.cpp#L650

Added line #L650 was not covered by tests
}

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
Loading