Skip to content

Possible bug of getClosestRouteLaneletFromLanelet() function #772

@felixf4xu

Description

@felixf4xu

In the header of getClosestRouteLaneletFromLanelet function,

/**
* Finds the closest route lanelet to the search pose satisfying the distance and yaw constraints
* with respect to a reference lanelet, the search set will include previous route lanelets,
* next route lanelets, and neighbors of reference lanelet. Returns false if failed to find
* lanelet.
* @param search_pose pose to find closest lanelet to
* @param reference_lanelet reference lanelet to decide the search set
* @param dist_threshold distance constraint closest lanelet must be within
* @param yaw_threshold yaw constraint closest lanelet direction must be within
*/
bool getClosestRouteLaneletFromLanelet(
const Pose & search_pose, const lanelet::ConstLanelet & reference_lanelet,
lanelet::ConstLanelet * closest_lanelet, const double dist_threshold,
const double yaw_threshold) const;

it clearly states that

the search set will include previous route lanelets, next route lanelets, and neighbors of reference lanelet

But in the cpp file of getClosestRouteLaneletFromLanelet,

bool RouteHandler::getClosestRouteLaneletFromLanelet(
  const Pose & search_pose, const lanelet::ConstLanelet & reference_lanelet,
  lanelet::ConstLanelet * closest_lanelet, const double dist_threshold,
  const double yaw_threshold) const
{
  lanelet::ConstLanelets previous_lanelets, next_lanelets, lanelet_sequence;
  if (getPreviousLaneletsWithinRoute(reference_lanelet, &previous_lanelets)) {
    lanelet_sequence = previous_lanelets;
  }

  lanelet_sequence.push_back(reference_lanelet);

  if (getNextLaneletsWithinRoute(reference_lanelet, &next_lanelets)) {
    lanelet_sequence.insert(lanelet_sequence.end(), next_lanelets.begin(), next_lanelets.end());
  }
  auto opt = autoware::experimental::lanelet2_utils::get_closest_lanelet_within_constraint(
    lanelet_sequence, search_pose, dist_threshold, yaw_threshold);
  if (opt.has_value()) {
    *closest_lanelet = *opt;
    return true;
  }

  return false;
}

I see previous_lanelets and next_lanelets, but it seems that some thing like neighbor_lanelets is missing.

I'm not sure if there is a possible bug here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status:staleInactive or outdated issues. (auto-assigned)

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions