Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add headless and use_rviz LaunchConfigurations to demo launch files #3527

Merged
merged 2 commits into from
Apr 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion nav2_simple_commander/launch/assisted_teleop_example_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, PythonExpression
from launch_ros.actions import Node


Expand All @@ -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='False',
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(PythonExpression(['not ', headless])),
cmd=['gzclient'],
cwd=[warehouse_dir], output='screen')

Expand All @@ -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())

Expand All @@ -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)
Expand Down
23 changes: 22 additions & 1 deletion nav2_simple_commander/launch/follow_path_example_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, PythonExpression
from launch_ros.actions import Node


Expand All @@ -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='False',
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(PythonExpression(['not ', headless])),
cmd=['gzclient'],
cwd=[warehouse_dir], output='screen')

Expand All @@ -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())

Expand All @@ -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)
Expand Down
23 changes: 22 additions & 1 deletion nav2_simple_commander/launch/inspection_demo_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, PythonExpression
from launch_ros.actions import Node


Expand All @@ -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='False',
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(PythonExpression(['not ', headless])),
cmd=['gzclient'],
cwd=[warehouse_dir], output='screen')

Expand All @@ -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())

Expand All @@ -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)
Expand Down
23 changes: 22 additions & 1 deletion nav2_simple_commander/launch/nav_through_poses_example_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, PythonExpression
from launch_ros.actions import Node


Expand All @@ -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='False',
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(PythonExpression(['not ', headless])),
cmd=['gzclient'],
cwd=[warehouse_dir], output='screen')

Expand All @@ -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())

Expand All @@ -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)
Expand Down
23 changes: 22 additions & 1 deletion nav2_simple_commander/launch/nav_to_pose_example_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, PythonExpression
from launch_ros.actions import Node


Expand All @@ -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='False',
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(PythonExpression(['not ', headless])),
cmd=['gzclient'],
cwd=[warehouse_dir], output='screen')

Expand All @@ -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())

Expand All @@ -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)
Expand Down
23 changes: 22 additions & 1 deletion nav2_simple_commander/launch/picking_demo_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, PythonExpression
from launch_ros.actions import Node


Expand All @@ -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='False',
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(PythonExpression(['not ', headless])),
cmd=['gzclient'],
cwd=[warehouse_dir], output='screen')

Expand All @@ -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())

Expand All @@ -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)
Expand Down
Loading