Skip to content

Commit

Permalink
fix(avoidance): don't output new candidate path if there is huge offs…
Browse files Browse the repository at this point in the history
…et between the ego and previous output path

Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com>
  • Loading branch information
satoshi-ota committed Jul 3, 2023
1 parent fbd4032 commit 9b3bcd6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ struct AvoidanceParameters
// transit hysteresis (unsafe to safe)
double safety_check_hysteresis_factor;

// don't output new candidate path if the offset between ego and path is larger than this.
double safety_check_ego_offset;

// keep target velocity in yield maneuver
double yield_velocity;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2489,6 +2489,23 @@ BehaviorModuleOutput AvoidanceModule::plan()
resetPathCandidate();
resetPathReference();

// don't output new candidate path if the offset between the ego and previous output path is
// larger than threshold.
// TODO(Satoshi OTA): remove this workaround
{
const size_t ego_seg_idx =
planner_data_->findEgoSegmentIndex(helper_.getPreviousSplineShiftPath().path.points);
const auto offset = std::abs(motion_utils::calcLateralOffset(
helper_.getPreviousSplineShiftPath().path.points, getEgoPosition(), ego_seg_idx));

if (offset > parameters_->safety_check_ego_offset) {
avoidance_data_.safe_new_sl.clear();
RCLCPP_WARN_THROTTLE(
getLogger(), *clock_, 1000,
"there is huge offset between ego and previous path. don't throw new candidate path.");
}
}

/**
* Has new shift point?
* Yes -> Is it approved?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ AvoidanceModuleManager::AvoidanceModuleManager(
p.safety_check_accel_for_rss = get_parameter<double>(node, ns + "safety_check_accel_for_rss");
p.safety_check_hysteresis_factor =
get_parameter<double>(node, ns + "safety_check_hysteresis_factor");
p.safety_check_ego_offset = get_parameter<double>(node, ns + "safety_check_ego_offset");
}

// avoidance maneuver (lateral)
Expand Down

0 comments on commit 9b3bcd6

Please sign in to comment.