demo_warehouse.launch.py
Go to the documentation of this file.
1 # ROS2 launch file, invoking mvsim/launch/launch_world.launch.py
2 # See: https://mvsimulator.readthedocs.io/en/latest/mvsim_node.html
3 
4 from launch.actions import IncludeLaunchDescription
5 from launch.substitutions import TextSubstitution
6 from launch_ros.actions import Node
7 from launch.conditions import IfCondition
8 from launch.actions import DeclareLaunchArgument
9 from ament_index_python import get_package_share_directory
10 import os
11 from launch import LaunchDescription
12 from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription
13 from launch.substitutions import LaunchConfiguration
14 from launch.launch_description_sources import PythonLaunchDescriptionSource
15 from ament_index_python.packages import get_package_share_directory
16 
17 
19  # mvsim directory:
20  mvsimDir = get_package_share_directory("mvsim")
21 
22  # World to launch:
23  world_file = os.path.join(
24  mvsimDir, 'mvsim_tutorial', 'demo_warehouse.world.xml')
25  rviz_config_file = os.path.join(
26  get_package_share_directory('mvsim'), 'mvsim_tutorial', 'demo_warehouse_ros2.rviz')
27 
28  # Configurable arguments
29  headless = LaunchConfiguration('headless', default='True')
30  do_fake_localization = LaunchConfiguration(
31  'do_fake_localization', default='False')
32  publish_tf_odom2baselink = LaunchConfiguration(
33  'publish_tf_odom2baselink', default='False')
34  force_publish_vehicle_namespace = LaunchConfiguration(
35  'force_publish_vehicle_namespace', default='True')
36  use_rviz = LaunchConfiguration('use_rviz', default='False')
37 
38  # Create LaunchDescription
39  ld = LaunchDescription()
40 
41  # Add arguments to LaunchDescription
42  ld.add_action(DeclareLaunchArgument('headless', default_value='False',
43  description='Run in headless mode'))
44  ld.add_action(DeclareLaunchArgument('do_fake_localization', default_value='True',
45  description='Publish fake identity tf "map" -> "odom"'))
46  ld.add_action(DeclareLaunchArgument('publish_tf_odom2baselink', default_value='True',
47  description='Publish tf "odom" -> "base_link"'))
48  ld.add_action(DeclareLaunchArgument('force_publish_vehicle_namespace', default_value='False',
49  description='Use vehicle name namespace even if there is only one vehicle'))
50  ld.add_action(DeclareLaunchArgument('use_rviz', default_value='True',
51  description='Whether to launch RViz2'))
52 
53  # Include the original launch file
54  ld.add_action(IncludeLaunchDescription(
55  PythonLaunchDescriptionSource(
56  os.path.join(get_package_share_directory('mvsim'),
57  'launch', 'launch_world.launch.py')
58  ),
59  launch_arguments={
60  'world_file': world_file,
61  'headless': headless,
62  'do_fake_localization': do_fake_localization,
63  'publish_tf_odom2baselink': publish_tf_odom2baselink,
64  'force_publish_vehicle_namespace': force_publish_vehicle_namespace,
65  'use_rviz': use_rviz,
66  'rviz_config_file': rviz_config_file
67  }.items()
68  ))
69 
70  return ld
demo_warehouse.generate_launch_description
def generate_launch_description()
Definition: demo_warehouse.launch.py:18


mvsim
Author(s):
autogenerated on Wed May 28 2025 02:13:07