Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible wrong comparson in traffic_simulator::pose::isInLanelet #1377

Open
gmajrobotec opened this issue Sep 12, 2024 · 1 comment
Open
Assignees

Comments

@gmajrobotec
Copy link
Contributor

Description
In traffic_simulator::pose::isInLanelet to compare distance_to_start_lanelet_pose and distance_to_end_lanelet_pose with tolerance operator "<" is used. This can possibly lead to wrong result when tolerance is 0 and one of the measured distances is also 0, which means pose is in lanelet (start or end of it). If this is not expected behaviour operator "<=" should be used.

To Reproduce

  1. Switch to RJD-1197/pose_module. This branch contains needed test file
  2. Add this testcase to the test_pose.cpp file.
  3. Run the test suite.
TEST_F(PoseTest, isInLanelet_end_of_previous_lanelet)
{
  const auto pose =
    traffic_simulator::helper::constructCanonicalizedLaneletPose(3002163, 0.0, 0.0, hdmap_utils);

  const auto end_lanelet_pose = traffic_simulator::helper::constructCanonicalizedLaneletPose(
    195, hdmap_utils->getLaneletLength(195), 0.0, hdmap_utils);
  const auto distance_to_end_lanelet_pose =
    longitudinalDistance(pose, end_lanelet_pose, false, false, false, hdmap_utils);

  ASSERT_TRUE(distance_to_end_lanelet_pose);
  ASSERT_TRUE(std::abs(distance_to_end_lanelet_pose.value()) == 0.0);

  EXPECT_TRUE(traffic_simulator::pose::isInLanelet(pose, 195, 0.0, hdmap_utils));
}

Expected behavior
If pose is at the start or end of lanelet function traffic_simulator::pose::isInLanelet should return true;

@hakuturu583
Copy link
Collaborator

I could not understand what you want to claim in this text.
Please describe source code and it's expected behavior and actual behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants