Skip to content
  • Home
  • About the Blog
  • About the Author
  • Sitemap

Abdur Rosyid's Blog

Just a few notes on mechanical engineering and robotics

ROS1 Launch File

July 8, 2021 by Abdur Rosyid

ROS launch is a very useful command as it is capable to:

  • run multiple nodes at the same time.
  • set parameters.
  • perform rosparam commands.
  • set execution options.

ROS launch file (.launch) is an XML file which looks like below. As it is an XML, indentation matters.

An example launch file that sets a parameter:


  

In a launch file with parameters and nodes, parameters are loaded (sent to the parameter server) before any node is run.

An example launch file that sets a parameter by using arg:


  
  

An example launch file that loads the parameters in a yaml file:


  

An example launch file that run multiple nodes:


  
  

The argument “type” denotes the NODE_NAME, whereas the argument “name” denotes a custom name for the node (usually set as the same to the NODE_NAME, although it can be different). Notice that nodes are run at the same time, not based on the order they are written in the launch file.

Launch file that run nodes with the same names but within multiple namespace groups:


  
    
    
  
  
    
    
  

The official documentation of roslaunch can be found here: http://wiki.ros.org/roslaunch/XML

Some tips to write roslaunch for large projects can be found here: http://wiki.ros.org/roslaunch/Tutorials/Roslaunch%20tips%20for%20larger%20projects

Running a launch file

A launch is run by using the following CLI command:

roslaunch [PACKAGE_NAME] LAUNCH_FILE_NAME.launch

To display all the outputs of the running nodes in the terminal, add –screen argument in the roslaunch command:

roslaunch [PACKAGE_NAME] LAUNCH_FILE_NAME.launch --screen

The “roscore” command is not needed to be given before running “roslaunch”, because running “roslaunch” will automatically starts the ROS Master.

Post navigation

Previous Post:

ROS Bag

Next Post:

ROS2 (Foxy) Installation

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Categories

  • STEM 101
  • Robotics
  • Kinematics
  • Dynamics
  • Control
  • Robot Operating System (ROS)
  • Robot Operating System (ROS2)
  • Software Development
  • Mechanics of Materials
  • Finite Element Analysis
  • Fluid Mechanics
  • Thermodynamics

Recent Posts

  • Pull Request on Github
  • Basics of Git and Github
  • Conda vs Docker
  • A Conda Cheat Sheet
  • Installing NVIDIA GPU Driver on Ubuntu

Archives

  • June 2025
  • July 2021
  • June 2021
  • March 2021
  • September 2020
  • April 2020
  • January 2015
  • April 2014
  • March 2014
  • March 2012
  • February 2012
  • June 2011
  • March 2008
© 2026 Abdur Rosyid's Blog | WordPress Theme by Superbthemes