Getting Started with ROS on Embedded Systems - User Guide - C++ - Launch files

From RidgeRun Developer Wiki





Previous: User Guide/C++/Publishers_and_subscribers Index Next: User Guide/C++/Parameters




Introduction

This wiki is based on the following page:

  1. https://docs.ros.org/en/humble/Tutorials/Intermediate/Launch/Creating-Launch-Files.html

ROS launch files are files that can be used to deploy a set of nodes and topics, this allows for a docker-compose like launch. That enables developers to launch and configure multiple nodes at the same time. These files can come in different formats:

  1. Python
  2. XML
  3. YAML

Examples

Simple launch file with parameter loading


<launch>
  <node pkg="turtlesim" exec="turtlesim_node" name="sim" namespace="turtlesim1"/>
  <node pkg="turtlesim" exec="turtlesim_node" name="sim" namespace="turtlesim2"/>
  <node pkg="turtlesim" exec="mimic" name="mimic">
    <remap from="/input/pose" to="/turtlesim1/turtle1/pose"/>
    <remap from="/output/cmd_vel" to="/turtlesim2/turtle1/cmd_vel"/>
  </node>
</launch>

This file is made from a number of node values, these nodes reference a package and an specific node from it. Also with it you can also control the namespace value, to allow multiple nodes with the same base topic name and discussed before on the topics section. You also can control and modify the subscription topics with the remap key.


Previous: User Guide/C++/Publishers_and_subscribers Index Next: User Guide/C++/Parameters