Skip to content

Commit 3123d3b

Browse files
soblinyhisaki
authored andcommitted
refactor(goal_planner): remove enable_safety_check because it is default (autowarefoundation#10052)
Signed-off-by: Mamoru Sobue <mamoru.sobue@tier4.jp>
1 parent 76cd06a commit 3123d3b

File tree

4 files changed

+16
-26
lines changed

4 files changed

+16
-26
lines changed

planning/behavior_path_planner/autoware_behavior_path_goal_planner_module/README.md

-1
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,6 @@ In addition, the safety check has a time hysteresis, and if the path is judged "
384384

385385
| Name | Unit | Type | Description | Default value |
386386
| :----------------------------------- | :---- | :----- | :------------------------------------------------------------------------------------------------------- | :--------------------------- |
387-
| enable_safety_check | [-] | bool | flag whether to use safety check | true |
388387
| method | [-] | string | method for safety check. `RSS` or `integral_predicted_polygon` | `integral_predicted_polygon` |
389388
| keep_unsafe_time | [s] | double | safety check Hysteresis time. if the path is judged "safe" for the time it is finally treated as "safe". | 3.0 |
390389
| check_all_predicted_path | - | bool | Flag to check all predicted paths | true |

planning/behavior_path_planner/autoware_behavior_path_goal_planner_module/src/decision_state.cpp

+12-17
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,18 @@ PathDecisionState PathDecisionStateController::get_next_state(
5757
auto next_state = current_state_;
5858

5959
// update safety
60-
if (!parameters.safety_check_params.enable_safety_check) {
61-
next_state.is_stable_safe = true;
62-
} else {
63-
if (is_current_safe) {
64-
if (!next_state.safe_start_time) {
65-
next_state.safe_start_time = now;
66-
next_state.is_stable_safe = false;
67-
} else {
68-
next_state.is_stable_safe =
69-
((now - next_state.safe_start_time.value()).seconds() >
70-
parameters.safety_check_params.keep_unsafe_time);
71-
}
72-
} else {
73-
next_state.safe_start_time = std::nullopt;
60+
if (is_current_safe) {
61+
if (!next_state.safe_start_time) {
62+
next_state.safe_start_time = now;
7463
next_state.is_stable_safe = false;
64+
} else {
65+
next_state.is_stable_safe =
66+
((now - next_state.safe_start_time.value()).seconds() >
67+
parameters.safety_check_params.keep_unsafe_time);
7568
}
69+
} else {
70+
next_state.safe_start_time = std::nullopt;
71+
next_state.is_stable_safe = false;
7672
}
7773

7874
// Once this function returns true, it will continue to return true thereafter
@@ -87,10 +83,9 @@ PathDecisionState PathDecisionStateController::get_next_state(
8783
}
8884

8985
const auto & pull_over_path = pull_over_path_opt.value();
90-
const bool enable_safety_check = parameters.safety_check_params.enable_safety_check;
9186
// If it is dangerous against dynamic objects before approval, do not determine the path.
9287
// This eliminates a unsafe path to be approved
93-
if (enable_safety_check && !next_state.is_stable_safe && !is_activated) {
88+
if (!next_state.is_stable_safe && !is_activated) {
9489
RCLCPP_DEBUG(
9590
logger_,
9691
"[DecidingPathStatus]: NOT_DECIDED. path is not safe against dynamic objects before "
@@ -132,7 +127,7 @@ PathDecisionState PathDecisionStateController::get_next_state(
132127
return next_state;
133128
}
134129

135-
if (enable_safety_check && !next_state.is_stable_safe) {
130+
if (!next_state.is_stable_safe) {
136131
RCLCPP_DEBUG(
137132
logger_,
138133
"[DecidingPathStatus]: DECIDING->NOT_DECIDED. path is not safe against dynamic objects");

planning/behavior_path_planner/autoware_behavior_path_goal_planner_module/src/goal_planner_module.cpp

-5
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,6 @@ GoalPlannerModule::GoalPlannerModule(
7979
is_lane_parking_cb_running_{false},
8080
is_freespace_parking_cb_running_{false}
8181
{
82-
// TODO(soblin): remove safety_check_params.enable_safety_check because it does not make sense
83-
if (!parameters_.safety_check_params.enable_safety_check) {
84-
throw std::domain_error("goal_planner never works without safety check");
85-
}
86-
8782
occupancy_grid_map_ = std::make_shared<OccupancyGridBasedCollisionDetector>();
8883

8984
// planner when goal modification is not allowed

planning/behavior_path_planner/autoware_behavior_path_goal_planner_module/src/manager.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,10 @@ GoalPlannerParameters GoalPlannerModuleManager::initGoalPlannerParameters(
368368
{
369369
p.safety_check_params.enable_safety_check =
370370
node->declare_parameter<bool>(safety_check_ns + "enable_safety_check");
371+
// NOTE(soblin): remove safety_check_params.enable_safety_check because it does not make sense
372+
if (!p.safety_check_params.enable_safety_check) {
373+
throw std::domain_error("goal_planner never works without safety check");
374+
}
371375
p.safety_check_params.keep_unsafe_time =
372376
node->declare_parameter<double>(safety_check_ns + "keep_unsafe_time");
373377
p.safety_check_params.method = node->declare_parameter<std::string>(safety_check_ns + "method");
@@ -786,9 +790,6 @@ void GoalPlannerModuleManager::updateModuleParams(
786790
// SafetyCheckParams
787791
const std::string safety_check_ns = path_safety_check_ns + "safety_check_params.";
788792
{
789-
updateParam<bool>(
790-
parameters, safety_check_ns + "enable_safety_check",
791-
p->safety_check_params.enable_safety_check);
792793
updateParam<double>(
793794
parameters, safety_check_ns + "keep_unsafe_time", p->safety_check_params.keep_unsafe_time);
794795
updateParam<std::string>(parameters, safety_check_ns + "method", p->safety_check_params.method);

0 commit comments

Comments
 (0)