demo_turtlebot_world.launch.py
Go to the documentation of this file.
1 # ROS2 launch file
2 
3 from launch import LaunchDescription
4 from launch.substitutions import TextSubstitution
5 from launch.substitutions import LaunchConfiguration
6 from launch_ros.actions import Node
7 from launch.actions import DeclareLaunchArgument
8 from ament_index_python import get_package_share_directory
9 import os
10 
11 mvsimDir = get_package_share_directory("mvsim")
12 
13 MVSIM_WORLD_FILE = os.path.join(mvsimDir, 'mvsim_tutorial',
14  'demo_turtlebot_world.world.xml')
15 MVSIM_ROS2_PARAMS_FILE = os.path.join(mvsimDir, 'mvsim_tutorial',
16  'mvsim_ros2_params.yaml')
17 RVIZ2_FILE = os.path.join(mvsimDir, 'mvsim_tutorial',
18  'demo_turtlebot_world_ros2.rviz')
19 
20 
22  # args that can be set from the command line or a default will be used
23  world_file_launch_arg = DeclareLaunchArgument(
24  "world_file", default_value=TextSubstitution(
25  text=MVSIM_WORLD_FILE))
26 
27  mvsim_node = Node(
28  package='mvsim',
29  executable='mvsim_node',
30  name='mvsim',
31  output='screen',
32  parameters=[
33  MVSIM_ROS2_PARAMS_FILE,
34  {
35  "world_file": LaunchConfiguration('world_file'),
36  "headless": False
37  }]
38  )
39 
40  rviz2_node = Node(
41  package='rviz2',
42  executable='rviz2',
43  name='rviz2',
44  arguments=[
45  '-d', [RVIZ2_FILE]]
46  )
47 
48  return LaunchDescription([
49  world_file_launch_arg,
50  mvsim_node,
51  rviz2_node
52  ])


mvsim
Author(s):
autogenerated on Tue Jul 4 2023 03:08:19