実際のところ
$ cd ~/dev_ws/src $ mkdir -p rpi_cpu_temp/launch $ touch rpi_cpu_temp/launch/cpu_temp_launch.py
ROS1ではXMLだった気がしますが……ROS2からlaunchファイルはpython風の記法が使えるようになったそうで
cpu_temp_launch.py
from launch import LaunchDescription from launch_ros.actions import Node def generate_launch_description(): return LaunchDescription([ Node( package='rpi_cpu_temp', executable='cpu_temp_publisher', name='cpu_temp_publisher_node', output='screen', parameters=[{'timer_period': 1.0}], remappings=[('/old/topic', '/new/topic')] ), ])
実行
$ ros2 launch rpi_cpu_temp cpu_temp_launch.py