Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(behavior_path_planner): add avoid_margin for over distance case #2198

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -559,8 +559,7 @@ AvoidLineArray AvoidanceModule::calcRawShiftLinesFromObjects(const ObjectDataArr
const auto & vehicle_width = planner_data_->parameters.vehicle_width;
const auto & road_shoulder_safety_margin = parameters_->road_shoulder_safety_margin;

const auto avoid_margin =
lat_collision_safety_buffer + lat_collision_margin + 0.5 * vehicle_width;
auto avoid_margin = lat_collision_safety_buffer + lat_collision_margin + 0.5 * vehicle_width;

AvoidLineArray avoid_lines;
std::vector<AvoidanceDebugMsg> avoidance_debug_msg_array;
Expand All @@ -583,9 +582,16 @@ AvoidLineArray AvoidanceModule::calcRawShiftLinesFromObjects(const ObjectDataArr
avoidance_debug_msg.to_furthest_linestring_distance = o.to_road_shoulder_distance;
avoidance_debug_msg.max_shift_length = max_allowable_lateral_distance;

if (max_allowable_lateral_distance <= avoid_margin) {
avoidance_debug_array_false_and_push_back(AvoidanceDebugFactor::INSUFFICIENT_LATERAL_MARGIN);
continue;
auto const min_safety_lateral_distance = lat_collision_safety_buffer + 0.5 * vehicle_width;

if (max_allowable_lateral_distance < avoid_margin) {
if (max_allowable_lateral_distance >= min_safety_lateral_distance) {
avoid_margin = max_allowable_lateral_distance;
} else {
avoidance_debug_array_false_and_push_back(
AvoidanceDebugFactor::INSUFFICIENT_LATERAL_MARGIN);
continue;
}
}

const auto is_object_on_right = isOnRight(o);
Expand Down