Skip to content

Commit 2e0d5de

Browse files
authored
test(bpp_common): add unit test for safety check (#9386)
* fix docstring Signed-off-by: Go Sakayori <go.sakayori@tier4.jp> * add basic collision test Signed-off-by: Go Sakayori <go.sakayori@tier4.jp> * add some more tests Signed-off-by: Go Sakayori <go.sakayori@tier4.jp> * add unit test for all functions Signed-off-by: Go Sakayori <gsakayori@gmail.com> * remove unecessary header and space Signed-off-by: Go Sakayori <gsakayori@gmail.com> --------- Signed-off-by: Go Sakayori <go.sakayori@tier4.jp> Signed-off-by: Go Sakayori <gsakayori@gmail.com>
1 parent 5778e01 commit 2e0d5de

File tree

2 files changed

+297
-35
lines changed

2 files changed

+297
-35
lines changed

planning/behavior_path_planner/autoware_behavior_path_planner_common/include/autoware/behavior_path_planner_common/utils/path_safety_checker/safety_check.hpp

+56-13
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,22 @@ Polygon2d createExtendedPolygon(
7676
const PoseWithVelocityAndPolygonStamped & obj_pose_with_poly, const double lon_length,
7777
const double lat_margin, const bool is_stopped_obj, CollisionCheckDebug & debug);
7878

79+
/**
80+
* @brief Converts path (path with velocity stamped) to predicted path.
81+
* @param path Path.
82+
* @param time_resolution Time resolution.
83+
* @return Predicted path.
84+
*/
7985
PredictedPath convertToPredictedPath(
8086
const std::vector<PoseWithVelocityStamped> & path, const double time_resolution);
8187

88+
/**
89+
* @brief Calculates RSS related distance.
90+
* @param front_object_velocity Velocity of front object.
91+
* @param rear_object_velocity Velocity of rear object.
92+
* @param rss_params RSS parameters.
93+
* @return Longitudinal distance.
94+
*/
8295
double calcRssDistance(
8396
const double front_object_velocity, const double rear_object_velocity,
8497
const RSSparams & rss_params);
@@ -128,9 +141,29 @@ ExtendedPredictedObjects filterObjectPredictedPathByTimeHorizon(
128141
const ExtendedPredictedObjects & objects, const double time_horizon,
129142
const bool check_all_predicted_path);
130143

144+
/**
145+
* @brief Filters the path by obtaining points after target pose.
146+
* @param path Path to filter.
147+
* @param target_pose Target pose.
148+
* @return Filtered path.
149+
*/
131150
std::vector<PoseWithVelocityStamped> filterPredictedPathAfterTargetPose(
132151
const std::vector<PoseWithVelocityStamped> & path, const Pose & target_pose);
133152

153+
/**
154+
* @brief Iterate the points in the ego and target's predicted path and
155+
* perform safety check for each of the iterated points using RSS parameters
156+
* @param planned_path The planned path of the ego vehicle.
157+
* @param ego_predicted_path Ego vehicle's predicted path
158+
* @param objects Detected objects.
159+
* @param debug_map Map for collision check debug.
160+
* @param parameters The common parameters used in behavior path planner.
161+
* @param rss_params The parameters used in RSSs
162+
* @param check_all_predicted_path If true, uses all predicted path
163+
* @param hysteresis_factor Hysteresis factor
164+
* @param yaw_difference_th Threshold for yaw difference
165+
* @return True if planned path is safe.
166+
*/
134167
bool checkSafetyWithRSS(
135168
const PathWithLaneId & planned_path,
136169
const std::vector<PoseWithVelocityStamped> & ego_predicted_path,
@@ -144,16 +177,14 @@ bool checkSafetyWithRSS(
144177
* perform safety check for each of the iterated points.
145178
* @param planned_path The predicted path of the ego vehicle.
146179
* @param predicted_ego_path Ego vehicle's predicted path
147-
* @param ego_current_velocity Current velocity of the ego vehicle.
148180
* @param target_object The predicted object to check collision with.
149181
* @param target_object_path The predicted path of the target object.
150-
* @param common_parameters The common parameters used in behavior path planner.
151-
* @param front_object_deceleration The deceleration of the object in the front.(used in RSS)
152-
* @param rear_object_deceleration The deceleration of the object in the rear.(used in RSS)
153-
* @param yaw_difference_th maximum yaw difference between any given ego path pose and object
154-
* predicted path pose.
182+
* @param common_parameters Common parameters used for behavior path planning.
183+
* @param rss_parameters The parameters used in RSS.
184+
* @param hysteresis_factor Hysteresis factor.
185+
* @param yaw_difference_th Threshold of yaw difference.
155186
* @param debug The debug information for collision checking.
156-
* @return true if distance is safe.
187+
* @return True if there is no collision.
157188
*/
158189
bool checkCollision(
159190
const PathWithLaneId & planned_path,
@@ -166,16 +197,17 @@ bool checkCollision(
166197
/**
167198
* @brief Iterate the points in the ego and target's predicted path and
168199
* perform safety check for each of the iterated points.
169-
* @param planned_path The predicted path of the ego vehicle.
200+
* @param planned_path The planned path of the ego vehicle.
170201
* @param predicted_ego_path Ego vehicle's predicted path
171-
* @param ego_current_velocity Current velocity of the ego vehicle.
172202
* @param target_object The predicted object to check collision with.
173203
* @param target_object_path The predicted path of the target object.
174-
* @param common_parameters The common parameters used in behavior path planner.
175-
* @param front_object_deceleration The deceleration of the object in the front.(used in RSS)
176-
* @param rear_object_deceleration The deceleration of the object in the rear.(used in RSS)
204+
* @param vehicle_info Ego vehicle information.
205+
* @param rss_parameters The parameters used in RSS.
206+
* @param hysteresis_factor Hysteresis factor.
207+
* @param max_velocity_limit Maximum velocity of ego vehicle.
208+
* @param yaw_difference_th Threshold of yaw difference.
177209
* @param debug The debug information for collision checking.
178-
* @return a list of polygon when collision is expected.
210+
* @return List of polygon which collision is expected.
179211
*/
180212
std::vector<Polygon2d> get_collided_polygons(
181213
const PathWithLaneId & planned_path,
@@ -187,6 +219,17 @@ std::vector<Polygon2d> get_collided_polygons(
187219

188220
bool checkPolygonsIntersects(
189221
const std::vector<Polygon2d> & polys_1, const std::vector<Polygon2d> & polys_2);
222+
223+
/**
224+
* @brief Checks for safety using integral predicted polygons.
225+
* @param ego_predicted_path The predicted path of ego vehicle.
226+
* @param vehicle_info Information (parameters) about ego vehicle.
227+
* @param objects Surrounding objects.
228+
* @param check_all_predicted_path Whether to check all predicted paths of objects.
229+
* @param params Parameters for integral predicted polygon.
230+
* @param debug_map Map to store debug information.
231+
* @return True if the ego vehicle's path is safe, and false otherwise.
232+
*/
190233
bool checkSafetyWithIntegralPredictedPolygon(
191234
const std::vector<PoseWithVelocityStamped> & ego_predicted_path, const VehicleInfo & vehicle_info,
192235
const ExtendedPredictedObjects & objects, const bool check_all_predicted_path,

0 commit comments

Comments
 (0)