Skip to content

Commit

Permalink
fix(obsacle_stop_planner): maintain using of first_outside_idx in cas…
Browse files Browse the repository at this point in the history
…e index with margin cannot be calculated

Signed-off-by: AhmedEbrahim <ahmed.a.d.ebrahim@gmail.com>
  • Loading branch information
ahmeddesokyebrahim committed Jul 14, 2023
1 parent efff8c3 commit 5b087c9
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions planning/obstacle_avoidance_planner/src/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,17 +449,18 @@ void ObstacleAvoidancePlanner::insertZeroVelocityOutsideDrivableArea(

if (enable_outside_drivable_area_stop_) {
if (first_outside_idx) {
auto stop_idx = *first_outside_idx;
const auto dist = tier4_autoware_utils::calcDistance2d(
optimized_traj_points.at(0), optimized_traj_points.at(*first_outside_idx));

optimized_traj_points.at(0), optimized_traj_points.at(stop_idx));
const auto dist_with_margin = dist - vehicle_stop_margin_outside_drivable_area_;
const auto stop_idx = motion_utils::insertStopPoint(dist_with_margin, optimized_traj_points);

if (stop_idx) {
publishVirtualWall(optimized_traj_points.at(*stop_idx).pose);
for (size_t i = *stop_idx; i < optimized_traj_points.size(); ++i) {
optimized_traj_points.at(i).longitudinal_velocity_mps = 0.0;
}
const auto first_outside_idx_with_margin =
motion_utils::insertStopPoint(dist_with_margin, optimized_traj_points);
if (first_outside_idx_with_margin) {
stop_idx = *first_outside_idx_with_margin;
}
publishVirtualWall(optimized_traj_points.at(stop_idx).pose);
for (size_t i = stop_idx; i < optimized_traj_points.size(); ++i) {
optimized_traj_points.at(i).longitudinal_velocity_mps = 0.0;
}
}
}
Expand Down

0 comments on commit 5b087c9

Please sign in to comment.