Enabling core dumps for ROS nodes

Although ROS nodes are actually regular executables, there is a tricky point to enabling core dumps, which can later be used in a gdb session. First of all, we have to set an unlimited core size; the current value can be checked with ulimit -c. Note that this is also required for any executable and not just ROS nodes:

    $ ulimit -c unlimited  

Then, to allow core dumps to be created, we must set the core filename to use the pid process by default. Otherwise, they will not be created because at $ROS_HOME, there is already a core directory to prevent core dumps. Therefore, in order to create core dumps with the name and path $ROS_HOME/core.PID, we must run the following command:

 $ echo 1 | sudo tee /proc/sys/kernel/core_uses_pid ...

Get ROS Programming: Building Powerful Robots now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.