Skip to content

Commit

Permalink
fix(avoidance): don't insert stop line if the ego can't avoid or retu…
Browse files Browse the repository at this point in the history
…rn (autowarefoundation#9089)

* fix(avoidance): don't insert stop line if the ego can't avoid or return

Signed-off-by: satoshi-ota <[email protected]>

* fix: build error

Signed-off-by: satoshi-ota <[email protected]>

* 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 <[email protected]>

---------

Signed-off-by: satoshi-ota <[email protected]>
Co-authored-by: Go Sakayori <[email protected]>
  • Loading branch information
satoshi-ota and go-sakayori authored Oct 17, 2024
1 parent dd6e677 commit 92868c0
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,19 @@ class AvoidanceHelper
});
}

bool isFeasible(const AvoidLineArray & shift_lines) const
{
constexpr double JERK_BUFFER = 0.1; // [m/sss]
const auto & values = parameters_->velocity_map;
const auto idx = getConstraintsMapIndex(0.0, values); // use minimum avoidance speed
const auto jerk_limit = parameters_->lateral_max_jerk_map.at(idx);
return std::all_of(shift_lines.begin(), shift_lines.end(), [&](const auto & line) {
return autoware::motion_utils::calc_jerk_from_lat_lon_distance(
line.getRelativeLength(), line.getRelativeLongitudinal(), values.at(idx)) <
jerk_limit + JERK_BUFFER;
});
}

bool isReady(const ObjectDataArray & objects) const
{
if (objects.empty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1630,6 +1630,11 @@ void StaticObstacleAvoidanceModule::insertReturnDeadLine(
universe_utils::ScopedTimeTrack st(__func__, *time_keeper_);
const auto & data = avoid_data_;

if (data.new_shift_line.empty()) {
RCLCPP_WARN(getLogger(), "module doesn't have return shift line.");
return;
}

if (data.to_return_point > planner_data_->parameters.forward_path_length) {
RCLCPP_DEBUG(getLogger(), "return dead line is far enough.");
return;
Expand All @@ -1642,6 +1647,11 @@ void StaticObstacleAvoidanceModule::insertReturnDeadLine(
return;
}

if (!helper_->isFeasible(data.new_shift_line)) {
RCLCPP_WARN(getLogger(), "return shift line is not feasible. do nothing..");
return;
}

// Consider the difference in path length between the shifted path and original path (the path
// that is shifted inward has a shorter distance to the end of the path than the other one.)
const auto & to_reference_path_end = data.arclength_from_ego.back();
Expand All @@ -1652,6 +1662,10 @@ void StaticObstacleAvoidanceModule::insertReturnDeadLine(
const auto min_return_distance =
helper_->getMinAvoidanceDistance(shift_length) + helper_->getNominalPrepareDistance(0.0);
const auto to_stop_line = data.to_return_point - min_return_distance - buffer;
if (to_stop_line < 0.0) {
RCLCPP_WARN(getLogger(), "ego overran return shift dead line. do nothing.");
return;
}

// If we don't need to consider deceleration constraints, insert a deceleration point
// and return immediately
Expand Down Expand Up @@ -1721,6 +1735,11 @@ void StaticObstacleAvoidanceModule::insertWaitPoint(
return;
}

if (data.to_stop_line < 0.0) {
RCLCPP_WARN(getLogger(), "ego overran avoidance dead line. do nothing.");
return;
}

// If we don't need to consider deceleration constraints, insert a deceleration point
// and return immediately
if (!use_constraints_for_decel) {
Expand Down

0 comments on commit 92868c0

Please sign in to comment.