Skip to content

Commit

Permalink
fix(behavior_velocity): fix detection_area findForwardOffsetSegment (a…
Browse files Browse the repository at this point in the history
…utowarefoundation#305)

Signed-off-by: kosuke55 <kosuke.tnp@gmail.com>
  • Loading branch information
kosuke55 authored and satoshi-ota committed May 20, 2022
1 parent 79d6019 commit 192aabc
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,13 @@ boost::optional<PathIndexWithOffset> findForwardOffsetSegment(
const auto p_front = to_bg2d(path.points.at(i).point.pose.position);
const auto p_back = to_bg2d(path.points.at(i + 1).point.pose.position);

sum_length += bg::distance(p_front, p_back);
const auto segment_length = bg::distance(p_front, p_back);
sum_length += segment_length;

// If it's over offset point, return front index and remain offset length
if (sum_length >= offset_length) {
return std::make_pair(i, sum_length - offset_length);
const auto remain_length = sum_length - offset_length;
return std::make_pair(i, segment_length - remain_length);
}
}

Expand Down

0 comments on commit 192aabc

Please sign in to comment.