launch.svg

create a separate package

start with the name of the robot or application, followed by the _bringup suffix.

 ros2 pkg create my_robot_bringup --build-type ament_cmake

remove directories that we don’t need

.
├── CMakeLists.txt
├── launch
└── package.xml

Update CMakelists

install(DIRECTORY
launch
DESTINATION share/${PROJECT_NAME}/
)

create launch file inside /launch folder

node.launch.xml

node.launch.py

update package.xml

include the package as dependency from where node needs to be called

<exec_depend>my_pkg</exec_depend>

update the launch file

<launch>
<node pkg="my_pkg" exec="string_publisher"/>
<node pkg="my_pkg" exec="string_subscriber"/>
</launch>