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

fix(start_planner): start prepare blinker when autonomous mode is available #6470

Merged
Show file tree
Hide file tree
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 @@ -71,7 +71,7 @@ struct PullOutStatus
std::shared_ptr<PathWithLaneId> prev_stop_path_after_approval{nullptr};
std::optional<Pose> stop_pose{std::nullopt};
//! record the first time when the state changed from !isActivated() to isActivated()
std::optional<rclcpp::Time> first_approved_time{std::nullopt};
std::optional<rclcpp::Time> first_engaged_time{std::nullopt};

PullOutStatus() {}
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 TIER IV, Inc.

Check notice on line 1 in planning/behavior_path_start_planner_module/src/start_planner_module.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

ℹ Getting worse: Lines of Code in a Single File

The lines of code increases from 1314 to 1316, improve code health by reducing it to 1000. The number of Lines of Code in a single file. More Lines of Code lowers the code health.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -176,8 +176,10 @@
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 &&

Check warning on line 180 in planning/behavior_path_start_planner_module/src/start_planner_module.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_path_start_planner_module/src/start_planner_module.cpp#L180

Added line #L180 was not covered by tests
!status_.first_engaged_time) {
status_.first_engaged_time = clock_->now();

Check warning on line 182 in planning/behavior_path_start_planner_module/src/start_planner_module.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_path_start_planner_module/src/start_planner_module.cpp#L182

Added line #L182 was not covered by tests
}

if (hasFinishedBackwardDriving()) {
Expand Down Expand Up @@ -1084,11 +1086,11 @@

bool StartPlannerModule::needToPrepareBlinkerBeforeStart() const
{
if (!status_.first_approved_time) {
if (!status_.first_engaged_time) {

Check warning on line 1089 in planning/behavior_path_start_planner_module/src/start_planner_module.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_path_start_planner_module/src/start_planner_module.cpp#L1089

Added line #L1089 was not covered by tests
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();

Check warning on line 1093 in planning/behavior_path_start_planner_module/src/start_planner_module.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_path_start_planner_module/src/start_planner_module.cpp#L1092-L1093

Added lines #L1092 - L1093 were not covered by tests
return elapsed < parameters_->prepare_time_before_start;
}

Expand Down
Loading