using-conditionals-in-roslaunch.md

Author: Lisandro Mayancela

This tutorial assumes the reader knows how to use/access args and parameters in a launch file.

When making launch files you may sometimes want aspects of your launch (Such as the urdf file that is used) to be dependent on certain conditions

All of these robots use the same launch file but the urdf file that is loaded is different based on robot team and type

In order to have this functionality you can use the group tag with an if parameter like so:

Examples

For a better example let's look at a launch file which spawns a robot into a gazebo world:

In lines 7-27 we see a chain of these if statements which then end up deciding one out of four urdf files to load as the robot_description which then gets passed into the spawn_minibot_model node.

Last updated

Was this helpful?