Skip to content

Commit 1a9d2d8

Browse files
fix(avoidance): don't insert stop line if the ego can't avoid or return (autowarefoundation#9089) (#1592)
* fix(avoidance): don't insert stop line if the ego can't avoid or return (autowarefoundation#9089) * fix(avoidance): don't insert stop line if the ego can't avoid or return Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com> * fix: build error Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com> * Update planning/behavior_path_planner/autoware_behavior_path_static_obstacle_avoidance_module/include/autoware/behavior_path_static_obstacle_avoidance_module/helper.hpp Co-authored-by: Go Sakayori <go-sakayori@users.noreply.github.com> --------- Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com> Co-authored-by: Go Sakayori <go-sakayori@users.noreply.github.com> * fix: build error Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com> --------- Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com> Co-authored-by: Go Sakayori <go-sakayori@users.noreply.github.com>
1 parent a7e68a1 commit 1a9d2d8

File tree

2 files changed

+32
-0
lines changed
  • planning/behavior_path_avoidance_module

2 files changed

+32
-0
lines changed

planning/behavior_path_avoidance_module/include/behavior_path_avoidance_module/helper.hpp

+13
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,19 @@ class AvoidanceHelper
312312
});
313313
}
314314

315+
bool isFeasible(const AvoidLineArray & shift_lines) const
316+
{
317+
constexpr double JERK_BUFFER = 0.1; // [m/sss]
318+
const auto & values = parameters_->velocity_map;
319+
const auto idx = getConstraintsMapIndex(0.0, values); // use minimum avoidance speed
320+
const auto jerk_limit = parameters_->lateral_max_jerk_map.at(idx);
321+
return std::all_of(shift_lines.begin(), shift_lines.end(), [&](const auto & line) {
322+
return PathShifter::calcJerkFromLatLonDistance(
323+
line.getRelativeLength(), line.getRelativeLongitudinal(), values.at(idx)) <
324+
jerk_limit + JERK_BUFFER;
325+
});
326+
}
327+
315328
bool isReady(const ObjectDataArray & objects) const
316329
{
317330
if (objects.empty()) {

planning/behavior_path_avoidance_module/src/scene.cpp

+19
Original file line numberDiff line numberDiff line change
@@ -1505,6 +1505,11 @@ void AvoidanceModule::insertReturnDeadLine(
15051505
{
15061506
const auto & data = avoid_data_;
15071507

1508+
if (data.new_shift_line.empty()) {
1509+
RCLCPP_WARN(getLogger(), "module doesn't have return shift line.");
1510+
return;
1511+
}
1512+
15081513
if (data.to_return_point > planner_data_->parameters.forward_path_length) {
15091514
RCLCPP_DEBUG(getLogger(), "return dead line is far enough.");
15101515
return;
@@ -1517,6 +1522,11 @@ void AvoidanceModule::insertReturnDeadLine(
15171522
return;
15181523
}
15191524

1525+
if (!helper_->isFeasible(data.new_shift_line)) {
1526+
RCLCPP_WARN(getLogger(), "return shift line is not feasible. do nothing..");
1527+
return;
1528+
}
1529+
15201530
// Consider the difference in path length between the shifted path and original path (the path
15211531
// that is shifted inward has a shorter distance to the end of the path than the other one.)
15221532
const auto & to_reference_path_end = data.arclength_from_ego.back();
@@ -1527,6 +1537,10 @@ void AvoidanceModule::insertReturnDeadLine(
15271537
const auto min_return_distance =
15281538
helper_->getMinAvoidanceDistance(shift_length) + helper_->getMinimumPrepareDistance();
15291539
const auto to_stop_line = data.to_return_point - min_return_distance - buffer;
1540+
if (to_stop_line < 0.0) {
1541+
RCLCPP_WARN(getLogger(), "ego overran return shift dead line. do nothing.");
1542+
return;
1543+
}
15301544

15311545
// If we don't need to consider deceleration constraints, insert a deceleration point
15321546
// and return immediately
@@ -1594,6 +1608,11 @@ void AvoidanceModule::insertWaitPoint(
15941608
return;
15951609
}
15961610

1611+
if (data.to_stop_line < 0.0) {
1612+
RCLCPP_WARN(getLogger(), "ego overran avoidance dead line. do nothing.");
1613+
return;
1614+
}
1615+
15971616
// If we don't need to consider deceleration constraints, insert a deceleration point
15981617
// and return immediately
15991618
if (!use_constraints_for_decel) {

0 commit comments

Comments
 (0)