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
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
20 mvsimDir = get_package_share_directory(
"mvsim")
23 world_file = os.path.join(
24 mvsimDir,
'mvsim_tutorial',
'demo_turtlebot_world.world.xml')
25 rviz_config_file = os.path.join(
26 get_package_share_directory(
'mvsim'),
'mvsim_tutorial',
'demo_turtlebot_world_ros2.rviz')
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')
39 ld = 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'))
54 ld.add_action(IncludeLaunchDescription(
55 PythonLaunchDescriptionSource(
56 os.path.join(get_package_share_directory(
'mvsim'),
57 'launch',
'launch_world.launch.py')
60 'world_file': world_file,
62 'do_fake_localization': do_fake_localization,
63 'publish_tf_odom2baselink': publish_tf_odom2baselink,
64 'force_publish_vehicle_namespace': force_publish_vehicle_namespace,
66 'rviz_config_file': rviz_config_file