@@ -252,32 +252,53 @@ double calc_obstacle_min_length(const Shape & shape);
252
252
double calc_obstacle_max_length (const Shape & shape);
253
253
254
254
/* *
255
- * @brief Calculate collision roughly by comparing minimum/maximum distance with margin.
256
- * @param path The path of the ego vehicle.
257
- * @param objects The predicted objects.
258
- * @param min_margin_threshold threshold for collision check when the minimum distance between ego
259
- * @param max_margin_threshold threshold for collision check when the maximum distance between ego
260
- * @param parameters The common parameters used in behavior path planner.
261
- * @param use_offset_ego_point If true, the closest point to the object is calculated by
262
- * interpolating the path points.
263
- * @return Collision (rough) between minimum distance and maximum distance
255
+ * @brief Performs efficient rough collision check between ego vehicle and objects
256
+ * @details
257
+ * This function calculates two types of distances between ego vehicle and each object:
258
+ * - Minimum distance: The shortest possible distance between ego and object when positioned
259
+ * diagonally with their corners closest to each other (uses maximum extent of both objects)
260
+ * - Maximum distance: The largest possible distance between ego and object when positioned parallel
261
+ * to each other (uses minimum extent of both objects)
262
+ *
263
+ * A collision is detected when:
264
+ * - min_distance < min_margin_threshold (first element of returned pair is true)
265
+ * - max_distance < max_margin_threshold (second element of returned pair is true)
266
+ *
267
+ * This approach provides a computationally efficient rough collision check that can be used
268
+ * before performing more expensive precise collision check algorithms.
269
+ * @param path The path of the ego vehicle
270
+ * @param objects The predicted objects to check for collision
271
+ * @param min_margin_threshold Threshold for minimum distance collision check
272
+ * @param max_margin_threshold Threshold for maximum distance collision check
273
+ * @param parameters The common parameters used in behavior path planner
274
+ * @param use_offset_ego_point If true, uses interpolated point on path closest to object
275
+ * @return A pair of boolean values {min_distance_collision, max_distance_collision}
264
276
*/
265
277
std::pair<bool , bool > checkObjectsCollisionRough (
266
278
const PathWithLaneId & path, const PredictedObjects & objects, const double min_margin_threshold,
267
279
const double max_margin_threshold, const BehaviorPathPlannerParameters & parameters,
268
280
const bool use_offset_ego_point);
269
281
270
282
/* *
271
- * @brief Calculate the rough distances between the path and the objects and return the minimum
272
- * @param path The path of the ego vehicle.
273
- * @param objects The predicted objects.
274
- * @param parameters The common parameters used in behavior path planner.
275
- * @param use_offset_ego_point If true, the closest point to the object is calculated by
276
- * interpolating the path points.
277
- * @param distance_type The type of distance to calculate. "min" or "max". Calculate the distance
278
- * when the distance is minimized or maximized when the direction of the ego and the object is
279
- * changed.
280
- * @return The rough distance between the ego vehicle and the objects.
283
+ * @brief Calculate the shortest rough distance between ego vehicle and objects based on specific
284
+ * orientation cases
285
+ * @details
286
+ * This function calculates a rough estimate of the closest distance between the ego vehicle's path
287
+ * and objects by considering two specific orientation cases:
288
+ * - "min": Uses the maximum extents of both ego and object (diagonal orientation case)
289
+ * This calculates the worst-case, shortest possible distance when objects are oriented to
290
+ * minimize the gap between them (when corners face each other)
291
+ * - "max": Uses the minimum extents of both ego and object (parallel orientation case)
292
+ * This calculates the best-case, longest possible distance when objects are oriented to
293
+ * maximize the gap between them (when sides are parallel)
294
+ * @param path The path of the ego vehicle
295
+ * @param objects The predicted objects to calculate distance to
296
+ * @param parameters The common parameters used in behavior path planner
297
+ * @param use_offset_ego_point If true, uses interpolated point on path closest to object for more
298
+ * accurate calculation
299
+ * @param distance_type Either "min" or "max" to specify which orientation case to calculate
300
+ * @return The shortest rough distance between the ego vehicle and any object for the specified
301
+ * orientation case
281
302
*/
282
303
double calculateRoughDistanceToObjects (
283
304
const PathWithLaneId & path, const PredictedObjects & objects,
0 commit comments