From 094601acbd5c2ef3228373127560011cb8ac7782 Mon Sep 17 00:00:00 2001 From: "Pasch, Frederik" Date: Tue, 23 Jul 2024 13:29:51 +0200 Subject: [PATCH] Make rviz launch optional --- nav2_minimal_tb4_sim/launch/simulation.launch.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/nav2_minimal_tb4_sim/launch/simulation.launch.py b/nav2_minimal_tb4_sim/launch/simulation.launch.py index d46abc1..c4cc525 100644 --- a/nav2_minimal_tb4_sim/launch/simulation.launch.py +++ b/nav2_minimal_tb4_sim/launch/simulation.launch.py @@ -50,6 +50,7 @@ def generate_launch_description(): # Launch configuration variables specific to simulation rviz_config_file = LaunchConfiguration('rviz_config_file') + use_rviz = LaunchConfiguration('use_rviz') use_simulator = LaunchConfiguration('use_simulator') use_robot_state_pub = LaunchConfiguration('use_robot_state_pub') headless = LaunchConfiguration('headless') @@ -90,6 +91,12 @@ def generate_launch_description(): description='Full path to the RVIZ config file to use', ) + declare_use_rviz_cmd = DeclareLaunchArgument( + 'use_rviz', + default_value='True', + description='Whether to start rviz', + ) + declare_use_simulator_cmd = DeclareLaunchArgument( 'use_simulator', default_value='True', @@ -137,6 +144,7 @@ def generate_launch_description(): ) rviz_cmd = Node( + condition=IfCondition(use_rviz), package='rviz2', executable='rviz2', name='rviz2', @@ -205,6 +213,7 @@ def generate_launch_description(): ld.add_action(declare_use_sim_time_cmd) ld.add_action(declare_rviz_config_file_cmd) + ld.add_action(declare_use_rviz_cmd) ld.add_action(declare_use_simulator_cmd) ld.add_action(declare_use_robot_state_pub_cmd) ld.add_action(declare_simulator_cmd)