Skip to content

Commit 5785c77

Browse files
Add back use_simulator parameter
Signed-off-by: Luca Della Vedova <[email protected]>
1 parent af3c03a commit 5785c77

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

nav2_minimal_tb4_sim/launch/spawn_tb4.launch.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
from launch import LaunchDescription
2121
from launch.actions import DeclareLaunchArgument
22+
from launch.conditions import IfCondition
2223
from launch.substitutions import LaunchConfiguration
2324

2425
from launch_ros.actions import Node, PushRosNamespace
@@ -45,6 +46,11 @@ def generate_launch_description():
4546
default_value='',
4647
description='Top-level namespace')
4748

49+
declare_use_simulator_cmd = DeclareLaunchArgument(
50+
'use_simulator',
51+
default_value='True',
52+
description='Whether to start the simulator')
53+
4854
declare_use_sim_time_cmd = DeclareLaunchArgument(
4955
'use_sim_time',
5056
default_value='true',
@@ -97,6 +103,7 @@ def generate_launch_description():
97103
arguments=['/rgbd_camera/depth_image'])
98104

99105
spawn_model = Node(
106+
condition=IfCondition(use_simulator),
100107
package='ros_gz_sim',
101108
executable='create',
102109
output='screen',
@@ -114,6 +121,7 @@ def generate_launch_description():
114121
ld.add_action(declare_namespace_cmd)
115122
ld.add_action(declare_robot_name_cmd)
116123
# ld.add_action(declare_robot_sdf_cmd)
124+
ld.add_action(declare_use_simulator_cmd)
117125
ld.add_action(declare_use_sim_time_cmd)
118126

119127
ld.add_action(PushRosNamespace(namespace))

0 commit comments

Comments
 (0)