Skip to content

Commit

Permalink
fix(lane_departure_checker): fix trajectory resampling logic to keep …
Browse files Browse the repository at this point in the history
…given interval (#10221)

* fix(lane_departure_checker): fix trajectory resampling logic to keep given interval

Signed-off-by: kyoichi-sugahara <kyoichi.sugahara@tier4.jp>

* test(lane_departure_checker): add test case for consecutive small distances followed by large distance

Signed-off-by: kyoichi-sugahara <kyoichi.sugahara@tier4.jp>

---------

Signed-off-by: kyoichi-sugahara <kyoichi.sugahara@tier4.jp>
  • Loading branch information
kyoichi-sugahara authored Mar 4, 2025
1 parent 9d61ff1 commit 6ef2396
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,8 @@ TrajectoryPoints resampleTrajectory(const Trajectory & trajectory, const double

if (boost::geometry::distance(prev_point.to_2d(), next_point.to_2d()) >= interval) {
resampled.push_back(traj_point);
prev_point = next_point;
}

prev_point = next_point;
}
resampled.push_back(trajectory.points.back());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,10 @@ INSTANTIATE_TEST_SUITE_P(
"IntervalIsGreaterThanDistance",
{{1.0, 0.0, 0.0}, {2.0, 0.0, 0.0}, {3.0, 0.0, 0.0}},
1.5,
{{1.0, 0.0, 0.0}, {3.0, 0.0, 0.0}}}),
{{1.0, 0.0, 0.0}, {3.0, 0.0, 0.0}}},
ResampleTrajectoryTestParam{
"ConsecutiveSmallDistancesFollowedByLargeDistance",
{{0.0, 0.0, 0.0}, {0.7, 0.0, 0.0}, {1.3, 0.0, 0.0}, {3.0, 0.0, 0.0}},
1.0,
{{0.0, 0.0, 0.0}, {1.3, 0.0, 0.0}, {3.0, 0.0, 0.0}}}),
::testing::PrintToStringParamName());

0 comments on commit 6ef2396

Please sign in to comment.