-
Notifications
You must be signed in to change notification settings - Fork 667
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(start_planner): refactor debug and safety check logic #5747
refactor(start_planner): refactor debug and safety check logic #5747
Conversation
e8f31b7
to
679b365
Compare
planning/behavior_path_planner/src/scene_module/start_planner/start_planner_module.cpp
Show resolved
Hide resolved
planning/behavior_path_planner/config/start_planner/start_planner.param.yaml
Show resolved
Hide resolved
if (receivedNewRoute()) { | ||
resetStatus(); | ||
DEBUG_PRINT("StartPlannerModule::updateData() received new route, reset status"); | ||
} | ||
|
||
if (hasFinishedBackwardDriving()) { | ||
updateStatusAfterBackwardDriving(); | ||
DEBUG_PRINT("StartPlannerModule::updateData() completed backward driving"); | ||
} else { | ||
status_.backward_driving_complete = false; | ||
} | ||
|
||
if (receivedNewRoute()) { | ||
status_ = PullOutStatus(); | ||
} | ||
// check safety status when driving forward | ||
if (parameters_->safety_check_params.enable_safety_check && status_.driving_forward) { | ||
status_.is_safe_dynamic_objects = isSafePath(); | ||
} else { | ||
status_.is_safe_dynamic_objects = true; | ||
status_.is_safe_dynamic_objects = checkCollisionWithDynamicObjects(); | ||
} |
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.
is it ok to change the order of processing?
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.
If there's no need for hasFinishedBackwardDriving() to be executed first, then this change is ok
bool StartPlannerModule::checkCollisionWithDynamicObjects() const | ||
{ | ||
return !(parameters_->safety_check_params.enable_safety_check && status_.driving_forward) || | ||
isSafePath(); | ||
} | ||
|
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.
the following function returns true when a collision is detected.
but checkCollisionWithDynamicObjects
is the opposite.
if (utils::checkCollisionBetweenFootprintAndObjects(
local_vehicle_footprint, *backed_pose, stop_objects_in_pull_out_lanes,
parameters_->collision_check_margin)) {
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.
changed to hasCollisionWithDynamicObjects()
this parameters is updated in processing, so is not parameters.
|
const bool is_safe = | ||
status_.found_pull_out_path && (!isWaitingApproval() || checkCollisionWithDynamicObjects()); |
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.
The nested bool calculation is complicated because we need to see 5 bool values at same
status_.found_pull_out_path && (!isWaitingApproval() || !(parameters_->safety_check_params.enable_safety_check && status_.driving_forward) || isSafePath()
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.
maybe it is easier to understand if the condition match with the comments.
const bool is_safe =
!(status_.found_pull_out_path || (isWaitingApproval() && !checkCollisionWithDynamicObjects());
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.
changed as follows
// Evaluate safety. The situation is not safe if any of the following conditions are met:
// 1. pull out path has not been found
// 2. waiting for approval and there is a collision with dynamic objects
if (!status_.found_pull_out_path) {
is_safe = false;
}
if (requiresDynamicObjectsCollisionDetection()) {
is_safe = !hasCollisionWithDynamicObjects();
}
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.
why not just is_safe = isSafePath();
? 🙏
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.
hasCollisionWithDynamicObjects
is currently just !isSafePath();
but will be updated as TODO in other PR?
bool StartPlannerModule::hasCollisionWithDynamicObjects() const
{
// TODO(Sugahara): update path, params for predicted path and so on in this function to avoid
// mutable
return !isSafePath();
}
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.
asCollisionWithDynamicObjects is currently just !isSafePath(); but will be updated as TODO in other PR?
Yes I mean that.
want to separate object filetering part and create predicted path part from isSafe()
function
415bd96
to
f4f0184
Compare
Signed-off-by: kyoichi-sugahara <[email protected]>
@kosuke55 |
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.
LGTM! thanks!
7b11633
into
autowarefoundation:main
…arefoundation#5747) * refactor(start_planner): refactor debug and safety check logic This commit refactors the start_planner module in several ways: - The verbose parameter is removed from the YAML configuration file and replaced with a print_debug_info parameter under a new debug section. - A new function, initVariables(), is introduced to initialize member variables, which is called during processOnEntry() and processOnExit(). - The function isBackwardDrivingComplete() is renamed to hasFinishedBackwardDriving() to better reflect its purpose. It also includes additional debug prints. - A new function, checkCollisionWithDynamicObjects(), is introduced to encapsulate the logic for checking collisions with dynamic objects. - The function isExecutionReady() is modified to use the new checkCollisionWithDynamicObjects() function. - The function resetStatus() is simplified by directly assigning an empty PullOutStatus object to status_. - The function updatePullOutStatus() now uses the new hasFinishedBackwardDriving() function. - The logging of pull out status is now controlled by the new print_debug_info parameter rather than the removed verbose parameter. These changes improve the clarity of the code and make it easier to control debug output. Signed-off-by: kyoichi-sugahara <[email protected]> --------- Signed-off-by: kyoichi-sugahara <[email protected]>
…arefoundation#5747) * refactor(start_planner): refactor debug and safety check logic This commit refactors the start_planner module in several ways: - The verbose parameter is removed from the YAML configuration file and replaced with a print_debug_info parameter under a new debug section. - A new function, initVariables(), is introduced to initialize member variables, which is called during processOnEntry() and processOnExit(). - The function isBackwardDrivingComplete() is renamed to hasFinishedBackwardDriving() to better reflect its purpose. It also includes additional debug prints. - A new function, checkCollisionWithDynamicObjects(), is introduced to encapsulate the logic for checking collisions with dynamic objects. - The function isExecutionReady() is modified to use the new checkCollisionWithDynamicObjects() function. - The function resetStatus() is simplified by directly assigning an empty PullOutStatus object to status_. - The function updatePullOutStatus() now uses the new hasFinishedBackwardDriving() function. - The logging of pull out status is now controlled by the new print_debug_info parameter rather than the removed verbose parameter. These changes improve the clarity of the code and make it easier to control debug output. Signed-off-by: kyoichi-sugahara <[email protected]> --------- Signed-off-by: kyoichi-sugahara <[email protected]> Signed-off-by: karishma <[email protected]>
…arefoundation#5747) * refactor(start_planner): refactor debug and safety check logic This commit refactors the start_planner module in several ways: - The verbose parameter is removed from the YAML configuration file and replaced with a print_debug_info parameter under a new debug section. - A new function, initVariables(), is introduced to initialize member variables, which is called during processOnEntry() and processOnExit(). - The function isBackwardDrivingComplete() is renamed to hasFinishedBackwardDriving() to better reflect its purpose. It also includes additional debug prints. - A new function, checkCollisionWithDynamicObjects(), is introduced to encapsulate the logic for checking collisions with dynamic objects. - The function isExecutionReady() is modified to use the new checkCollisionWithDynamicObjects() function. - The function resetStatus() is simplified by directly assigning an empty PullOutStatus object to status_. - The function updatePullOutStatus() now uses the new hasFinishedBackwardDriving() function. - The logging of pull out status is now controlled by the new print_debug_info parameter rather than the removed verbose parameter. These changes improve the clarity of the code and make it easier to control debug output. Signed-off-by: kyoichi-sugahara <[email protected]> --------- Signed-off-by: kyoichi-sugahara <[email protected]>
Description
This PR should be merged first!!!
This commit refactors the start_planner module in several ways:
These changes improve the clarity of the code and make it easier to control debug output.
Tests performed
Effects on system behavior
Not applicable.
Pre-review checklist for the PR author
The PR author must check the checkboxes below when creating the PR.
In-review checklist for the PR reviewers
The PR reviewers must check the checkboxes below before approval.
Post-review checklist for the PR author
The PR author must check the checkboxes below before merging.
After all checkboxes are checked, anyone who has write access can merge the PR.