Skip to content

Commit a3c7ede

Browse files
authored
test(bpp_common): add test for objects filtering except for lanelet using functions (#9049)
* add test for objects filtering except for lanelet using functions Signed-off-by: Go Sakayori <go.sakayori@tier4.jp> * remove unnecessary include file Signed-off-by: Go Sakayori <go.sakayori@tier4.jp> * add doxygen Signed-off-by: Go Sakayori <go.sakayori@tier4.jp> --------- Signed-off-by: Go Sakayori <go.sakayori@tier4.jp>
1 parent 7cf1ffa commit a3c7ede

File tree

4 files changed

+416
-1
lines changed

4 files changed

+416
-1
lines changed

planning/behavior_path_planner/autoware_behavior_path_planner_common/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ if(BUILD_TESTING)
6060

6161
ament_add_ros_isolated_gmock(test_${PROJECT_NAME}_safety_check
6262
test/test_safety_check.cpp
63+
test/test_objects_filtering.cpp
6364
)
6465

6566
target_link_libraries(test_${PROJECT_NAME}_safety_check

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

+31-1
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,44 @@ namespace autoware::behavior_path_planner::utils::path_safety_checker::filter
3434
using autoware_perception_msgs::msg::PredictedObject;
3535
using tier4_planning_msgs::msg::PathPointWithLaneId;
3636

37+
/**
38+
* @brief Filters object based on velocity.
39+
*
40+
* @param object The predicted object to filter.
41+
* @param velocity_threshold Lower bound
42+
* @param max_velocity Upper bound
43+
* @return Returns true when the object is within a certain velocity range.
44+
*/
3745
bool velocity_filter(
3846
const PredictedObject & object, double velocity_threshold, double max_velocity);
3947

48+
/**
49+
* @brief Filters object based on position.
50+
*
51+
* @param object The predicted object to filter.
52+
* @param path_points Ego path
53+
* @param current_pose Ego current pose
54+
* @param forward_distance Upper bound for relative distance
55+
* @param backward_distance Lower bound for relative distance
56+
* @return Returns true when the object is within a certain distance.
57+
*/
4058
bool position_filter(
41-
PredictedObject & object, const std::vector<PathPointWithLaneId> & path_points,
59+
const PredictedObject & object, const std::vector<PathPointWithLaneId> & path_points,
4260
const geometry_msgs::msg::Point & current_pose, const double forward_distance,
4361
const double backward_distance);
4462

63+
/**
64+
* @brief Filters object by searching within a radius.
65+
*
66+
* @param object The predicted object to filter.
67+
* @param reference_point Reference point
68+
* @param search_radius Search radius
69+
* @return Returns true when the object is within radius.
70+
*/
71+
bool is_within_circle(
72+
const geometry_msgs::msg::Point & object_pos, const geometry_msgs::msg::Point & reference_point,
73+
const double search_radius);
74+
4575
} // namespace autoware::behavior_path_planner::utils::path_safety_checker::filter
4676

4777
namespace autoware::behavior_path_planner::utils::path_safety_checker

planning/behavior_path_planner/autoware_behavior_path_planner_common/src/utils/path_safety_checker/objects_filtering.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ bool position_filter(
3939
const geometry_msgs::msg::Point & current_pose, const double forward_distance,
4040
const double backward_distance)
4141
{
42+
if (path_points.empty()) return false;
43+
4244
const auto dist_ego_to_obj = autoware::motion_utils::calcSignedArcLength(
4345
path_points, current_pose, object.kinematics.initial_pose_with_covariance.pose.position);
4446

0 commit comments

Comments
 (0)