Skip to content

Commit

Permalink
fix: obstacle stop planner died when path size is 1 (#976)
Browse files Browse the repository at this point in the history
Signed-off-by: tomoya.kimura <[email protected]>
  • Loading branch information
tkimura4 committed May 26, 2022
1 parent b76b6e1 commit 36a77c9
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions planning/obstacle_stop_planner/src/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -781,12 +781,14 @@ void ObstacleStopPlannerNode::insertVelocity(
}
}

for (size_t i = 0; i < output.size() - 2; ++i) {
const auto & p_base = output.at(i).pose;
const auto & p_target = output.at(i + 1).pose;
const auto & p_next = output.at(i + 2).pose;
if (!checkValidIndex(p_base, p_next, p_target)) {
RCLCPP_ERROR(get_logger(), "detect bad index");
if (output.size() >= 2) {
for (size_t i = 0; i < output.size() - 2; ++i) {
const auto & p_base = output.at(i).pose;
const auto & p_target = output.at(i + 1).pose;
const auto & p_next = output.at(i + 2).pose;
if (!checkValidIndex(p_base, p_next, p_target)) {
RCLCPP_ERROR(get_logger(), "detect bad index");
}
}
}

Expand Down

0 comments on commit 36a77c9

Please sign in to comment.