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

HdMapUtils::getStopLinePolygon doesn't check if given lanelet is a stop line #1382

Open
gmajrobotec opened this issue Sep 16, 2024 · 0 comments
Assignees

Comments

@gmajrobotec
Copy link
Contributor

Description
Function “getStopLinePolygon” does not check if “lanelet_id” represents a stopline. Any linesting can be passed and it will be transformed to “std::vector” unconditionally.

To Reproduce

  1. Add this testcase to the test_hdmap_utils.cpp file.
  2. Run the test suite.
  3. In the attached example, the function “getPreviousLanelets” will return a non empty vector for lanelet:Id 34574, which is a linestring on the path, not a stop line.
TEST(HdMapUtils, getStopLinePolygon_example)
{
  const auto hdmap_utils = makeHdMapUtilsSharedPointer();

  const lanelet::Id id = 120635;

  const auto stop_lines = hdmap_utils->getStopLineIdsOnPath(
    lanelet::Ids{34408, 34633, 34579, 34780, 34675, 34744, 34690, 34759, 34576, 34570, 34564});

  const lanelet::Ids actual_stop_lines{id};

  const auto polygon = hdmap_utils->getStopLinePolygon(id);
  const auto polygon_fake = hdmap_utils->getStopLinePolygon(34574);

  EXPECT_EQ(stop_lines, actual_stop_lines);
  EXPECT_TRUE(polygon.size());
  EXPECT_FALSE(polygon_fake.size());
}

Solution
There should be added a check whether the passed lanelet ID is actually a stop line, or a note should be left stating that the “lanelet_id” is assumed to be a stop line, or the function should be renamed to something like “getLineStringPolygon”.

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