Rosetta_launch - Everything I Know About ROS 1 and ROS 2 launch files

tl; dr: is a tutorial exploring the features of ROS 1 and ROS 2 launch files.

Over the years, I’ve learned how to make ROS launch files do a number of…let’s say, unorthodox… things. As I’ve progressed my ROS 2 skill set, I’ve had to figure out how to recreate those behaviors, but that’s required translating them from XML to Python. (That’s one of the reasons why porting MoveIt Setup Assistant took so long)

The repository above contains ten common launch tasks, and how to code them in both ROS 1 XML and ROS 2 Python.

  1. Launching a single node
  2. Setting a parameter directly
  3. Loading parameters from a launch file
  4. Loading parameters from a command
  5. Setting arguments via command line
  6. Using substitutions
  7. Including another launch file
  8. Conditionals
  9. Dynamic filenames
  10. Making a node required

It’s for my own reference, but I figured it may also be useful to others as a way to translate launch files.

Note: It’s hosted on GitHub for two reasons. 1) It would be awkward to split it between the ROS 1 and ROS 2 wiki. 2) In my experience, the stewards of the ROS 2 wiki follow a let the past die philosophy to putting ROS 1 content on the new wiki.


gratuitous plug:


The first link in TL;DR; directs me to 404 Error.

1 Like

I also see a dead link, and there doesn’t seem to be a repo by a similar name under that user. Perhaps it’s a repository that was private for development and hasn’t yet been made public?

Should work now.


I’m missing my favorite XML for loops via recursion :slight_smile:

1 Like

Thanks for creating this documentation! It was also my experience that there is little information on how to create launch files…

Just thought I’d mention it, but you are missing an important way to get the package share directory, the substitutions.FindPackageShare defined in launch_ros . The main advantage of this method is that:

  • The package name can be dynamic (e.g. a command line argument)
  • Since it’s a substitution, you can easily concatenate with other substitutions / text without resorting to os.path.join. For example urdf_path = (FindPackageShare("my-package"), "urdf", LaunchConfiguration("robot_name"), ".urdf").

Don’t threaten me with a good time.

Yaaay! This actually becomes useful in multirobot setups :wink:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.