ros2 launch <my_package> <my.launch.py>
ros2 launch ~/src/my_package/launch/my.launch.py
my.launch.py :
from launch import LaunchDescription from launch_ros.actions import Node def generate_launch_description(): return LaunchDescription([ Node( package='turtlesim', namespace='turtlesim1', executable='turtlesim_node', name='sim' ), Node( package='turtlesim', namespace='turtlesim2', executable='turtlesim_node', name='sim' ), Node( package='turtlesim', executable='mimic', name='mimic', remappings=[ ('/input/pose', '/turtlesim1/turtle1/pose'), ('/output/cmd_vel', '/turtlesim2/turtle1/cmd_vel'), ] ) ]) |
setup.py :
import os from glob import glob from setuptools import setup package_name = 'my_package' setup( # Other parameters ... data_files=[ # ... Other data files # Include all launch files. This is the most important line here! (os.path.join('share', package_name), glob('launch/*.launch.py')) ] ) |
CMakeLists.txt :
# Install launch files. install(DIRECTORY launch DESTINATION share/${PROJECT_NAME}/ ) |
package.xml :
<exec_depend>ros2launch</exec_depend> |
[ Reference ]
[1] https://docs.ros.org/en/foxy/Tutorials/Launch/Launch-system.html
Launching/monitoring multiple nodes with Launch — ROS 2 Documentation: Foxy documentation
ROS 2 launch system The launch system in ROS 2 is responsible for helping the user describe the configuration of their system and then execute it as described. The configuration of the system includes what programs to run, where to run them, what arguments
docs.ros.org
'ROS > ROS2Foxy' 카테고리의 다른 글
ros2 launch pkg ~.launch.py (0) | 2022.06.06 |
---|---|
Broadcasting single frames using static_transform_publisher (0) | 2022.06.03 |
Create a new package for interfaces (0) | 2022.05.11 |
The command syntax for creating a new package in ROS 2 (0) | 2022.05.04 |
ROS2 Foxy 입문 (0) | 2022.05.01 |