scenario_simulator_v2 C++ API
Classes | Functions
test_distance.cpp File Reference
#include <gtest/gtest.h>
#include <ament_index_cpp/get_package_share_directory.hpp>
#include <geometry/bounding_box.hpp>
#include <geometry/quaternion/euler_to_quaternion.hpp>
#include <numeric>
#include <traffic_simulator/helper/helper.hpp>
#include <traffic_simulator/utils/distance.hpp>
#include <traffic_simulator/utils/pose.hpp>
#include <traffic_simulator_msgs/msg/lanelet_pose.hpp>
#include "../helper_functions.hpp"
Include dependency graph for test_distance.cpp:

Classes

class  distanceTest_FourTrackHighwayMap
 
class  distanceTest_StandardMap
 
class  distanceTest_IntersectionMap
 

Functions

int main (int argc, char **argv)
 
 TEST_F (distanceTest_FourTrackHighwayMap, lateralDistance_impossible_noChange)
 
 TEST_F (distanceTest_FourTrackHighwayMap, lateralDistance_possible_noChange)
 
 TEST_F (distanceTest_FourTrackHighwayMap, lateralDistance_impossible_change)
 
 TEST_F (distanceTest_FourTrackHighwayMap, lateralDistance_possible_change)
 
 TEST_F (distanceTest_FourTrackHighwayMap, lateralDistance_impossible_matching)
 
 TEST_F (distanceTest_FourTrackHighwayMap, lateralDistance_possible_matching)
 
 TEST_F (distanceTest_FourTrackHighwayMap, longitudinalDistance_noAdjacent_noOpposite_noChange_false)
 
 TEST_F (distanceTest_StandardMap, longitudinalDistance_noAdjacent_noOpposite_noChange)
 
 TEST_F (distanceTest_FourTrackHighwayMap, longitudinalDistance_adjacent_noOpposite_noChange_false)
 
 TEST_F (distanceTest_FourTrackHighwayMap, longitudinalDistance_adjacent_noOpposite_noChange)
 
 TEST_F (distanceTest_FourTrackHighwayMap, longitudinalDistance_noAdjacent_noOpposite_change_false)
 
 TEST_F (distanceTest_FourTrackHighwayMap, longitudinalDistance_noAdjacent_noOpposite_change_case0)
 
 TEST_F (distanceTest_IntersectionMap, longitudinalDistance_noAdjacent_noOpposite_change_case1)
 
 TEST_F (distanceTest_IntersectionMap, longitudinalDistance_adjacent_noOpposite_change_false)
 
 TEST_F (distanceTest_IntersectionMap, longitudinalDistance_adjacent_noOpposite_change)
 
 TEST (distance, boundingBoxDistance_intersection)
 
 TEST (distance, boundingBoxDistance_disjoint)
 
 TEST_F (distanceTest_StandardMap, distanceToLeftLaneBound_single)
 
 TEST_F (distanceTest_StandardMap, distanceToLeftLaneBound_multipleVector)
 
 TEST_F (distanceTest_StandardMap, distanceToLeftLaneBound_singleVector)
 
 TEST_F (distanceTest_StandardMap, distanceToLeftLaneBound_emptyVector)
 
 TEST_F (distanceTest_IntersectionMap, distanceToRightLaneBound_single)
 
 TEST_F (distanceTest_IntersectionMap, distanceToRightLaneBound_multipleVector)
 
 TEST_F (distanceTest_IntersectionMap, distanceToRightLaneBound_singleVector)
 
 TEST_F (distanceTest_IntersectionMap, distanceToRightLaneBound_emptyVector)
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

◆ TEST() [1/2]

TEST ( distance  ,
boundingBoxDistance_disjoint   
)
Note
Test equality with math::geometry::getPolygonDistance function result on disjoint bounding boxes.

◆ TEST() [2/2]

TEST ( distance  ,
boundingBoxDistance_intersection   
)
Note
Test equality with math::geometry::getPolygonDistance function result on intersecting bounding boxes.

◆ TEST_F() [1/23]

TEST_F ( distanceTest_FourTrackHighwayMap  ,
lateralDistance_impossible_change   
)
Note
Test if the function correctly uses getLateralDistance. Test with a scenario in which it is impossible to calculate the distance, e.g. not connected lanelets and with allow_lane_change = true.

◆ TEST_F() [2/23]

TEST_F ( distanceTest_FourTrackHighwayMap  ,
lateralDistance_impossible_matching   
)
Note
Test if the function correctly uses getLateralDistance. Test with a scenario in which it is possible to calculate the distance, but matching_distance is too small.

◆ TEST_F() [3/23]

TEST_F ( distanceTest_FourTrackHighwayMap  ,
lateralDistance_impossible_noChange   
)
Note
Test if the function correctly uses getLateralDistance. Test with a scenario in which it is impossible to calculate the distance, e.g. not connected lanelets and with allow_lane_change = false.

◆ TEST_F() [4/23]

TEST_F ( distanceTest_FourTrackHighwayMap  ,
lateralDistance_possible_change   
)
Note
Test if the function correctly uses getLateralDistance. Test with a scenario in which it is possible to calculate the distance and with allow_lane_change = true.

◆ TEST_F() [5/23]

TEST_F ( distanceTest_FourTrackHighwayMap  ,
lateralDistance_possible_matching   
)
Note
Test if the function correctly uses getLateralDistance. Test with a scenario in which it is possible to calculate the distance and matching_distance is large.

◆ TEST_F() [6/23]

TEST_F ( distanceTest_FourTrackHighwayMap  ,
lateralDistance_possible_noChange   
)
Note
Test if the function correctly uses getLateralDistance. Test with a scenario in which it is possible to calculate the distance and with allow_lane_change = false.

◆ TEST_F() [7/23]

TEST_F ( distanceTest_FourTrackHighwayMap  ,
longitudinalDistance_adjacent_noOpposite_noChange   
)
Note
Test calculation correctness with include_adjacent_lanelet = true, include_opposite_direction = false, allow_lane_change = false in a scenario that meets those criteria.

◆ TEST_F() [8/23]

TEST_F ( distanceTest_FourTrackHighwayMap  ,
longitudinalDistance_adjacent_noOpposite_noChange_false   
)
Note
Test calculation correctness with include_adjacent_lanelet = true, include_opposite_direction = false, allow_lane_change = false in an impossible scenario, e.g. no path.

◆ TEST_F() [9/23]

TEST_F ( distanceTest_FourTrackHighwayMap  ,
longitudinalDistance_noAdjacent_noOpposite_change_case0   
)
Note
Test calculation correctness with include_adjacent_lanelet = false, include_opposite_direction = false, allow_lane_change = true in a scenario that meets those criteria.

◆ TEST_F() [10/23]

TEST_F ( distanceTest_FourTrackHighwayMap  ,
longitudinalDistance_noAdjacent_noOpposite_change_false   
)
Note
Test calculation correctness with include_adjacent_lanelet = false, include_opposite_direction = false, allow_lane_change = true in an impossible scenario, e.g. no path.

◆ TEST_F() [11/23]

TEST_F ( distanceTest_FourTrackHighwayMap  ,
longitudinalDistance_noAdjacent_noOpposite_noChange_false   
)
Note
Test calculation correctness with include_adjacent_lanelet = false, include_opposite_direction = false, allow_lane_change = false in an impossible scenario, e.g. no path.

◆ TEST_F() [12/23]

TEST_F ( distanceTest_IntersectionMap  ,
distanceToRightLaneBound_emptyVector   
)
Note
Test function behavior with an empty vector.

◆ TEST_F() [13/23]

TEST_F ( distanceTest_IntersectionMap  ,
distanceToRightLaneBound_multipleVector   
)
Note
Test calculation correctness with a vector containing multiple lanelets. Test equality with the minimum of distanceToRightLaneBound results (lanelet::Id overload).

◆ TEST_F() [14/23]

TEST_F ( distanceTest_IntersectionMap  ,
distanceToRightLaneBound_single   
)
Note
Test calculation correctness with lanelet::Id.

◆ TEST_F() [15/23]

TEST_F ( distanceTest_IntersectionMap  ,
distanceToRightLaneBound_singleVector   
)
Note
Test calculation correctness with a vector containing a single lanelet. Test equality with the distanceToRightLaneBound result (lanelet::Id overload).

◆ TEST_F() [16/23]

TEST_F ( distanceTest_IntersectionMap  ,
longitudinalDistance_adjacent_noOpposite_change   
)
Note
Test calculation correctness with include_adjacent_lanelet = true, include_opposite_direction = false, allow_lane_change = true in a scenario that meets those criteria.

◆ TEST_F() [17/23]

TEST_F ( distanceTest_IntersectionMap  ,
longitudinalDistance_adjacent_noOpposite_change_false   
)
Note
Test calculation correctness with include_adjacent_lanelet = true, include_opposite_direction = false, allow_lane_change = true in an impossible scenario, e.g. no path.

◆ TEST_F() [18/23]

TEST_F ( distanceTest_IntersectionMap  ,
longitudinalDistance_noAdjacent_noOpposite_change_case1   
)
Note
Test for the corner case described in https://github.com/tier4/scenario_simulator_v2/issues/1364

◆ TEST_F() [19/23]

TEST_F ( distanceTest_StandardMap  ,
distanceToLeftLaneBound_emptyVector   
)
Note
Test function behavior with an empty vector.

◆ TEST_F() [20/23]

TEST_F ( distanceTest_StandardMap  ,
distanceToLeftLaneBound_multipleVector   
)
Note
Test calculation correctness with a vector containing multiple lanelets. Test equality with the minimum of distanceToLeftLaneBound results (lanelet::Id overload).

◆ TEST_F() [21/23]

TEST_F ( distanceTest_StandardMap  ,
distanceToLeftLaneBound_single   
)
Note
Test calculation correctness with lanelet::Id.

◆ TEST_F() [22/23]

TEST_F ( distanceTest_StandardMap  ,
distanceToLeftLaneBound_singleVector   
)
Note
Test calculation correctness with a vector containing a single lanelet. Test equality with the distanceToLeftLaneBound results (lanelet::Id overload).

◆ TEST_F() [23/23]

TEST_F ( distanceTest_StandardMap  ,
longitudinalDistance_noAdjacent_noOpposite_noChange   
)
Note
Test calculation correctness with include_adjacent_lanelet = false, include_opposite_direction = false, allow_lane_change = false in a scenario that meets those criteria.