From 09ea1ae3ee6a6a7dbdc950dd5ed4cef7d8065d9d Mon Sep 17 00:00:00 2001 From: ruffsl Date: Thu, 6 Apr 2023 14:58:56 +0200 Subject: [PATCH 1/2] Add headless and use_rviz LaunchConfigurations in nav2_simple_commander demo launch files for whether to start rviz or gzclient to simplify their use in headless environments --- .../launch/assisted_teleop_example_launch.py | 23 ++++++++++++++++++- .../launch/follow_path_example_launch.py | 23 ++++++++++++++++++- .../launch/inspection_demo_launch.py | 23 ++++++++++++++++++- .../nav_through_poses_example_launch.py | 23 ++++++++++++++++++- .../launch/nav_to_pose_example_launch.py | 23 ++++++++++++++++++- .../launch/picking_demo_launch.py | 23 ++++++++++++++++++- .../launch/recoveries_example_launch.py | 23 ++++++++++++++++++- .../launch/security_demo_launch.py | 23 ++++++++++++++++++- .../waypoint_follower_example_launch.py | 23 ++++++++++++++++++- 9 files changed, 198 insertions(+), 9 deletions(-) diff --git a/nav2_simple_commander/launch/assisted_teleop_example_launch.py b/nav2_simple_commander/launch/assisted_teleop_example_launch.py index 59bd6ea6290..e2cf8770ea4 100644 --- a/nav2_simple_commander/launch/assisted_teleop_example_launch.py +++ b/nav2_simple_commander/launch/assisted_teleop_example_launch.py @@ -18,8 +18,10 @@ from ament_index_python.packages import get_package_share_directory from launch import LaunchDescription -from launch.actions import ExecuteProcess, IncludeLaunchDescription +from launch.actions import DeclareLaunchArgument, ExecuteProcess, IncludeLaunchDescription +from launch.conditions import IfCondition from launch.launch_description_sources import PythonLaunchDescriptionSource +from launch.substitutions import LaunchConfiguration from launch_ros.actions import Node @@ -31,12 +33,28 @@ def generate_launch_description(): map_yaml_file = os.path.join(warehouse_dir, 'maps', '005', 'map.yaml') world = os.path.join(python_commander_dir, 'warehouse.world') + # Launch configuration variables + use_rviz = LaunchConfiguration('use_rviz') + headless = LaunchConfiguration('headless') + + # Declare the launch arguments + declare_use_rviz_cmd = DeclareLaunchArgument( + 'use_rviz', + default_value='True', + description='Whether to start RVIZ') + + declare_simulator_cmd = DeclareLaunchArgument( + 'headless', + default_value='True', + description='Whether to execute gzclient)') + # start the simulation start_gazebo_server_cmd = ExecuteProcess( cmd=['gzserver', '-s', 'libgazebo_ros_factory.so', world], cwd=[warehouse_dir], output='screen') start_gazebo_client_cmd = ExecuteProcess( + condition=IfCondition(headless), cmd=['gzclient'], cwd=[warehouse_dir], output='screen') @@ -52,6 +70,7 @@ def generate_launch_description(): rviz_cmd = IncludeLaunchDescription( PythonLaunchDescriptionSource( os.path.join(nav2_bringup_dir, 'launch', 'rviz_launch.py')), + condition=IfCondition(use_rviz), launch_arguments={'namespace': '', 'use_namespace': 'False'}.items()) @@ -69,6 +88,8 @@ def generate_launch_description(): output='screen') ld = LaunchDescription() + ld.add_action(declare_use_rviz_cmd) + ld.add_action(declare_simulator_cmd) ld.add_action(start_gazebo_server_cmd) ld.add_action(start_gazebo_client_cmd) ld.add_action(start_robot_state_publisher_cmd) diff --git a/nav2_simple_commander/launch/follow_path_example_launch.py b/nav2_simple_commander/launch/follow_path_example_launch.py index 41624dff6fd..99da088a0e5 100644 --- a/nav2_simple_commander/launch/follow_path_example_launch.py +++ b/nav2_simple_commander/launch/follow_path_example_launch.py @@ -17,8 +17,10 @@ from ament_index_python.packages import get_package_share_directory from launch import LaunchDescription -from launch.actions import ExecuteProcess, IncludeLaunchDescription +from launch.actions import DeclareLaunchArgument, ExecuteProcess, IncludeLaunchDescription +from launch.conditions import IfCondition from launch.launch_description_sources import PythonLaunchDescriptionSource +from launch.substitutions import LaunchConfiguration from launch_ros.actions import Node @@ -30,12 +32,28 @@ def generate_launch_description(): map_yaml_file = os.path.join(warehouse_dir, 'maps', '005', 'map.yaml') world = os.path.join(python_commander_dir, 'warehouse.world') + # Launch configuration variables + use_rviz = LaunchConfiguration('use_rviz') + headless = LaunchConfiguration('headless') + + # Declare the launch arguments + declare_use_rviz_cmd = DeclareLaunchArgument( + 'use_rviz', + default_value='True', + description='Whether to start RVIZ') + + declare_simulator_cmd = DeclareLaunchArgument( + 'headless', + default_value='True', + description='Whether to execute gzclient)') + # start the simulation start_gazebo_server_cmd = ExecuteProcess( cmd=['gzserver', '-s', 'libgazebo_ros_factory.so', world], cwd=[warehouse_dir], output='screen') start_gazebo_client_cmd = ExecuteProcess( + condition=IfCondition(headless), cmd=['gzclient'], cwd=[warehouse_dir], output='screen') @@ -51,6 +69,7 @@ def generate_launch_description(): rviz_cmd = IncludeLaunchDescription( PythonLaunchDescriptionSource( os.path.join(nav2_bringup_dir, 'launch', 'rviz_launch.py')), + condition=IfCondition(use_rviz), launch_arguments={'namespace': '', 'use_namespace': 'False'}.items()) @@ -68,6 +87,8 @@ def generate_launch_description(): output='screen') ld = LaunchDescription() + ld.add_action(declare_use_rviz_cmd) + ld.add_action(declare_simulator_cmd) ld.add_action(start_gazebo_server_cmd) ld.add_action(start_gazebo_client_cmd) ld.add_action(start_robot_state_publisher_cmd) diff --git a/nav2_simple_commander/launch/inspection_demo_launch.py b/nav2_simple_commander/launch/inspection_demo_launch.py index 3cfbd1a2c3c..fd8f2dfa248 100644 --- a/nav2_simple_commander/launch/inspection_demo_launch.py +++ b/nav2_simple_commander/launch/inspection_demo_launch.py @@ -17,8 +17,10 @@ from ament_index_python.packages import get_package_share_directory from launch import LaunchDescription -from launch.actions import ExecuteProcess, IncludeLaunchDescription +from launch.actions import DeclareLaunchArgument, ExecuteProcess, IncludeLaunchDescription +from launch.conditions import IfCondition from launch.launch_description_sources import PythonLaunchDescriptionSource +from launch.substitutions import LaunchConfiguration from launch_ros.actions import Node @@ -30,12 +32,28 @@ def generate_launch_description(): map_yaml_file = os.path.join(warehouse_dir, 'maps', '005', 'map.yaml') world = os.path.join(python_commander_dir, 'warehouse.world') + # Launch configuration variables + use_rviz = LaunchConfiguration('use_rviz') + headless = LaunchConfiguration('headless') + + # Declare the launch arguments + declare_use_rviz_cmd = DeclareLaunchArgument( + 'use_rviz', + default_value='True', + description='Whether to start RVIZ') + + declare_simulator_cmd = DeclareLaunchArgument( + 'headless', + default_value='True', + description='Whether to execute gzclient)') + # start the simulation start_gazebo_server_cmd = ExecuteProcess( cmd=['gzserver', '-s', 'libgazebo_ros_factory.so', world], cwd=[warehouse_dir], output='screen') start_gazebo_client_cmd = ExecuteProcess( + condition=IfCondition(headless), cmd=['gzclient'], cwd=[warehouse_dir], output='screen') @@ -51,6 +69,7 @@ def generate_launch_description(): rviz_cmd = IncludeLaunchDescription( PythonLaunchDescriptionSource( os.path.join(nav2_bringup_dir, 'launch', 'rviz_launch.py')), + condition=IfCondition(use_rviz), launch_arguments={'namespace': '', 'use_namespace': 'False'}.items()) @@ -68,6 +87,8 @@ def generate_launch_description(): output='screen') ld = LaunchDescription() + ld.add_action(declare_use_rviz_cmd) + ld.add_action(declare_simulator_cmd) ld.add_action(start_gazebo_server_cmd) ld.add_action(start_gazebo_client_cmd) ld.add_action(start_robot_state_publisher_cmd) diff --git a/nav2_simple_commander/launch/nav_through_poses_example_launch.py b/nav2_simple_commander/launch/nav_through_poses_example_launch.py index 11f39b9a37c..73b3b23cea4 100644 --- a/nav2_simple_commander/launch/nav_through_poses_example_launch.py +++ b/nav2_simple_commander/launch/nav_through_poses_example_launch.py @@ -17,8 +17,10 @@ from ament_index_python.packages import get_package_share_directory from launch import LaunchDescription -from launch.actions import ExecuteProcess, IncludeLaunchDescription +from launch.actions import DeclareLaunchArgument, ExecuteProcess, IncludeLaunchDescription +from launch.conditions import IfCondition from launch.launch_description_sources import PythonLaunchDescriptionSource +from launch.substitutions import LaunchConfiguration from launch_ros.actions import Node @@ -30,12 +32,28 @@ def generate_launch_description(): map_yaml_file = os.path.join(warehouse_dir, 'maps', '005', 'map.yaml') world = os.path.join(python_commander_dir, 'warehouse.world') + # Launch configuration variables + use_rviz = LaunchConfiguration('use_rviz') + headless = LaunchConfiguration('headless') + + # Declare the launch arguments + declare_use_rviz_cmd = DeclareLaunchArgument( + 'use_rviz', + default_value='True', + description='Whether to start RVIZ') + + declare_simulator_cmd = DeclareLaunchArgument( + 'headless', + default_value='True', + description='Whether to execute gzclient)') + # start the simulation start_gazebo_server_cmd = ExecuteProcess( cmd=['gzserver', '-s', 'libgazebo_ros_factory.so', world], cwd=[warehouse_dir], output='screen') start_gazebo_client_cmd = ExecuteProcess( + condition=IfCondition(headless), cmd=['gzclient'], cwd=[warehouse_dir], output='screen') @@ -51,6 +69,7 @@ def generate_launch_description(): rviz_cmd = IncludeLaunchDescription( PythonLaunchDescriptionSource( os.path.join(nav2_bringup_dir, 'launch', 'rviz_launch.py')), + condition=IfCondition(use_rviz), launch_arguments={'namespace': '', 'use_namespace': 'False'}.items()) @@ -68,6 +87,8 @@ def generate_launch_description(): output='screen') ld = LaunchDescription() + ld.add_action(declare_use_rviz_cmd) + ld.add_action(declare_simulator_cmd) ld.add_action(start_gazebo_server_cmd) ld.add_action(start_gazebo_client_cmd) ld.add_action(start_robot_state_publisher_cmd) diff --git a/nav2_simple_commander/launch/nav_to_pose_example_launch.py b/nav2_simple_commander/launch/nav_to_pose_example_launch.py index 7d019884fe6..7d7cfe16af9 100644 --- a/nav2_simple_commander/launch/nav_to_pose_example_launch.py +++ b/nav2_simple_commander/launch/nav_to_pose_example_launch.py @@ -17,8 +17,10 @@ from ament_index_python.packages import get_package_share_directory from launch import LaunchDescription -from launch.actions import ExecuteProcess, IncludeLaunchDescription +from launch.actions import DeclareLaunchArgument, ExecuteProcess, IncludeLaunchDescription +from launch.conditions import IfCondition from launch.launch_description_sources import PythonLaunchDescriptionSource +from launch.substitutions import LaunchConfiguration from launch_ros.actions import Node @@ -30,12 +32,28 @@ def generate_launch_description(): map_yaml_file = os.path.join(warehouse_dir, 'maps', '005', 'map.yaml') world = os.path.join(python_commander_dir, 'warehouse.world') + # Launch configuration variables + use_rviz = LaunchConfiguration('use_rviz') + headless = LaunchConfiguration('headless') + + # Declare the launch arguments + declare_use_rviz_cmd = DeclareLaunchArgument( + 'use_rviz', + default_value='True', + description='Whether to start RVIZ') + + declare_simulator_cmd = DeclareLaunchArgument( + 'headless', + default_value='True', + description='Whether to execute gzclient)') + # start the simulation start_gazebo_server_cmd = ExecuteProcess( cmd=['gzserver', '-s', 'libgazebo_ros_factory.so', world], cwd=[warehouse_dir], output='screen') start_gazebo_client_cmd = ExecuteProcess( + condition=IfCondition(headless), cmd=['gzclient'], cwd=[warehouse_dir], output='screen') @@ -51,6 +69,7 @@ def generate_launch_description(): rviz_cmd = IncludeLaunchDescription( PythonLaunchDescriptionSource( os.path.join(nav2_bringup_dir, 'launch', 'rviz_launch.py')), + condition=IfCondition(use_rviz), launch_arguments={'namespace': '', 'use_namespace': 'False'}.items()) @@ -68,6 +87,8 @@ def generate_launch_description(): output='screen') ld = LaunchDescription() + ld.add_action(declare_use_rviz_cmd) + ld.add_action(declare_simulator_cmd) ld.add_action(start_gazebo_server_cmd) ld.add_action(start_gazebo_client_cmd) ld.add_action(start_robot_state_publisher_cmd) diff --git a/nav2_simple_commander/launch/picking_demo_launch.py b/nav2_simple_commander/launch/picking_demo_launch.py index 5978570243f..c257bd3ac06 100644 --- a/nav2_simple_commander/launch/picking_demo_launch.py +++ b/nav2_simple_commander/launch/picking_demo_launch.py @@ -17,8 +17,10 @@ from ament_index_python.packages import get_package_share_directory from launch import LaunchDescription -from launch.actions import ExecuteProcess, IncludeLaunchDescription +from launch.actions import DeclareLaunchArgument, ExecuteProcess, IncludeLaunchDescription +from launch.conditions import IfCondition from launch.launch_description_sources import PythonLaunchDescriptionSource +from launch.substitutions import LaunchConfiguration from launch_ros.actions import Node @@ -30,12 +32,28 @@ def generate_launch_description(): map_yaml_file = os.path.join(warehouse_dir, 'maps', '005', 'map.yaml') world = os.path.join(python_commander_dir, 'warehouse.world') + # Launch configuration variables + use_rviz = LaunchConfiguration('use_rviz') + headless = LaunchConfiguration('headless') + + # Declare the launch arguments + declare_use_rviz_cmd = DeclareLaunchArgument( + 'use_rviz', + default_value='True', + description='Whether to start RVIZ') + + declare_simulator_cmd = DeclareLaunchArgument( + 'headless', + default_value='True', + description='Whether to execute gzclient)') + # start the simulation start_gazebo_server_cmd = ExecuteProcess( cmd=['gzserver', '-s', 'libgazebo_ros_factory.so', world], cwd=[warehouse_dir], output='screen') start_gazebo_client_cmd = ExecuteProcess( + condition=IfCondition(headless), cmd=['gzclient'], cwd=[warehouse_dir], output='screen') @@ -51,6 +69,7 @@ def generate_launch_description(): rviz_cmd = IncludeLaunchDescription( PythonLaunchDescriptionSource( os.path.join(nav2_bringup_dir, 'launch', 'rviz_launch.py')), + condition=IfCondition(use_rviz), launch_arguments={'namespace': '', 'use_namespace': 'False'}.items()) @@ -68,6 +87,8 @@ def generate_launch_description(): output='screen') ld = LaunchDescription() + ld.add_action(declare_use_rviz_cmd) + ld.add_action(declare_simulator_cmd) ld.add_action(start_gazebo_server_cmd) ld.add_action(start_gazebo_client_cmd) ld.add_action(start_robot_state_publisher_cmd) diff --git a/nav2_simple_commander/launch/recoveries_example_launch.py b/nav2_simple_commander/launch/recoveries_example_launch.py index 0d505000349..19b6788f485 100644 --- a/nav2_simple_commander/launch/recoveries_example_launch.py +++ b/nav2_simple_commander/launch/recoveries_example_launch.py @@ -17,8 +17,10 @@ from ament_index_python.packages import get_package_share_directory from launch import LaunchDescription -from launch.actions import ExecuteProcess, IncludeLaunchDescription +from launch.actions import DeclareLaunchArgument, ExecuteProcess, IncludeLaunchDescription +from launch.conditions import IfCondition from launch.launch_description_sources import PythonLaunchDescriptionSource +from launch.substitutions import LaunchConfiguration from launch_ros.actions import Node @@ -30,12 +32,28 @@ def generate_launch_description(): map_yaml_file = os.path.join(warehouse_dir, 'maps', '005', 'map.yaml') world = os.path.join(python_commander_dir, 'warehouse.world') + # Launch configuration variables + use_rviz = LaunchConfiguration('use_rviz') + headless = LaunchConfiguration('headless') + + # Declare the launch arguments + declare_use_rviz_cmd = DeclareLaunchArgument( + 'use_rviz', + default_value='True', + description='Whether to start RVIZ') + + declare_simulator_cmd = DeclareLaunchArgument( + 'headless', + default_value='True', + description='Whether to execute gzclient)') + # start the simulation start_gazebo_server_cmd = ExecuteProcess( cmd=['gzserver', '-s', 'libgazebo_ros_factory.so', world], cwd=[warehouse_dir], output='screen') start_gazebo_client_cmd = ExecuteProcess( + condition=IfCondition(headless), cmd=['gzclient'], cwd=[warehouse_dir], output='screen') @@ -51,6 +69,7 @@ def generate_launch_description(): rviz_cmd = IncludeLaunchDescription( PythonLaunchDescriptionSource( os.path.join(nav2_bringup_dir, 'launch', 'rviz_launch.py')), + condition=IfCondition(use_rviz), launch_arguments={'namespace': '', 'use_namespace': 'False'}.items()) @@ -68,6 +87,8 @@ def generate_launch_description(): output='screen') ld = LaunchDescription() + ld.add_action(declare_use_rviz_cmd) + ld.add_action(declare_simulator_cmd) ld.add_action(start_gazebo_server_cmd) ld.add_action(start_gazebo_client_cmd) ld.add_action(start_robot_state_publisher_cmd) diff --git a/nav2_simple_commander/launch/security_demo_launch.py b/nav2_simple_commander/launch/security_demo_launch.py index 55ef0fe65a2..f7f76afbf78 100644 --- a/nav2_simple_commander/launch/security_demo_launch.py +++ b/nav2_simple_commander/launch/security_demo_launch.py @@ -17,8 +17,10 @@ from ament_index_python.packages import get_package_share_directory from launch import LaunchDescription -from launch.actions import ExecuteProcess, IncludeLaunchDescription +from launch.actions import DeclareLaunchArgument, ExecuteProcess, IncludeLaunchDescription +from launch.conditions import IfCondition from launch.launch_description_sources import PythonLaunchDescriptionSource +from launch.substitutions import LaunchConfiguration from launch_ros.actions import Node @@ -30,12 +32,28 @@ def generate_launch_description(): map_yaml_file = os.path.join(warehouse_dir, 'maps', '005', 'map.yaml') world = os.path.join(python_commander_dir, 'warehouse.world') + # Launch configuration variables + use_rviz = LaunchConfiguration('use_rviz') + headless = LaunchConfiguration('headless') + + # Declare the launch arguments + declare_use_rviz_cmd = DeclareLaunchArgument( + 'use_rviz', + default_value='True', + description='Whether to start RVIZ') + + declare_simulator_cmd = DeclareLaunchArgument( + 'headless', + default_value='True', + description='Whether to execute gzclient)') + # start the simulation start_gazebo_server_cmd = ExecuteProcess( cmd=['gzserver', '-s', 'libgazebo_ros_factory.so', world], cwd=[warehouse_dir], output='screen') start_gazebo_client_cmd = ExecuteProcess( + condition=IfCondition(headless), cmd=['gzclient'], cwd=[warehouse_dir], output='screen') @@ -51,6 +69,7 @@ def generate_launch_description(): rviz_cmd = IncludeLaunchDescription( PythonLaunchDescriptionSource( os.path.join(nav2_bringup_dir, 'launch', 'rviz_launch.py')), + condition=IfCondition(use_rviz), launch_arguments={'namespace': '', 'use_namespace': 'False'}.items()) @@ -68,6 +87,8 @@ def generate_launch_description(): output='screen') ld = LaunchDescription() + ld.add_action(declare_use_rviz_cmd) + ld.add_action(declare_simulator_cmd) ld.add_action(start_gazebo_server_cmd) ld.add_action(start_gazebo_client_cmd) ld.add_action(start_robot_state_publisher_cmd) diff --git a/nav2_simple_commander/launch/waypoint_follower_example_launch.py b/nav2_simple_commander/launch/waypoint_follower_example_launch.py index eddcc0d4b5d..95a418af624 100644 --- a/nav2_simple_commander/launch/waypoint_follower_example_launch.py +++ b/nav2_simple_commander/launch/waypoint_follower_example_launch.py @@ -17,8 +17,10 @@ from ament_index_python.packages import get_package_share_directory from launch import LaunchDescription -from launch.actions import ExecuteProcess, IncludeLaunchDescription +from launch.actions import DeclareLaunchArgument, ExecuteProcess, IncludeLaunchDescription +from launch.conditions import IfCondition from launch.launch_description_sources import PythonLaunchDescriptionSource +from launch.substitutions import LaunchConfiguration from launch_ros.actions import Node @@ -30,12 +32,28 @@ def generate_launch_description(): map_yaml_file = os.path.join(warehouse_dir, 'maps', '005', 'map.yaml') world = os.path.join(python_commander_dir, 'warehouse.world') + # Launch configuration variables + use_rviz = LaunchConfiguration('use_rviz') + headless = LaunchConfiguration('headless') + + # Declare the launch arguments + declare_use_rviz_cmd = DeclareLaunchArgument( + 'use_rviz', + default_value='True', + description='Whether to start RVIZ') + + declare_simulator_cmd = DeclareLaunchArgument( + 'headless', + default_value='True', + description='Whether to execute gzclient)') + # start the simulation start_gazebo_server_cmd = ExecuteProcess( cmd=['gzserver', '-s', 'libgazebo_ros_factory.so', world], cwd=[warehouse_dir], output='screen') start_gazebo_client_cmd = ExecuteProcess( + condition=IfCondition(headless), cmd=['gzclient'], cwd=[warehouse_dir], output='screen') @@ -51,6 +69,7 @@ def generate_launch_description(): rviz_cmd = IncludeLaunchDescription( PythonLaunchDescriptionSource( os.path.join(nav2_bringup_dir, 'launch', 'rviz_launch.py')), + condition=IfCondition(use_rviz), launch_arguments={'namespace': '', 'use_namespace': 'False'}.items()) @@ -68,6 +87,8 @@ def generate_launch_description(): output='screen') ld = LaunchDescription() + ld.add_action(declare_use_rviz_cmd) + ld.add_action(declare_simulator_cmd) ld.add_action(start_gazebo_server_cmd) ld.add_action(start_gazebo_client_cmd) ld.add_action(start_robot_state_publisher_cmd) From 6e7ba65cb68ecec3db8e00ddf62907e548501050 Mon Sep 17 00:00:00 2001 From: Ruffin Date: Fri, 7 Apr 2023 12:27:11 -0500 Subject: [PATCH 2/2] Fix headless logic to match tb3_simulation_launch.py for launch arg consistency --- .../launch/assisted_teleop_example_launch.py | 6 +++--- nav2_simple_commander/launch/follow_path_example_launch.py | 6 +++--- nav2_simple_commander/launch/inspection_demo_launch.py | 6 +++--- .../launch/nav_through_poses_example_launch.py | 6 +++--- nav2_simple_commander/launch/nav_to_pose_example_launch.py | 6 +++--- nav2_simple_commander/launch/picking_demo_launch.py | 6 +++--- nav2_simple_commander/launch/recoveries_example_launch.py | 6 +++--- nav2_simple_commander/launch/security_demo_launch.py | 6 +++--- .../launch/waypoint_follower_example_launch.py | 6 +++--- 9 files changed, 27 insertions(+), 27 deletions(-) diff --git a/nav2_simple_commander/launch/assisted_teleop_example_launch.py b/nav2_simple_commander/launch/assisted_teleop_example_launch.py index e2cf8770ea4..cd37de2bdff 100644 --- a/nav2_simple_commander/launch/assisted_teleop_example_launch.py +++ b/nav2_simple_commander/launch/assisted_teleop_example_launch.py @@ -21,7 +21,7 @@ from launch.actions import DeclareLaunchArgument, ExecuteProcess, IncludeLaunchDescription from launch.conditions import IfCondition from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch.substitutions import LaunchConfiguration +from launch.substitutions import LaunchConfiguration, PythonExpression from launch_ros.actions import Node @@ -45,7 +45,7 @@ def generate_launch_description(): declare_simulator_cmd = DeclareLaunchArgument( 'headless', - default_value='True', + default_value='False', description='Whether to execute gzclient)') # start the simulation @@ -54,7 +54,7 @@ def generate_launch_description(): cwd=[warehouse_dir], output='screen') start_gazebo_client_cmd = ExecuteProcess( - condition=IfCondition(headless), + condition=IfCondition(PythonExpression(['not ', headless])), cmd=['gzclient'], cwd=[warehouse_dir], output='screen') diff --git a/nav2_simple_commander/launch/follow_path_example_launch.py b/nav2_simple_commander/launch/follow_path_example_launch.py index 99da088a0e5..e933ed421cd 100644 --- a/nav2_simple_commander/launch/follow_path_example_launch.py +++ b/nav2_simple_commander/launch/follow_path_example_launch.py @@ -20,7 +20,7 @@ from launch.actions import DeclareLaunchArgument, ExecuteProcess, IncludeLaunchDescription from launch.conditions import IfCondition from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch.substitutions import LaunchConfiguration +from launch.substitutions import LaunchConfiguration, PythonExpression from launch_ros.actions import Node @@ -44,7 +44,7 @@ def generate_launch_description(): declare_simulator_cmd = DeclareLaunchArgument( 'headless', - default_value='True', + default_value='False', description='Whether to execute gzclient)') # start the simulation @@ -53,7 +53,7 @@ def generate_launch_description(): cwd=[warehouse_dir], output='screen') start_gazebo_client_cmd = ExecuteProcess( - condition=IfCondition(headless), + condition=IfCondition(PythonExpression(['not ', headless])), cmd=['gzclient'], cwd=[warehouse_dir], output='screen') diff --git a/nav2_simple_commander/launch/inspection_demo_launch.py b/nav2_simple_commander/launch/inspection_demo_launch.py index fd8f2dfa248..43456f6398b 100644 --- a/nav2_simple_commander/launch/inspection_demo_launch.py +++ b/nav2_simple_commander/launch/inspection_demo_launch.py @@ -20,7 +20,7 @@ from launch.actions import DeclareLaunchArgument, ExecuteProcess, IncludeLaunchDescription from launch.conditions import IfCondition from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch.substitutions import LaunchConfiguration +from launch.substitutions import LaunchConfiguration, PythonExpression from launch_ros.actions import Node @@ -44,7 +44,7 @@ def generate_launch_description(): declare_simulator_cmd = DeclareLaunchArgument( 'headless', - default_value='True', + default_value='False', description='Whether to execute gzclient)') # start the simulation @@ -53,7 +53,7 @@ def generate_launch_description(): cwd=[warehouse_dir], output='screen') start_gazebo_client_cmd = ExecuteProcess( - condition=IfCondition(headless), + condition=IfCondition(PythonExpression(['not ', headless])), cmd=['gzclient'], cwd=[warehouse_dir], output='screen') diff --git a/nav2_simple_commander/launch/nav_through_poses_example_launch.py b/nav2_simple_commander/launch/nav_through_poses_example_launch.py index 73b3b23cea4..0c9fedaad99 100644 --- a/nav2_simple_commander/launch/nav_through_poses_example_launch.py +++ b/nav2_simple_commander/launch/nav_through_poses_example_launch.py @@ -20,7 +20,7 @@ from launch.actions import DeclareLaunchArgument, ExecuteProcess, IncludeLaunchDescription from launch.conditions import IfCondition from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch.substitutions import LaunchConfiguration +from launch.substitutions import LaunchConfiguration, PythonExpression from launch_ros.actions import Node @@ -44,7 +44,7 @@ def generate_launch_description(): declare_simulator_cmd = DeclareLaunchArgument( 'headless', - default_value='True', + default_value='False', description='Whether to execute gzclient)') # start the simulation @@ -53,7 +53,7 @@ def generate_launch_description(): cwd=[warehouse_dir], output='screen') start_gazebo_client_cmd = ExecuteProcess( - condition=IfCondition(headless), + condition=IfCondition(PythonExpression(['not ', headless])), cmd=['gzclient'], cwd=[warehouse_dir], output='screen') diff --git a/nav2_simple_commander/launch/nav_to_pose_example_launch.py b/nav2_simple_commander/launch/nav_to_pose_example_launch.py index 7d7cfe16af9..d4259494092 100644 --- a/nav2_simple_commander/launch/nav_to_pose_example_launch.py +++ b/nav2_simple_commander/launch/nav_to_pose_example_launch.py @@ -20,7 +20,7 @@ from launch.actions import DeclareLaunchArgument, ExecuteProcess, IncludeLaunchDescription from launch.conditions import IfCondition from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch.substitutions import LaunchConfiguration +from launch.substitutions import LaunchConfiguration, PythonExpression from launch_ros.actions import Node @@ -44,7 +44,7 @@ def generate_launch_description(): declare_simulator_cmd = DeclareLaunchArgument( 'headless', - default_value='True', + default_value='False', description='Whether to execute gzclient)') # start the simulation @@ -53,7 +53,7 @@ def generate_launch_description(): cwd=[warehouse_dir], output='screen') start_gazebo_client_cmd = ExecuteProcess( - condition=IfCondition(headless), + condition=IfCondition(PythonExpression(['not ', headless])), cmd=['gzclient'], cwd=[warehouse_dir], output='screen') diff --git a/nav2_simple_commander/launch/picking_demo_launch.py b/nav2_simple_commander/launch/picking_demo_launch.py index c257bd3ac06..5fce5701069 100644 --- a/nav2_simple_commander/launch/picking_demo_launch.py +++ b/nav2_simple_commander/launch/picking_demo_launch.py @@ -20,7 +20,7 @@ from launch.actions import DeclareLaunchArgument, ExecuteProcess, IncludeLaunchDescription from launch.conditions import IfCondition from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch.substitutions import LaunchConfiguration +from launch.substitutions import LaunchConfiguration, PythonExpression from launch_ros.actions import Node @@ -44,7 +44,7 @@ def generate_launch_description(): declare_simulator_cmd = DeclareLaunchArgument( 'headless', - default_value='True', + default_value='False', description='Whether to execute gzclient)') # start the simulation @@ -53,7 +53,7 @@ def generate_launch_description(): cwd=[warehouse_dir], output='screen') start_gazebo_client_cmd = ExecuteProcess( - condition=IfCondition(headless), + condition=IfCondition(PythonExpression(['not ', headless])), cmd=['gzclient'], cwd=[warehouse_dir], output='screen') diff --git a/nav2_simple_commander/launch/recoveries_example_launch.py b/nav2_simple_commander/launch/recoveries_example_launch.py index 19b6788f485..d7b419711eb 100644 --- a/nav2_simple_commander/launch/recoveries_example_launch.py +++ b/nav2_simple_commander/launch/recoveries_example_launch.py @@ -20,7 +20,7 @@ from launch.actions import DeclareLaunchArgument, ExecuteProcess, IncludeLaunchDescription from launch.conditions import IfCondition from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch.substitutions import LaunchConfiguration +from launch.substitutions import LaunchConfiguration, PythonExpression from launch_ros.actions import Node @@ -44,7 +44,7 @@ def generate_launch_description(): declare_simulator_cmd = DeclareLaunchArgument( 'headless', - default_value='True', + default_value='False', description='Whether to execute gzclient)') # start the simulation @@ -53,7 +53,7 @@ def generate_launch_description(): cwd=[warehouse_dir], output='screen') start_gazebo_client_cmd = ExecuteProcess( - condition=IfCondition(headless), + condition=IfCondition(PythonExpression(['not ', headless])), cmd=['gzclient'], cwd=[warehouse_dir], output='screen') diff --git a/nav2_simple_commander/launch/security_demo_launch.py b/nav2_simple_commander/launch/security_demo_launch.py index f7f76afbf78..c04de67d451 100644 --- a/nav2_simple_commander/launch/security_demo_launch.py +++ b/nav2_simple_commander/launch/security_demo_launch.py @@ -20,7 +20,7 @@ from launch.actions import DeclareLaunchArgument, ExecuteProcess, IncludeLaunchDescription from launch.conditions import IfCondition from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch.substitutions import LaunchConfiguration +from launch.substitutions import LaunchConfiguration, PythonExpression from launch_ros.actions import Node @@ -44,7 +44,7 @@ def generate_launch_description(): declare_simulator_cmd = DeclareLaunchArgument( 'headless', - default_value='True', + default_value='False', description='Whether to execute gzclient)') # start the simulation @@ -53,7 +53,7 @@ def generate_launch_description(): cwd=[warehouse_dir], output='screen') start_gazebo_client_cmd = ExecuteProcess( - condition=IfCondition(headless), + condition=IfCondition(PythonExpression(['not ', headless])), cmd=['gzclient'], cwd=[warehouse_dir], output='screen') diff --git a/nav2_simple_commander/launch/waypoint_follower_example_launch.py b/nav2_simple_commander/launch/waypoint_follower_example_launch.py index 95a418af624..343017c0e47 100644 --- a/nav2_simple_commander/launch/waypoint_follower_example_launch.py +++ b/nav2_simple_commander/launch/waypoint_follower_example_launch.py @@ -20,7 +20,7 @@ from launch.actions import DeclareLaunchArgument, ExecuteProcess, IncludeLaunchDescription from launch.conditions import IfCondition from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch.substitutions import LaunchConfiguration +from launch.substitutions import LaunchConfiguration, PythonExpression from launch_ros.actions import Node @@ -44,7 +44,7 @@ def generate_launch_description(): declare_simulator_cmd = DeclareLaunchArgument( 'headless', - default_value='True', + default_value='False', description='Whether to execute gzclient)') # start the simulation @@ -53,7 +53,7 @@ def generate_launch_description(): cwd=[warehouse_dir], output='screen') start_gazebo_client_cmd = ExecuteProcess( - condition=IfCondition(headless), + condition=IfCondition(PythonExpression(['not ', headless])), cmd=['gzclient'], cwd=[warehouse_dir], output='screen')