Skip to content

Commit

Permalink
fix(behavior_velocity_planner): int/uint for path index (autowarefoun…
Browse files Browse the repository at this point in the history
…dation#2221)

* fixed int/uint for path index

Signed-off-by: Mamoru Sobue <mamoru.sobue@tier4.jp>

* reflected comments

Signed-off-by: Mamoru Sobue <mamoru.sobue@tier4.jp>

Signed-off-by: Mamoru Sobue <mamoru.sobue@tier4.jp>
Signed-off-by: yoshiri <yoshiyoshidetteiu@gmail.com>
  • Loading branch information
soblin authored and YoshiRi committed Jan 11, 2023
1 parent 07672d9 commit d1c6b2b
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ std::optional<std::pair<size_t, size_t>> findLaneIdInterval(
{
bool found = false;
size_t start = 0;
size_t end = p.points.size() - 1;
size_t end = p.points.size() > 0 ? p.points.size() - 1 : 0;
for (size_t i = 0; i < p.points.size(); ++i) {
if (hasLaneId(p.points.at(i), lane_id)) {
if (!found) {
Expand All @@ -93,7 +93,7 @@ std::optional<std::pair<size_t, size_t>> findLaneIdInterval(
break;
}
}
start = std::max<size_t>(0, start - 1); // the idx of last point before the interval
start = start > 0 ? start - 1 : 0; // the idx of last point before the interval
return found ? std::make_optional(std::make_pair(start, end)) : std::nullopt;
}

Expand Down

0 comments on commit d1c6b2b

Please sign in to comment.