apollo icon indicating copy to clipboard operation
apollo copied to clipboard

Bug in open planner

Open Andrea2202 opened this issue 7 years ago • 3 comments

We appreciate you go through Apollo documentations and search previous issues before creating an new one. If neither of the sources helped you with your issues, please report the issue using the following form. Please note missing info can delay the response time.

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 14.04): 16.04
  • Apollo installed from (source or binary): source
  • Apollo version (1.0, 1.5, 2.0, 2.5, 3.0): apollo 5.0

Steps to reproduce the issue:

Use opne planner without obstacles

In file grid_search.cc in the function CheckConstraints at line 37 if you have no obstacles the if (obstacles_linesegments_vec_.empty()) is always true and the function return always true. But the gridSearch doesn't check if the node is out of XY grid bounds and never converge.

Edit proposal

bool GridSearch::CheckConstraints(std::shared_ptr<Node2d> node) {
  double node_grid_x = node->GetGridX();
  double node_grid_y = node->GetGridY();
  if (node_grid_x > max_grid_x_ || node_grid_x < 0 ||
      node_grid_y > max_grid_y_ || node_grid_y < 0) {
    return false;
  }
//First check bound and only after check if obstacle vector is empty
  if (obstacles_linesegments_vec_.empty()) {
    return true;
  }
  for (const auto& obstacle_linesegments : obstacles_linesegments_vec_) {
    for (const common::math::LineSegment2d& linesegment :
         obstacle_linesegments) {
      if (linesegment.DistanceTo({node->GetGridX(), node->GetGridY()}) <
          node_radius_) {
        return false;
      }
    }
  }
  return true;
}

Andrea2202 avatar Jul 31 '19 13:07 Andrea2202

Yes, you are right. It's a potential bug when there's no obstacles within the boundary. Will fix it accordingly.

JasonZhou404 avatar Jul 31 '19 23:07 JasonZhou404

@Andrea2202 #9283 should resolve your bug. Thank you so much for your support!

natashadsouza avatar Aug 01 '19 06:08 natashadsouza

Now Node2d's position is grid coordinate, but CheckConstraints() use grid coor do collision check.

This bug still exists in master and r8.0 branch.

hoppss avatar Oct 07 '23 12:10 hoppss