@@ -50,6 +50,7 @@ def generate_launch_description():
50
50
51
51
# Launch configuration variables specific to simulation
52
52
rviz_config_file = LaunchConfiguration ('rviz_config_file' )
53
+ use_rviz = LaunchConfiguration ('use_rviz' )
53
54
use_simulator = LaunchConfiguration ('use_simulator' )
54
55
use_robot_state_pub = LaunchConfiguration ('use_robot_state_pub' )
55
56
headless = LaunchConfiguration ('headless' )
@@ -90,6 +91,12 @@ def generate_launch_description():
90
91
description = 'Full path to the RVIZ config file to use' ,
91
92
)
92
93
94
+ declare_use_rviz_cmd = DeclareLaunchArgument (
95
+ 'use_rviz' ,
96
+ default_value = 'True' ,
97
+ description = 'Whether to start rviz' ,
98
+ )
99
+
93
100
declare_use_simulator_cmd = DeclareLaunchArgument (
94
101
'use_simulator' ,
95
102
default_value = 'True' ,
@@ -137,6 +144,7 @@ def generate_launch_description():
137
144
)
138
145
139
146
rviz_cmd = Node (
147
+ condition = IfCondition (use_rviz ),
140
148
package = 'rviz2' ,
141
149
executable = 'rviz2' ,
142
150
name = 'rviz2' ,
@@ -205,6 +213,7 @@ def generate_launch_description():
205
213
ld .add_action (declare_use_sim_time_cmd )
206
214
207
215
ld .add_action (declare_rviz_config_file_cmd )
216
+ ld .add_action (declare_use_rviz_cmd )
208
217
ld .add_action (declare_use_simulator_cmd )
209
218
ld .add_action (declare_use_robot_state_pub_cmd )
210
219
ld .add_action (declare_simulator_cmd )
0 commit comments