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