@@ -50,6 +50,7 @@ def generate_launch_description():
5050
5151 # Launch configuration variables specific to simulation
5252 rviz_config_file = LaunchConfiguration ('rviz_config_file' )
53+ use_rviz = LaunchConfiguration ('use_rviz' )
5354 use_simulator = LaunchConfiguration ('use_simulator' )
5455 use_robot_state_pub = LaunchConfiguration ('use_robot_state_pub' )
5556 headless = LaunchConfiguration ('headless' )
@@ -90,6 +91,12 @@ def generate_launch_description():
9091 description = 'Full path to the RVIZ config file to use' ,
9192 )
9293
94+ declare_use_rviz_cmd = DeclareLaunchArgument (
95+ 'use_rviz' ,
96+ default_value = 'True' ,
97+ description = 'Whether to start rviz' ,
98+ )
99+
93100 declare_use_simulator_cmd = DeclareLaunchArgument (
94101 'use_simulator' ,
95102 default_value = 'True' ,
@@ -137,6 +144,7 @@ def generate_launch_description():
137144 )
138145
139146 rviz_cmd = Node (
147+ condition = IfCondition (use_rviz ),
140148 package = 'rviz2' ,
141149 executable = 'rviz2' ,
142150 name = 'rviz2' ,
@@ -205,6 +213,7 @@ def generate_launch_description():
205213 ld .add_action (declare_use_sim_time_cmd )
206214
207215 ld .add_action (declare_rviz_config_file_cmd )
216+ ld .add_action (declare_use_rviz_cmd )
208217 ld .add_action (declare_use_simulator_cmd )
209218 ld .add_action (declare_use_robot_state_pub_cmd )
210219 ld .add_action (declare_simulator_cmd )
0 commit comments