98 {
99
100 std::vector<const Obstacle*> obstacles;
101 const auto& indexed_obstacles =
102 reference_line_info.path_decision().obstacles();
103 const auto& vehicle_param =
106 double back_edge_to_center = vehicle_param.back_edge_to_center();
107 double path_point_lateral_buffer =
108 std::max(vehicle_param.width() / 2.0, vehicle_param.length() / 2.0);
109 for (const auto* obstacle : indexed_obstacles.Items()) {
110
112 continue;
113 }
114
115 const auto& obstacle_sl = obstacle->PerceptionSLBoundary();
116 if ((obstacle_sl.end_s() - obstacle_sl.start_s()) *
117 (obstacle_sl.end_l() - obstacle_sl.start_l()) <
119 continue;
120 }
121 obstacles.push_back(obstacle);
122 }
123
124 const auto& frenet_path = path_data.frenet_frame_path();
125 for (size_t i = 0; i < path_data.discretized_path().size(); ++i) {
126
127 if (path_data.frenet_frame_path().back().s() -
128 path_data.frenet_frame_path()[i].s() <
129 (FLAGS_num_extra_tail_bound_point + 1) *
130 FLAGS_path_bounds_decider_resolution +
131 vehicle_param.length()) {
132 break;
133 }
134 double path_point_start_s = frenet_path[i].s() - back_edge_to_center;
135 double path_point_end_s = frenet_path[i].s() + front_edge_to_center;
136 double path_point_start_l = frenet_path[i].l() - path_point_lateral_buffer;
137 double path_point_end_l = frenet_path[i].l() + path_point_lateral_buffer;
138
139 for (const auto* obstacle : obstacles) {
140 const auto& obstacle_sl = obstacle->PerceptionSLBoundary();
141
142 if (obstacle_sl.start_s() > path_point_end_s ||
143 obstacle_sl.end_s() < path_point_start_s) {
144 continue;
145 }
146 if (obstacle_sl.start_l() > path_point_end_l ||
147 obstacle_sl.end_l() < path_point_start_l) {
148 continue;
149 }
150 const auto& path_point = path_data.discretized_path()[i];
151 const auto& vehicle_box =
152 common::VehicleConfigHelper::Instance()->GetBoundingBox(path_point);
153 const std::vector<Vec2d>& ABCDpoints = vehicle_box.GetAllCorners();
154 const common::math::Polygon2d& obstacle_polygon =
155 obstacle->PerceptionPolygon();
156 for (const auto& corner_point : ABCDpoints) {
157 if (obstacle_polygon.IsPointIn(corner_point)) {
158 AERROR <<
"ADC is colliding with obstacle at path s = "
159 << path_point.s() << ", with obstacle " << obstacle->Id();
160 return true;
161 }
162 }
163 }
164 }
165 return false;
166}
static const VehicleConfig & GetConfig()
Get the current vehicle configuration.
static bool IsWithinPathDeciderScopeObstacle(const Obstacle &obstacle)
Is obstacle should be considered in path decision
constexpr double kMinObstacleArea
optional VehicleParam vehicle_param
optional double front_edge_to_center