Skip to content

Commit

Permalink
Make rviz launch optional
Browse files Browse the repository at this point in the history
Signed-off-by: Pasch, Frederik <[email protected]>
  • Loading branch information
fred-labs committed Jul 23, 2024
1 parent 6b64127 commit a20d09a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions nav2_minimal_tb4_sim/launch/simulation.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -137,6 +144,7 @@ def generate_launch_description():
)

rviz_cmd = Node(
condition=IfCondition(use_rviz),
package='rviz2',
executable='rviz2',
name='rviz2',
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit a20d09a

Please sign in to comment.