1
- // Copyright 2023 Tier IV, Inc.
1
+ // Copyright 2024 TIER IV, Inc.
2
2
//
3
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
4
// you may not use this file except in compliance with the License.
12
12
// See the License for the specific language governing permissions and
13
13
// limitations under the License.
14
14
15
- #include " node .hpp"
15
+ #include " autoware/behavior_velocity_planner/test_utils .hpp"
16
16
17
17
#include < ament_index_cpp/get_package_share_directory.hpp>
18
18
#include < autoware_planning_test_manager/autoware_planning_test_manager.hpp>
19
19
#include < autoware_test_utils/autoware_test_utils.hpp>
20
20
21
- #include < gtest/gtest.h>
22
-
23
- #include < cmath>
24
21
#include < memory>
25
22
#include < string>
26
23
#include < vector>
27
24
28
- using autoware::behavior_velocity_planner::BehaviorVelocityPlannerNode;
29
- using autoware::planning_test_manager::PlanningInterfaceTestManager;
30
-
25
+ namespace autoware ::behavior_velocity_planner
26
+ {
31
27
std::shared_ptr<PlanningInterfaceTestManager> generateTestManager ()
32
28
{
33
29
auto test_manager = std::make_shared<PlanningInterfaceTestManager>();
@@ -45,7 +41,8 @@ std::shared_ptr<PlanningInterfaceTestManager> generateTestManager()
45
41
return test_manager;
46
42
}
47
43
48
- std::shared_ptr<BehaviorVelocityPlannerNode> generateNode ()
44
+ std::shared_ptr<BehaviorVelocityPlannerNode> generateNode (
45
+ const std::vector<PluginInfo> & plugin_info_vec)
49
46
{
50
47
auto node_options = rclcpp::NodeOptions{};
51
48
@@ -64,49 +61,29 @@ std::shared_ptr<BehaviorVelocityPlannerNode> generateNode()
64
61
return package_path + " /config/" + module + " .param.yaml" ;
65
62
};
66
63
67
- std::vector<std::string> module_names;
68
- module_names.emplace_back (" autoware::behavior_velocity_planner::CrosswalkModulePlugin" );
69
- module_names.emplace_back (" autoware::behavior_velocity_planner::WalkwayModulePlugin" );
70
- module_names.emplace_back (" autoware::behavior_velocity_planner::TrafficLightModulePlugin" );
71
- module_names.emplace_back (" autoware::behavior_velocity_planner::IntersectionModulePlugin" );
72
- module_names.emplace_back (" autoware::behavior_velocity_planner::MergeFromPrivateModulePlugin" );
73
- module_names.emplace_back (" autoware::behavior_velocity_planner::BlindSpotModulePlugin" );
74
- module_names.emplace_back (" autoware::behavior_velocity_planner::DetectionAreaModulePlugin" );
75
- module_names.emplace_back (" autoware::behavior_velocity_planner::VirtualTrafficLightModulePlugin" );
76
- module_names.emplace_back (" autoware::behavior_velocity_planner::NoStoppingAreaModulePlugin" );
77
- module_names.emplace_back (" autoware::behavior_velocity_planner::StopLineModulePlugin" );
78
- module_names.emplace_back (" autoware::behavior_velocity_planner::OcclusionSpotModulePlugin" );
79
- module_names.emplace_back (" autoware::behavior_velocity_planner::RunOutModulePlugin" );
80
- module_names.emplace_back (" autoware::behavior_velocity_planner::SpeedBumpModulePlugin" );
81
- module_names.emplace_back (" autoware::behavior_velocity_planner::NoDrivableLaneModulePlugin" );
64
+ std::vector<std::string> plugin_names;
65
+ for (const auto & plugin_info : plugin_info_vec) {
66
+ plugin_names.emplace_back (plugin_info.plugin_name );
67
+ }
82
68
83
69
std::vector<rclcpp::Parameter> params;
84
- params.emplace_back (" launch_modules" , module_names );
70
+ params.emplace_back (" launch_modules" , plugin_names );
85
71
params.emplace_back (" is_simulation" , false );
86
72
node_options.parameter_overrides (params);
87
73
88
- autoware::test_utils::updateNodeOptions (
89
- node_options,
90
- {autoware_test_utils_dir + " /config/test_common.param.yaml" ,
91
- autoware_test_utils_dir + " /config/test_nearest_search.param.yaml" ,
92
- autoware_test_utils_dir + " /config/test_vehicle_info.param.yaml" ,
93
- velocity_smoother_dir + " /config/default_velocity_smoother.param.yaml" ,
94
- velocity_smoother_dir + " /config/Analytical.param.yaml" ,
95
- behavior_velocity_planner_common_dir + " /config/behavior_velocity_planner_common.param.yaml" ,
96
- behavior_velocity_planner_dir + " /config/behavior_velocity_planner.param.yaml" ,
97
- get_behavior_velocity_module_config (" blind_spot" ),
98
- get_behavior_velocity_module_config (" crosswalk" ),
99
- get_behavior_velocity_module_config (" walkway" ),
100
- get_behavior_velocity_module_config (" detection_area" ),
101
- get_behavior_velocity_module_config (" intersection" ),
102
- get_behavior_velocity_module_config (" no_stopping_area" ),
103
- get_behavior_velocity_module_config (" occlusion_spot" ),
104
- get_behavior_velocity_module_config (" run_out" ),
105
- get_behavior_velocity_module_config (" speed_bump" ),
106
- get_behavior_velocity_module_config (" stop_line" ),
107
- get_behavior_velocity_module_config (" traffic_light" ),
108
- get_behavior_velocity_module_config (" virtual_traffic_light" ),
109
- get_behavior_velocity_module_config (" no_drivable_lane" )});
74
+ auto yaml_files = std::vector<std::string>{
75
+ autoware_test_utils_dir + " /config/test_common.param.yaml" ,
76
+ autoware_test_utils_dir + " /config/test_nearest_search.param.yaml" ,
77
+ autoware_test_utils_dir + " /config/test_vehicle_info.param.yaml" ,
78
+ velocity_smoother_dir + " /config/default_velocity_smoother.param.yaml" ,
79
+ velocity_smoother_dir + " /config/Analytical.param.yaml" ,
80
+ behavior_velocity_planner_common_dir + " /config/behavior_velocity_planner_common.param.yaml" ,
81
+ behavior_velocity_planner_dir + " /config/behavior_velocity_planner.param.yaml" };
82
+ for (const auto & plugin_info : plugin_info_vec) {
83
+ yaml_files.push_back (get_behavior_velocity_module_config (plugin_info.module_name ));
84
+ }
85
+
86
+ autoware::test_utils::updateNodeOptions (node_options, yaml_files);
110
87
111
88
// TODO(Takagi, Isamu): set launch_modules
112
89
// TODO(Kyoichi Sugahara) set to true launch_virtual_traffic_light
@@ -141,39 +118,4 @@ void publishMandatoryTopics(
141
118
test_manager->publishOccupancyGrid (
142
119
test_target_node, " behavior_velocity_planner_node/input/occupancy_grid" );
143
120
}
144
-
145
- TEST (PlanningModuleInterfaceTest, NodeTestWithExceptionPathWithLaneID)
146
- {
147
- rclcpp::init (0 , nullptr );
148
- auto test_manager = generateTestManager ();
149
- auto test_target_node = generateNode ();
150
-
151
- publishMandatoryTopics (test_manager, test_target_node);
152
-
153
- // test with nominal path_with_lane_id
154
- ASSERT_NO_THROW_WITH_ERROR_MSG (test_manager->testWithNominalPathWithLaneId (test_target_node));
155
- EXPECT_GE (test_manager->getReceivedTopicNum (), 1 );
156
-
157
- // test with empty path_with_lane_id
158
- ASSERT_NO_THROW_WITH_ERROR_MSG (test_manager->testWithAbnormalPathWithLaneId (test_target_node));
159
- rclcpp::shutdown ();
160
- }
161
-
162
- TEST (PlanningModuleInterfaceTest, NodeTestWithOffTrackEgoPose)
163
- {
164
- rclcpp::init (0 , nullptr );
165
-
166
- auto test_manager = generateTestManager ();
167
- auto test_target_node = generateNode ();
168
- publishMandatoryTopics (test_manager, test_target_node);
169
-
170
- // test for normal trajectory
171
- ASSERT_NO_THROW_WITH_ERROR_MSG (test_manager->testWithNominalPathWithLaneId (test_target_node));
172
-
173
- // make sure behavior_path_planner is running
174
- EXPECT_GE (test_manager->getReceivedTopicNum (), 1 );
175
-
176
- ASSERT_NO_THROW_WITH_ERROR_MSG (test_manager->testOffTrackFromPathWithLaneId (test_target_node));
177
-
178
- rclcpp::shutdown ();
179
- }
121
+ } // namespace autoware::behavior_velocity_planner
0 commit comments