1515from artefacts_toolkit .chart import make_chart
1616from artefacts_toolkit .config import get_artefacts_param
1717
18+ ARTEFACTS_PARAMS_FILE = os .environ .get (
19+ "ARTEFACTS_SCENARIO_PARAMS_FILE" , "scenario_params.yaml"
20+ )
21+
22+ def merge_ros_params_files (source , override , destination ):
23+ """Merge two ROS2 yaml parameter files into one, overriding the values in the first one with the values in `override`"""
24+ import yaml
25+
26+ with open (source , "r" ) as f :
27+ source_params = yaml .safe_load (f )
28+
29+ with open (override , "r" ) as f :
30+ override_params = yaml .safe_load (f )
31+
32+ # Merge the parameters
33+ for key , value in override_params .items ():
34+ if key in source_params :
35+ source_params [key ].update (value )
36+ else :
37+ source_params [key ] = value
38+ # Write the merged parameters to the destination file
39+ with open (destination , "w" ) as f :
40+ yaml .dump (source_params , f )
1841
1942# This function specifies the processes to be run for our test
2043@pytest .mark .launch_test
@@ -26,6 +49,9 @@ def generate_test_description():
2649 world = "empty.world"
2750
2851 run_headless = LaunchConfiguration ("run_headless" )
52+ source_params_file = "src/sam_bot_nav2_gz/config/nav2_params.yaml"
53+ new_params_file = "all_params.yaml"
54+ merge_ros_params_files (source_params_file , ARTEFACTS_PARAMS_FILE , new_params_file )
2955 launch_navigation_stack = IncludeLaunchDescription (
3056 PythonLaunchDescriptionSource (
3157 [
@@ -36,7 +62,11 @@ def generate_test_description():
3662 ),
3763 ]
3864 ),
39- launch_arguments = [("run_headless" , run_headless ), ("world_file" , world )],
65+ launch_arguments = [
66+ ("run_headless" , run_headless ),
67+ ("world_file" , world ),
68+ ("params_file" , new_params_file ),
69+ ],
4070 )
4171
4272 follow_waypoints = Node (
0 commit comments