O'Reilly logo

Robot Operating System Cookbook by Kumar Bipin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it…

  1. Attach the gdb debugger with the launch file as follows:
 <launch> 
  <node pkg=""chapter4_tutorials"" type=""program1"" name=""program1"" output=""screen"" 
  launch-prefix=""xterm -e gdb --args""/> 
</launch> 
  1. Start the ROS node within gdb debugger using the launch command:
$ roslaunch chapter4_tutorials program1_gdb.launch
  1. Create a new xterm terminal with the node attached to gdb, as shown in the following screenshot.

Moreover, we can set breakpoints if needed and then press the c or r key to run the node and debug it. The source code can be listed by using the l command:

ROS node with gdb debugger
  1.  Try debugging python in ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required