@@ -676,47 +676,66 @@ TEST(BehaviorPathPlanningSafetyUtilsTest, checkObjectsCollisionRough)
676
676
677
677
auto path = generateTrajectory<PathWithLaneId>(10 , 1.0 );
678
678
autoware_perception_msgs::msg::PredictedObjects objs;
679
- double margin = 0.1 ;
679
+ double min_margin_threshold = 0.1 ;
680
+ double max_margin_threshold = 0.1 ;
680
681
BehaviorPathPlannerParameters param;
681
682
param.vehicle_width = 2.0 ;
682
683
param.front_overhang = 1.0 ;
683
684
param.rear_overhang = 1.0 ;
684
685
bool use_offset_ego_point = true ;
685
686
686
- // Condition: no object
687
- auto rough_object_collision =
688
- checkObjectsCollisionRough ( path, objs, margin , param, use_offset_ego_point);
687
+ // Condition: no objects
688
+ auto rough_object_collision = checkObjectsCollisionRough (
689
+ path, objs, min_margin_threshold, max_margin_threshold , param, use_offset_ego_point);
689
690
EXPECT_FALSE (rough_object_collision.first );
690
691
EXPECT_FALSE (rough_object_collision.second );
691
692
692
693
// Condition: collides with minimum distance
694
+ // min_distance = 0.00464761, max_distance = 2.0
693
695
autoware_perception_msgs::msg::PredictedObject obj;
694
696
obj.kinematics .initial_pose_with_covariance .pose = createPose (8.0 , 3.0 , 0.0 , 0.0 , 0.0 , 0.0 );
695
697
obj.shape .type = autoware_perception_msgs::msg::Shape::BOUNDING_BOX;
696
698
obj.shape .dimensions .x = 3.0 ;
697
699
obj.shape .dimensions .y = 1.0 ;
698
700
objs.objects .push_back (obj);
699
701
700
- rough_object_collision =
701
- checkObjectsCollisionRough ( path, objs, margin , param, use_offset_ego_point);
702
+ rough_object_collision = checkObjectsCollisionRough (
703
+ path, objs, min_margin_threshold, max_margin_threshold , param, use_offset_ego_point);
702
704
EXPECT_TRUE (rough_object_collision.first );
703
705
EXPECT_FALSE (rough_object_collision.second );
704
706
705
707
// Condition: collides with both distance
708
+ // min_distance: -1.99535, max_distance: 0.0
706
709
obj.kinematics .initial_pose_with_covariance .pose = createPose (2.0 , 1.0 , 0.0 , 0.0 , 0.0 , 0.0 );
707
710
objs.objects .clear ();
708
711
objs.objects .push_back (obj);
709
- rough_object_collision =
710
- checkObjectsCollisionRough ( path, objs, margin , param, use_offset_ego_point);
712
+ rough_object_collision = checkObjectsCollisionRough (
713
+ path, objs, min_margin_threshold, max_margin_threshold , param, use_offset_ego_point);
711
714
EXPECT_TRUE (rough_object_collision.first );
712
715
EXPECT_TRUE (rough_object_collision.second );
713
716
714
717
// Condition: use_offset_ego_point set to false
715
718
use_offset_ego_point = false ;
716
- rough_object_collision =
717
- checkObjectsCollisionRough ( path, objs, margin , param, use_offset_ego_point);
719
+ rough_object_collision = checkObjectsCollisionRough (
720
+ path, objs, min_margin_threshold, max_margin_threshold , param, use_offset_ego_point);
718
721
EXPECT_TRUE (rough_object_collision.first );
719
722
EXPECT_TRUE (rough_object_collision.second );
723
+
724
+ // Condition: no collision with lenient min_margin_threshold and
725
+ // collision with strict max_margin_threshold.
726
+ // min_distance = 0.00464761, max_distance = 2.0
727
+ min_margin_threshold = 0.001 ;
728
+ max_margin_threshold = 2.1 ;
729
+ obj.kinematics .initial_pose_with_covariance .pose = createPose (8.0 , 3.0 , 0.0 , 0.0 , 0.0 , 0.0 );
730
+ obj.shape .type = autoware_perception_msgs::msg::Shape::BOUNDING_BOX;
731
+ obj.shape .dimensions .x = 3.0 ;
732
+ obj.shape .dimensions .y = 1.0 ;
733
+ objs.objects .clear ();
734
+ objs.objects .push_back (obj);
735
+ rough_object_collision = checkObjectsCollisionRough (
736
+ path, objs, min_margin_threshold, max_margin_threshold, param, use_offset_ego_point);
737
+ EXPECT_FALSE (rough_object_collision.first );
738
+ EXPECT_TRUE (rough_object_collision.second );
720
739
}
721
740
722
741
TEST (BehaviorPathPlanningSafetyUtilsTest, calculateRoughDistanceToObjects)
0 commit comments