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


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