Skip to content

Commit

Permalink
fix(avoidance): exit if there is no avoidable object (autowarefoundat…
Browse files Browse the repository at this point in the history
…ion#5051)

Signed-off-by: satoshi-ota <[email protected]>
  • Loading branch information
satoshi-ota committed Oct 10, 2023
1 parent 68346ca commit aaa7281
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,10 @@ bool AvoidanceModule::canTransitSuccessState()
}
}

const bool has_avoidance_target = !data.target_objects.empty();
const bool has_avoidance_target =
std::any_of(data.target_objects.begin(), data.target_objects.end(), [](const auto & o) {
return o.is_avoidable || o.reason == AvoidanceDebugFactor::TOO_LARGE_JERK;
});
const bool has_shift_point = !path_shifter_.getShiftLines().empty();
const bool has_base_offset =
std::abs(path_shifter_.getBaseOffset()) > parameters_->lateral_avoid_check_threshold;
Expand Down Expand Up @@ -3030,6 +3033,12 @@ void AvoidanceModule::insertPrepareVelocity(ShiftedPath & shifted_path) const

const auto object = data.target_objects.front();

const auto enough_space =
object.is_avoidable || object.reason == AvoidanceDebugFactor::TOO_LARGE_JERK;
if (!enough_space) {
return;
}

// calculate shift length for front object.
const auto & vehicle_width = planner_data_->parameters.vehicle_width;
const auto object_type = utils::getHighestProbLabel(object.object.classification);
Expand Down

0 comments on commit aaa7281

Please sign in to comment.