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(lane_change): reduce prepare duration when blinker has been activated #9185

Open
wants to merge 22 commits into
base: main
Choose a base branch
from

Conversation

mkquda
Copy link
Contributor

@mkquda mkquda commented Oct 30, 2024

Description

Currently, a constant prepare duration (parameterized) is being used when generating LC path candidates, this was necessary because until recently turn signal was activated only after LC path was approved.

However, LC turn signal logic was recently changed to activate as soon as we have the intention to change lanes (i.e: when LC module is run). Therefore it is no longer necessary to have a constant long prepare duration, and we can reduce the prepare duration as the turn signal on duration increases.

Changes

  • Add member variable signal_activation_time_ to LaneChangeBase class
  • Add member variable lane_change_prepare_duration to TransientData struct
  • Add function calc_actual_prepare_duration to calculate actual needed prepare duration based on current velocity and signal on duration
  • Modify function update_transient_data to set lane_change_prepare_duration

Related links

How was this PR tested?

  • PSIM
  • TIER IV Internal Evaluation (pending)

Notes for reviewers

None.

Interface changes

None.

ROS Parameter Changes

Additions and removals

Change type Parameter Name Type Default Value Description
Added min_prepare_duration double 1.0 Minimum preparation time for the ego vehicle to be ready to perform lane change

Modifications

Version Parameter Name Type Default Value Description
Old prepare_duration double 4.0 Preparation time for the ego vehicle to be ready to perform lane change
New max_prepare_duration double 4.0 Maximum preparation time for the ego vehicle to be ready to perform lane change

Effects on system behavior

When LC module activates, initially prepare duration will be max, as signal activation duration increases, prepare duration will be gradually reduced to minimum, allowing a shorter LC path to be found.

@github-actions github-actions bot added type:documentation Creating or refining documentation. (auto-assigned) component:planning Route planning, decision-making, and navigation. (auto-assigned) labels Oct 30, 2024
Copy link

github-actions bot commented Oct 30, 2024

Thank you for contributing to the Autoware project!

🚧 If your pull request is in progress, switch it to draft mode.

Please ensure:

mkquda and others added 10 commits October 31, 2024 09:46
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions <[email protected]>
…owarefoundation#9173)

* refactor(time_utils): prefix package and namespace with autoware

Signed-off-by: Esteve Fernandez <[email protected]>

* refactor(time_utils): prefix package and namespace with autoware

Signed-off-by: Esteve Fernandez <[email protected]>

* style(pre-commit): autofix

---------

Signed-off-by: Esteve Fernandez <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* add requested feature

Signed-off-by: Go Sakayori <[email protected]>

* Update planning/autoware_rtc_interface/test/test_rtc_interface.cpp

Co-authored-by: Satoshi OTA <[email protected]>

---------

Signed-off-by: Go Sakayori <[email protected]>
Co-authored-by: Satoshi OTA <[email protected]>
fix(bpp): calcDistanceToRedTrafficLight null

Signed-off-by: Shumpei Wakabayashi <[email protected]>
… predictor (autowarefoundation#9201)

* refactor: grouping functions

Signed-off-by: Taekjin LEE <[email protected]>

* refactor: grouping parameters

Signed-off-by: Taekjin LEE <[email protected]>

* refactor: rename member road_users_history to road_users_history_

Signed-off-by: Taekjin LEE <[email protected]>

* refactor: separate util functions

Signed-off-by: Taekjin LEE <[email protected]>

* refactor: Add predictor_vru.cpp and utils.cpp to map_based_prediction_node

Signed-off-by: Taekjin LEE <[email protected]>

* refactor: Add explicit template instantiation for removeOldObjectsHistory function

Signed-off-by: Taekjin LEE <[email protected]>

* refactor: Add tf2_geometry_msgs to data_structure

Signed-off-by: Taekjin LEE <[email protected]>

* refactor: Remove unused variables and functions in map_based_prediction_node.cpp

Signed-off-by: Taekjin LEE <[email protected]>

* Update perception/autoware_map_based_prediction/include/map_based_prediction/predictor_vru.hpp

* Apply suggestions from code review

* style(pre-commit): autofix

---------

Signed-off-by: Taekjin LEE <[email protected]>
Co-authored-by: Mamoru Sobue <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
…er (autowarefoundation#8912)

* Moved ndt_omp into ndt_scan_matcher

Signed-off-by: Shintaro Sakoda <[email protected]>

* Added Copyright

Signed-off-by: Shintaro Sakoda <[email protected]>

* style(pre-commit): autofix

* Fixed include

Signed-off-by: Shintaro Sakoda <[email protected]>

* Fixed cast style

Signed-off-by: Shintaro Sakoda <[email protected]>

* Fixed include

Signed-off-by: Shintaro Sakoda <[email protected]>

* Fixed honorific title

Signed-off-by: Shintaro Sakoda <[email protected]>

* Fixed honorific title

Signed-off-by: Shintaro Sakoda <[email protected]>

* style(pre-commit): autofix

* Fixed include hierarchy

Signed-off-by: Shintaro Sakoda <[email protected]>

* style(pre-commit): autofix

* Fixed include hierarchy

Signed-off-by: Shintaro Sakoda <[email protected]>

* style(pre-commit): autofix

* Fixed hierarchy

Signed-off-by: Shintaro Sakoda <[email protected]>

* Fixed NVTP to NVTL

Signed-off-by: Shintaro Sakoda <[email protected]>

* Added cspell:ignore

Signed-off-by: Shintaro Sakoda <[email protected]>

* Fixed miss spell

Signed-off-by: Shintaro Sakoda <[email protected]>

* style(pre-commit): autofix

* Fixed include

Signed-off-by: Shintaro Sakoda <[email protected]>

* Renamed applyFilter

Signed-off-by: Shintaro Sakoda <[email protected]>

* Moved ***_impl.hpp from include/ to src/

Signed-off-by: Shintaro Sakoda <[email protected]>

* style(pre-commit): autofix

* Fixed variable scope

Signed-off-by: Shintaro Sakoda <[email protected]>

* Fixed to pass by reference

Signed-off-by: Shintaro Sakoda <[email protected]>

---------

Signed-off-by: Shintaro Sakoda <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
@github-actions github-actions bot added component:perception Advanced sensor data processing and environment understanding. (auto-assigned) component:localization Vehicle's position determination in its environment. (auto-assigned) component:control Vehicle control algorithms and mechanisms. (auto-assigned) type:ci Continuous Integration (CI) processes and testing. (auto-assigned) component:common Common packages from the autoware-common repository. (auto-assigned) tag:require-cuda-build-and-test and removed component:perception Advanced sensor data processing and environment understanding. (auto-assigned) component:localization Vehicle's position determination in its environment. (auto-assigned) component:control Vehicle control algorithms and mechanisms. (auto-assigned) type:ci Continuous Integration (CI) processes and testing. (auto-assigned) component:common Common packages from the autoware-common repository. (auto-assigned) tag:require-cuda-build-and-test labels Oct 31, 2024
@mkquda mkquda marked this pull request as ready for review November 6, 2024 04:56
@mkquda mkquda added the tag:run-build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Nov 6, 2024
Copy link

codecov bot commented Nov 6, 2024

Codecov Report

Attention: Patch coverage is 51.92308% with 25 lines in your changes missing coverage. Please review.

Project coverage is 29.22%. Comparing base (391beda) to head (ed8cf38).

Files with missing lines Patch % Lines
...are_behavior_path_lane_change_module/src/scene.cpp 28.00% 18 Missing ⚠️
..._path_lane_change_module/src/utils/calculation.cpp 75.00% 3 Missing and 1 partial ⚠️
...behavior_path_lane_change_module/src/interface.cpp 33.33% 2 Missing ⚠️
...havior_path_lane_change_module/src/utils/utils.cpp 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9185      +/-   ##
==========================================
- Coverage   29.29%   29.22%   -0.08%     
==========================================
  Files        1334     1335       +1     
  Lines      102798   103668     +870     
  Branches    39985    40404     +419     
==========================================
+ Hits        30119    30297     +178     
- Misses      69811    70457     +646     
- Partials     2868     2914      +46     
Flag Coverage Δ *Carryforward flag
differential 20.10% <52.38%> (?)
total 29.20% <52.50%> (-0.10%) ⬇️ Carriedforward from 809ccf9

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@maxime-clem maxime-clem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code changes look good, but there are degradation in the evaluation.
The commit history appears to contain some extra commits but I am not sure if this related.

@@ -130,6 +130,10 @@ std::vector<double> calc_lon_acceleration_samples(
const CommonDataPtr & common_data_ptr, const double max_path_velocity,
const double prepare_duration);

double calc_actual_prepare_duration(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to add some docstring to explain the function.

Comment on lines +336 to +340
if (turn_signal_info.turn_signal.command != terminal_turn_signal_info.turn_signal.command) {
signal_activation_time_ = std::nullopt;
} else if (!signal_activation_time_) {
signal_activation_time_ = clock_.now();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is repeated in line 436, maybe wrapping it in a function would be cleaner?

if (current_velocity >= min_lc_velocity) {
return common_data_ptr->lc_param_ptr->minimum_prepare_duration;
}
const auto max_acc = common_data_ptr->bpp_param_ptr->max_acc;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have max acc from bpp param and max acc from lane change param.
Just curious why only max acc from bpp param is considered.

return common_data_ptr->lc_param_ptr->minimum_prepare_duration;
}
const auto max_acc = common_data_ptr->bpp_param_ptr->max_acc;
return (min_lc_velocity - current_velocity) / max_acc;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there mighttt be possibility max_acc = 0.0? should we place a guard or something?

Comment on lines +920 to +922
const auto & time_resolution = lc_param_ptr->prediction_time_resolution;
const auto & velocity_threshold = lc_param_ptr->stopped_object_velocity_threshold;
const auto & prepare_duration = common_data_ptr->transient_data.lane_change_prepare_duration;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const auto & time_resolution = lc_param_ptr->prediction_time_resolution;
const auto & velocity_threshold = lc_param_ptr->stopped_object_velocity_threshold;
const auto & prepare_duration = common_data_ptr->transient_data.lane_change_prepare_duration;
const auto time_resolution = lc_param_ptr->prediction_time_resolution;
const auto velocity_threshold = lc_param_ptr->stopped_object_velocity_threshold;
const auto prepare_duration = common_data_ptr->transient_data.lane_change_prepare_duration;

…-prepare-duration-when-blinker-has-been-activated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:planning Route planning, decision-making, and navigation. (auto-assigned) tag:run-build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) type:documentation Creating or refining documentation. (auto-assigned)
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

9 participants