-
Notifications
You must be signed in to change notification settings - Fork 682
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
refactor(lane_change): refactor getLaneChangePaths function #8909
refactor(lane_change): refactor getLaneChangePaths function #8909
Conversation
Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp>
…f-lane-change-module
Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp>
Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp>
…f-lane-change-module
Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp>
…f-lane-change-module
Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp>
…f-lane-change-module
…f-lane-change-module
Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp>
…f-lane-change-module
Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp>
Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp>
…f-lane-change-module
Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp>
Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp>
Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp>
…ule' into RT1-7829-refactor-code-get-lane-change-paths
…trics Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp>
Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp>
Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp>
Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp>
Thank you for contributing to the Autoware project! 🚧 If your pull request is in progress, switch it to draft mode. Please ensure:
|
…-paths Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only checked the code and it looks good.
The CI failure is caused by a random test failure so re-running it should fix the issue. (the random failure is supposed to be fixed by #8799 but I guess not).
...ng/behavior_path_planner/autoware_behavior_path_lane_change_module/src/utils/calculation.cpp
Outdated
Show resolved
Hide resolved
...ng/behavior_path_planner/autoware_behavior_path_lane_change_module/src/utils/calculation.cpp
Outdated
Show resolved
Hide resolved
planning/behavior_path_planner/autoware_behavior_path_lane_change_module/src/scene.cpp
Outdated
Show resolved
Hide resolved
Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp>
Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp>
Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp>
Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp>
…-paths Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp>
Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp>
Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp>
planning/autoware_route_handler/include/autoware/route_handler/route_handler.hpp
Outdated
Show resolved
Hide resolved
planning/behavior_path_planner/autoware_behavior_path_lane_change_module/README.md
Outdated
Show resolved
Hide resolved
Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp>
Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp>
Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. LGTM!
…foundation#8909) * refactor lane change utility funcions Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * LC utility function to get distance to next regulatory element Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * don't activate LC module when close to regulatory element Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * modify threshold distance calculation Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * move regulatory element check to canTransitFailureState() function Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * always run LC module if approaching terminal point Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * use max possible LC length as threshold Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * update LC readme Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * refactor implementation Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * update readme Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * refactor checking data validity Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * refactor sampling of prepare phase metrics and lane changing phase metrics Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * add route handler function to get pose from 2d arc length Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * refactor candidate path generation Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * refactor candidate path safety check Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * fix variable name Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * Update planning/autoware_route_handler/src/route_handler.cpp Co-authored-by: Zulfaqar Azmi <93502286+zulfaqar-azmi-t4@users.noreply.github.com> * correct parameter name Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * set prepare segment velocity after taking max path velocity value Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * update LC README Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * minor changes Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * check phase length difference with previos valid candidate path Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * change logger name Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * change functions names to snake case Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * use snake case for function names Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * add colors to flow chart in README Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> --------- Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> Co-authored-by: Zulfaqar Azmi <93502286+zulfaqar-azmi-t4@users.noreply.github.com> Signed-off-by: prakash-kannaiah <prakashkanan.pk@gmail.com>
…foundation#8909) * refactor lane change utility funcions Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * LC utility function to get distance to next regulatory element Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * don't activate LC module when close to regulatory element Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * modify threshold distance calculation Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * move regulatory element check to canTransitFailureState() function Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * always run LC module if approaching terminal point Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * use max possible LC length as threshold Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * update LC readme Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * refactor implementation Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * update readme Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * refactor checking data validity Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * refactor sampling of prepare phase metrics and lane changing phase metrics Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * add route handler function to get pose from 2d arc length Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * refactor candidate path generation Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * refactor candidate path safety check Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * fix variable name Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * Update planning/autoware_route_handler/src/route_handler.cpp Co-authored-by: Zulfaqar Azmi <93502286+zulfaqar-azmi-t4@users.noreply.github.com> * correct parameter name Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * set prepare segment velocity after taking max path velocity value Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * update LC README Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * minor changes Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * check phase length difference with previos valid candidate path Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * change logger name Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * change functions names to snake case Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * use snake case for function names Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * add colors to flow chart in README Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> --------- Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> Co-authored-by: Zulfaqar Azmi <93502286+zulfaqar-azmi-t4@users.noreply.github.com>
…foundation#8909) * refactor lane change utility funcions Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * LC utility function to get distance to next regulatory element Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * don't activate LC module when close to regulatory element Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * modify threshold distance calculation Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * move regulatory element check to canTransitFailureState() function Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * always run LC module if approaching terminal point Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * use max possible LC length as threshold Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * update LC readme Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * refactor implementation Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * update readme Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * refactor checking data validity Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * refactor sampling of prepare phase metrics and lane changing phase metrics Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * add route handler function to get pose from 2d arc length Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * refactor candidate path generation Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * refactor candidate path safety check Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * fix variable name Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * Update planning/autoware_route_handler/src/route_handler.cpp Co-authored-by: Zulfaqar Azmi <93502286+zulfaqar-azmi-t4@users.noreply.github.com> * correct parameter name Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * set prepare segment velocity after taking max path velocity value Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * update LC README Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * minor changes Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * check phase length difference with previos valid candidate path Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * change logger name Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * change functions names to snake case Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * use snake case for function names Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * add colors to flow chart in README Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> --------- Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> Co-authored-by: Zulfaqar Azmi <93502286+zulfaqar-azmi-t4@users.noreply.github.com>
…foundation#8909) * refactor lane change utility funcions Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * LC utility function to get distance to next regulatory element Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * don't activate LC module when close to regulatory element Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * modify threshold distance calculation Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * move regulatory element check to canTransitFailureState() function Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * always run LC module if approaching terminal point Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * use max possible LC length as threshold Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * update LC readme Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * refactor implementation Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * update readme Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * refactor checking data validity Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * refactor sampling of prepare phase metrics and lane changing phase metrics Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * add route handler function to get pose from 2d arc length Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * refactor candidate path generation Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * refactor candidate path safety check Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * fix variable name Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * Update planning/autoware_route_handler/src/route_handler.cpp Co-authored-by: Zulfaqar Azmi <93502286+zulfaqar-azmi-t4@users.noreply.github.com> * correct parameter name Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * set prepare segment velocity after taking max path velocity value Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * update LC README Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * minor changes Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * check phase length difference with previos valid candidate path Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * change logger name Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * change functions names to snake case Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * use snake case for function names Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * add colors to flow chart in README Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> --------- Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> Co-authored-by: Zulfaqar Azmi <93502286+zulfaqar-azmi-t4@users.noreply.github.com>
Description
The function
getLaneChangePaths
in LC module is the main part of LC code and is responsible for sampling different candidate paths and verifying the validity and safety of the candidate path. However the function is very big and complex, which makes it difficult to understand and modify.This PR aims to refactor the
getLaneChangePaths
function to improve code readability and granularity and reduce its complexity.Changes
PhaseMetrics
to group relevant measurements (duration, length, velocity, lon. acc, lat. acc) for LC phasescalc_prepare_phase_metrics
to compute and return a list of sampled prepare phase metricscalc_shift_phase_metrics
to compute and return a list of sampled lane changing phase metricsgetCandidatePath
to process LC info and construct the cadidate pathcheckCandidatePathSafety
to verify LC candidate pathFlowchart of getLaneChangePaths function after refactoring
![Untitled Diagram](https://private-user-images.githubusercontent.com/168697710/368839913-5976880a-b789-4da9-aadd-dfcd03add895.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1OTE3MDUsIm5iZiI6MTczOTU5MTQwNSwicGF0aCI6Ii8xNjg2OTc3MTAvMzY4ODM5OTEzLTU5NzY4ODBhLWI3ODktNGRhOS1hYWRkLWRmY2QwM2FkZDg5NS5qcGc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE1JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNVQwMzUwMDVaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT03ZTQzY2NhYmJlZWM4MTAwYmQwMWQ4NTE3Y2E2MjRmMjMzMGU0ZDI2ODg0YzUyNWZiYTBiMmI5NjgzMzJiMWZmJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.QHYkfkRh_GfRWOJxg5VK1REgbxSABM63nHniS1GE6CY)
Related links
None.
How was this PR tested?
Notes for reviewers
None.
Interface changes
None.
Effects on system behavior
None.