Skip to content

Commit

Permalink
fix(behavior_velocity): fix detection_area findForwardOffsetSegment
Browse files Browse the repository at this point in the history
  • Loading branch information
kosuke55 committed Jan 26, 2022
1 parent 45446dd commit a554e6e
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,13 @@ boost::optional<PathIndexWithOffset> findBackwardOffsetSegment(
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) {
const auto k = static_cast<std::size_t>(i);
return std::make_pair(k, 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 a554e6e

Please sign in to comment.