From 7119a9220bb11df669c52e7cd43b6a527eb95ebf Mon Sep 17 00:00:00 2001 From: Vincent Rubner <74796675+Viparu@users.noreply.github.com> Date: Mon, 1 Jun 2026 15:30:08 +0200 Subject: [PATCH] Configured PacSim launch script to read track, discipline, headless-mode and report directory from the launchfile This is to be compatible with https://github.com/StarkStrom-Driverless/fsd_monostack/tree/feature/pacsim_launch_script --- launch/example.launch.py | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/launch/example.launch.py b/launch/example.launch.py index 5228e4b..465706f 100644 --- a/launch/example.launch.py +++ b/launch/example.launch.py @@ -3,9 +3,9 @@ from ament_index_python.packages import get_package_share_directory from launch import LaunchDescription from launch_ros.actions import Node -from launch.substitutions import Command +from launch.substitutions import Command, LaunchConfiguration from launch.event_handlers import OnProcessExit -from launch.actions import RegisterEventHandler, LogInfo, EmitEvent +from launch.actions import RegisterEventHandler, LogInfo, EmitEvent, DeclareLaunchArgument from launch.events import Shutdown def getFullFilePath(name, dir): @@ -18,22 +18,44 @@ def getFullFilePath(name, dir): def generate_launch_description(): - track_name = "FSG23.yaml" + track_name_arg = DeclareLaunchArgument( + 'track_name', + default_value=getFullFilePath("FSG23.yaml", "tracks"), + description='Full path to the track YAML file' + ) + discipline_arg = DeclareLaunchArgument( + 'discipline', + default_value='autocross', + description='Driving discipline' + ) + headless_arg = DeclareLaunchArgument( + 'headless', + default_value='false', + description='Run in headless mode (no RViz)' + ) + report_file_dir_arg = DeclareLaunchArgument( + 'report_file_dir', + default_value='/tmp', + description='Directory to write the evaluation report file' + ) + + track_name = LaunchConfiguration('track_name') + discipline = LaunchConfiguration('discipline') + report_file_dir = LaunchConfiguration('report_file_dir') + track_frame = "map" realtime_ratio = 1.0 - discipline = "autocross" xacro_file_name = 'separate_model.xacro' xacro_path = getFullFilePath(xacro_file_name, "urdf") - nodePacsim = Node( package='pacsim', namespace='pacsim', executable='pacsim_node', name='pacsim_node', - parameters = [{'use_sim_time':True}, {"track_name" : getFullFilePath(track_name, "tracks")}, {"grip_map_path" : getFullFilePath("gripMap.yaml", "tracks")}, {"track_frame" : track_frame}, {"realtime_ratio" : realtime_ratio}, - {"report_file_dir" : "/tmp"}, {"main_config_path" : getFullFilePath("mainConfig.yaml", dir="config")}, {"perception_config_path" : getFullFilePath("perception.yaml", dir="config")}, + parameters = [{'use_sim_time':True}, {"track_name" : track_name}, {"grip_map_path" : getFullFilePath("gripMap.yaml", "tracks")}, {"track_frame" : track_frame}, {"realtime_ratio" : realtime_ratio}, + {"report_file_dir" : report_file_dir}, {"main_config_path" : getFullFilePath("mainConfig.yaml", dir="config")}, {"perception_config_path" : getFullFilePath("perception.yaml", dir="config")}, {"sensors_config_path" : getFullFilePath("sensors.yaml", dir="config")}, {"vehicle_model_config_path" : getFullFilePath("vehicleModel.yaml", dir="config")}, {"discipline" : discipline}], output="screen", emulate_tty=True) @@ -56,4 +78,4 @@ def generate_launch_description(): 'robot_description': Command(['xacro',' ',xacro_path]) }], arguments=[xacro_path]) - return LaunchDescription([nodePacsim, nodePacsimShutdownEventHandler, robot_state_publisher]) \ No newline at end of file + return LaunchDescription([track_name_arg, discipline_arg, headless_arg, report_file_dir_arg, nodePacsim, nodePacsimShutdownEventHandler, robot_state_publisher])