Skip to content

fix matchWaypointAndLanelet function

Fixed bug

There could be a possible infinite loop in matchWaypointAndLanelet function. This happens when there are no lanelets in the Map or when all lanelets contact with a waypoint.

Description of the bug

matchWaypointAndLanelet function first looks for lanelets that are contacting with waypoint by getContactingLanelets function. It is done by gathering closest lanelets until lanelet that has distance above 0 m shows up. Therefore, it will fall into infinite loop if there are no lanelets that have distance of more than 0m. See the while loop in this line. The loop will not exit if there are no lanelets in laneletLayer or if all lanelets have distance 0m to the searching point.

Expected behavior

matchWaypointAndLanelet() finishes its execution.

Actual behavior

matchWaypointAndLanelet() never stops its execution.

Fix applied

Add a condition to exit loop when all lanes are contacting to a given search point(waypoint). Also, test is added to test to make sure that bug is fixed.

Edited by mitsudome-r

Merge request reports

Loading