Skip to content

Commit a448307

Browse files
feat(behavior_path_planner): safety check against dynamic objects after approval for start_planner (#5056)
* add stop judgement after approval Signed-off-by: kyoichi-sugahara <kyoichi.sugahara@tier4.jp> * update param Signed-off-by: kyoichi-sugahara <kyoichi.sugahara@tier4.jp> * add status of has_stop_point Signed-off-by: kyoichi-sugahara <kyoichi.sugahara@tier4.jp> --------- Signed-off-by: kyoichi-sugahara <kyoichi.sugahara@tier4.jp>
1 parent 3c5a0b8 commit a448307

File tree

5 files changed

+59
-22
lines changed

5 files changed

+59
-22
lines changed

planning/behavior_path_planner/config/goal_planner/goal_planner.param.yaml

+5-5
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
# detection range
133133
object_check_forward_distance: 10.0
134134
object_check_backward_distance: 100.0
135-
ignore_object_velocity_threshold: 0.0
135+
ignore_object_velocity_threshold: 1.0
136136
# ObjectTypesToCheck
137137
object_types_to_check:
138138
check_car: true
@@ -164,11 +164,11 @@
164164
check_all_predicted_path: true
165165
publish_debug_marker: false
166166
rss_params:
167-
rear_vehicle_reaction_time: 1.0
167+
rear_vehicle_reaction_time: 2.0
168168
rear_vehicle_safety_time_margin: 1.0
169-
lateral_distance_max_threshold: 1.0
170-
longitudinal_distance_min_threshold: 1.0
171-
longitudinal_velocity_delta_time: 1.0
169+
lateral_distance_max_threshold: 2.0
170+
longitudinal_distance_min_threshold: 3.0
171+
longitudinal_velocity_delta_time: 0.8
172172
# hysteresis factor to expand/shrink polygon with the value
173173
hysteresis_factor_expand_rate: 1.0
174174
# temporary

planning/behavior_path_planner/config/start_planner/start_planner.param.yaml

+5-5
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
# detection range
9696
object_check_forward_distance: 10.0
9797
object_check_backward_distance: 100.0
98-
ignore_object_velocity_threshold: 0.0
98+
ignore_object_velocity_threshold: 1.0
9999
# ObjectTypesToCheck
100100
object_types_to_check:
101101
check_car: true
@@ -127,11 +127,11 @@
127127
check_all_predicted_path: true
128128
publish_debug_marker: false
129129
rss_params:
130-
rear_vehicle_reaction_time: 1.0
130+
rear_vehicle_reaction_time: 2.0
131131
rear_vehicle_safety_time_margin: 1.0
132-
lateral_distance_max_threshold: 1.0
133-
longitudinal_distance_min_threshold: 1.0
134-
longitudinal_velocity_delta_time: 1.0
132+
lateral_distance_max_threshold: 2.0
133+
longitudinal_distance_min_threshold: 3.0
134+
longitudinal_velocity_delta_time: 0.8
135135
# hysteresis factor to expand/shrink polygon
136136
hysteresis_factor_expand_rate: 1.0
137137
# temporary

planning/behavior_path_planner/include/behavior_path_planner/scene_module/start_planner/start_planner_module.hpp

+3
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ struct PullOutStatus
6767
false}; // after backward driving is complete, this is set to true (warning: this is set to
6868
// false at next cycle after backward driving is complete)
6969
Pose pull_out_start_pose{};
70+
bool prev_is_safe_dynamic_objects{false};
71+
std::shared_ptr<PathWithLaneId> prev_stop_path_after_approval{nullptr};
72+
bool has_stop_point{false};
7073

7174
PullOutStatus() {}
7275
};

planning/behavior_path_planner/src/scene_module/goal_planner/goal_planner_module.cpp

+1-6
Original file line numberDiff line numberDiff line change
@@ -365,12 +365,7 @@ bool GoalPlannerModule::isExecutionRequested() const
365365

366366
bool GoalPlannerModule::isExecutionReady() const
367367
{
368-
// TODO(Sugahara): should check safe or not but in the current flow, it is not possible.
369-
if (status_.pull_over_path == nullptr) {
370-
return true;
371-
}
372-
373-
if (status_.is_safe_static_objects && parameters_->safety_check_params.enable_safety_check) {
368+
if (parameters_->safety_check_params.enable_safety_check && isWaitingApproval()) {
374369
if (!isSafePath()) {
375370
RCLCPP_ERROR_THROTTLE(getLogger(), *clock_, 5000, "Path is not safe against dynamic objects");
376371
return false;

planning/behavior_path_planner/src/scene_module/start_planner/start_planner_module.cpp

+45-6
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,12 @@ void StartPlannerModule::updateData()
136136
if (has_received_new_route) {
137137
status_ = PullOutStatus();
138138
}
139+
// check safety status after back finished
140+
if (parameters_->safety_check_params.enable_safety_check && status_.back_finished) {
141+
status_.is_safe_dynamic_objects = isSafePath();
142+
} else {
143+
status_.is_safe_dynamic_objects = true;
144+
}
139145
}
140146

141147
bool StartPlannerModule::isExecutionRequested() const
@@ -179,17 +185,19 @@ bool StartPlannerModule::isExecutionRequested() const
179185

180186
bool StartPlannerModule::isExecutionReady() const
181187
{
188+
// when is_safe_static_objects is false,the path is not generated and approval shouldn't be
189+
// allowed
182190
if (!status_.is_safe_static_objects) {
191+
RCLCPP_ERROR_THROTTLE(getLogger(), *clock_, 5000, "Path is not safe against static objects");
183192
return false;
184193
}
185194

186-
if (status_.pull_out_path.partial_paths.empty()) {
187-
return true;
188-
}
189-
190-
if (status_.is_safe_static_objects && parameters_->safety_check_params.enable_safety_check) {
195+
if (
196+
parameters_->safety_check_params.enable_safety_check && status_.back_finished &&
197+
isWaitingApproval()) {
191198
if (!isSafePath()) {
192199
RCLCPP_ERROR_THROTTLE(getLogger(), *clock_, 5000, "Path is not safe against dynamic objects");
200+
stop_pose_ = planner_data_->self_odometry->pose.pose;
193201
return false;
194202
}
195203
}
@@ -221,6 +229,7 @@ void StartPlannerModule::updateCurrentState()
221229
if (status_.backward_driving_complete) {
222230
current_state_ = ModuleStatus::SUCCESS; // for breaking loop
223231
}
232+
224233
print(magic_enum::enum_name(from), magic_enum::enum_name(current_state_));
225234
}
226235

@@ -252,12 +261,42 @@ BehaviorModuleOutput StartPlannerModule::plan()
252261
}
253262

254263
PathWithLaneId path;
264+
265+
// Check if backward motion is finished
255266
if (status_.back_finished) {
267+
// Increment path index if the current path is finished
256268
if (hasFinishedCurrentPath()) {
257269
RCLCPP_INFO(getLogger(), "Increment path index");
258270
incrementPathIndex();
259271
}
260-
path = getCurrentPath();
272+
273+
if (!status_.is_safe_dynamic_objects && !isWaitingApproval() && !status_.has_stop_point) {
274+
auto current_path = getCurrentPath();
275+
const auto stop_path =
276+
behavior_path_planner::utils::start_goal_planner_common::generateFeasibleStopPath(
277+
current_path, planner_data_, *stop_pose_, parameters_->maximum_deceleration_for_stop,
278+
parameters_->maximum_jerk_for_stop);
279+
280+
// Insert stop point in the path if needed
281+
if (stop_path) {
282+
RCLCPP_ERROR_THROTTLE(
283+
getLogger(), *clock_, 5000, "Insert stop point in the path because of dynamic objects");
284+
path = *stop_path;
285+
status_.prev_stop_path_after_approval = std::make_shared<PathWithLaneId>(path);
286+
status_.has_stop_point = true;
287+
} else {
288+
path = current_path;
289+
}
290+
} else if (!isWaitingApproval() && status_.has_stop_point) {
291+
// Delete stop point if conditions are met
292+
if (status_.is_safe_dynamic_objects && isStopped()) {
293+
status_.has_stop_point = false;
294+
path = getCurrentPath();
295+
}
296+
path = *status_.prev_stop_path_after_approval;
297+
} else {
298+
path = getCurrentPath();
299+
}
261300
} else {
262301
path = status_.backward_path;
263302
}

0 commit comments

Comments
 (0)