[Documentation] [TitleIndex] [WordIndex

(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Rocon Launch for Single Masters

Description: Spawn multiple roslaunch terminals working with a single master.

Keywords: rocon roslaunch rocon_launch

Tutorial Level: BEGINNER

Overview

Quite often in develop you need to start multiple roslaunch instances, each from different shells. This can get tedious opening the multiple shells and typing out the roslaunch commands. That is where this convenience tool comes in handy.

Preparation

Make sure you have installed the roscpp tutorials for this demo.

> sudo apt-get install ros-indigo-roscpp-tutorials

You will also need either gnome-terminal or konsole installed on your system. Other terminals can be supported, but there has been no need yet.

Demo

The Launcher

The format of a rocon launcher file is very similar to a roslaunch file. Save the following file as chatter.concert.

   1 <concert>
   2   <arg name="topic_name" default="chatter"/>
   3 
   4   <launch title="talker" package="rocon_launch" name="talker.xml" port="11311">
   5     <arg name="topic_name" value="$(arg topic_name)"/>
   6   </launch>
   7   <launch title="listener" package="rocon_launch" name="listener.xml" port="11311">
   8     <arg name="topic_name" value="$(arg topic_name)"/>
   9   </launch>
  10 </concert>

The format should be mostly self-describing. The title attribute will set the title of the spawned terminal (very useful when alt-tabbing). Also, to make sure you running a single master, make sure the port specification for each roslaunch tag is identical.

Launching

Launching is very similar to roslaunch. Once executed, it will spawn multiple terminals, one for each launch tag in the rocon launcher.

# A regular launch
> rocon_launch chatter.concert
# Full standard output, just like roslaunch
> rocon_launch chatter.concert --screen
# Inside a pkg
> rocon_launch my_pkg chatter.concert --screen
# Remapping args
> rocon_launch chatter.concert --screen topic_name:=babbler
# Holding terminals open after killing roslaunch instances
> rocon_launch chatter.concert --screen --hold
# Forcing use of konsole
> rocon_launch chatter.concert --konsole --screen
# Forcing use of gnome-terminal
> rocon_launch chatter.concert --gnome --screen

Killing the original rocon_launch process (e.g. CTRL-C in the original terminal) will gracefully kill and wait for all roslaunch processes to die.

Screenshot

rocon_launch.png


Features

Terminals

The script launches a terminal for each launch in the rocon launch file. The type of terminal is autodetected, but can be forced to gnome-terminal or konsole with the --gnome or --konsole options.

Tab Completion

Multiple launchers may use the same port. If the file suffix is .concert, then tab completion will also work just like roslaunch.

Command Line Options

  -h, --help      show this help message and exit
  -k, --konsole   spawn individual ros systems via multiple konsole terminals
  -g, --gnome     spawn individual ros systems via multiple gnome terminals
  --screen        run each roslaunch with the --screen option
  --no-terminals  do not spawn terminals for each roslaunch
  --hold          hold terminals open after upon completion (incompatible with
                  --no-terminals)

The --no-terminals option is useful for tests and headless boards where you don't want to commit to one super roslaunch file.


2019-08-10 13:02