Skip to content

Instantly share code, notes, and snippets.

@artivis
Last active October 23, 2018 10:27
Show Gist options
  • Save artivis/ac638ee4490ce61d1d7053794afd368f to your computer and use it in GitHub Desktop.
Save artivis/ac638ee4490ce61d1d7053794afd368f to your computer and use it in GitHub Desktop.
[ROS] optional debugging in launch file
<launch>
<!-- This only works starting from ROS Kinetic -->
<!-- Allows for passing custom launch-prefix -->
<arg name="launch_prefix" default=""/>
<!-- Launch node through a debugger (valgrind/gdb/rr) -->
<arg name="debugger" default=""/>
<arg name="launch_prefix_switch" value="gdb -ex run --args" if="$(eval debugger=='gdb')" />
<arg name="launch_prefix_switch" value="valgrind" if="$(eval debugger=='valgrind')"/>
<arg name="launch_prefix_switch" value="rr record -h" if="$(eval debugger=='rr')" />
<arg name="launch_prefix_switch" value="uftrace record" if="$(eval debugger=='uftrace')" />
<arg name="launch_prefix_switch" value="$(arg launch_prefix)"
unless="$(eval debugger in ['gdb','valgrind','rr','uftrace'])"/>
<node pkg ="package_example"
type="node_example"
name="example"
output="screen"
launch-prefix="$(arg launch_prefix_switch)">
</node>
</launch>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment