{"id":899,"date":"2014-12-14T21:24:43","date_gmt":"2014-12-14T13:24:43","guid":{"rendered":"http:\/\/www.ceh-photo.de\/blog\/?p=899"},"modified":"2014-12-14T23:02:32","modified_gmt":"2014-12-14T15:02:32","slug":"debugging-ros-nodes-started-from-launch-file","status":"publish","type":"post","link":"https:\/\/www.ceh-photo.de\/blog\/?p=899","title":{"rendered":"Debugging ROS nodes started from launch file with Eclipse"},"content":{"rendered":"<p><strong>Requirements<\/strong><\/p>\n<ul>\n<li>Imported ROS project into Eclipse workspace (see<a href=\"http:\/\/wiki.ros.org\/IDEs\" target=\"_blank\"> http:\/\/wiki.ros.org\/IDEs<\/a>\u00a0for details)<\/li>\n<li>Installed gdbserver (apt-get install gdbserver)<\/li>\n<\/ul>\n<p>Follow the\u00a0steps below.<\/p>\n<p><strong>1) Adjust the launch file:<\/strong><\/p>\n<p>Add this to the node tag if you want a new terminal window for the process<\/p>\n<div class=\"codecolorer-container text default\" style=\"overflow:auto;white-space:nowrap;width:70%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/><\/div><\/td><td><div class=\"text codecolorer\">launch-prefix=&quot;xterm -e gdbserver localhost:10000&quot;<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>or add the following if you want to stay in the current started terminal.<\/p>\n<div class=\"codecolorer-container text default\" style=\"overflow:auto;white-space:nowrap;width:70%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/><\/div><\/td><td><div class=\"text codecolorer\">launch-prefix=&quot;gdbserver localhost:10000&quot;<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p><strong>2) Eclipse Debug Configuration<\/strong><\/p>\n<p>Add a new Eclipse debug run configuration for <strong>C\/C++ Remote Application<\/strong>. Adjust the path to your C\/C++ application binary, leave everything else default<\/p>\n<p><a href=\"http:\/\/www.ceh-photo.de\/blog\/wp-content\/plugins\/downloads-manager\/upload\/\/Debug-Configurations-_023.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-900\" src=\"http:\/\/www.ceh-photo.de\/blog\/wp-content\/plugins\/downloads-manager\/upload\/\/Debug-Configurations-_023.png\" alt=\"Debug Configurations _023\" width=\"1216\" height=\"993\" srcset=\"https:\/\/www.ceh-photo.de\/blog\/wp-content\/plugins\/downloads-manager\/upload\/Debug-Configurations-_023.png 1216w, https:\/\/www.ceh-photo.de\/blog\/wp-content\/plugins\/downloads-manager\/upload\/Debug-Configurations-_023-300x244.png 300w, https:\/\/www.ceh-photo.de\/blog\/wp-content\/plugins\/downloads-manager\/upload\/Debug-Configurations-_023-1024x836.png 1024w, https:\/\/www.ceh-photo.de\/blog\/wp-content\/plugins\/downloads-manager\/upload\/Debug-Configurations-_023-750x612.png 750w, https:\/\/www.ceh-photo.de\/blog\/wp-content\/plugins\/downloads-manager\/upload\/Debug-Configurations-_023-900x734.png 900w\" sizes=\"auto, (max-width: 1216px) 100vw, 1216px\" \/><\/a><\/p>\n<p><strong>3) Execution<\/strong><\/p>\n<p>First execute ROS launch with your launch file. You can either do this from the terminal or by a external tools hook from eclipse (<a title=\"Starting launch file from eclipse\" href=\"http:\/\/answers.ros.org\/question\/10043\/how-do-i-start-a-launch-file-from-eclipse-ide\/\">http:\/\/answers.ros.org\/question\/10043\/how-do-i-start-a-launch-file-from-eclipse-ide\/<\/a>)<\/p>\n<p>Because I am using a multi-package ROS-Eclipse project and my launch files are always in the root of a package I am using\u00a0<strong>${container_name}<\/strong> \u00a0instead of\u00a0<strong>${project_name} <\/strong>for the external tools arguments in Eclipse.<\/p>\n<p>Now you will see that a small gdb terminal has opened if you are using the first version of launch file configuration from above.<\/p>\n<p><a href=\"http:\/\/www.ceh-photo.de\/blog\/wp-content\/plugins\/downloads-manager\/upload\/\/gdbserver_024.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-901\" src=\"http:\/\/www.ceh-photo.de\/blog\/wp-content\/plugins\/downloads-manager\/upload\/\/gdbserver_024.png\" alt=\"gdbserver_024\" width=\"485\" height=\"356\" srcset=\"https:\/\/www.ceh-photo.de\/blog\/wp-content\/plugins\/downloads-manager\/upload\/gdbserver_024.png 485w, https:\/\/www.ceh-photo.de\/blog\/wp-content\/plugins\/downloads-manager\/upload\/gdbserver_024-300x220.png 300w\" sizes=\"auto, (max-width: 485px) 100vw, 485px\" \/><\/a><\/p>\n<p>Now, just start your Eclipse debug configuration and you are ready to debug.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Further\u00a0<\/strong><b>References<\/b><\/p>\n<ul>\n<li>Setting up eclipse ide for ROS:<a href=\"%20http:\/\/wiki.ros.org\/IDEs\" target=\"_blank\">\u00a0http:\/\/wiki.ros.org\/IDEs<\/a><\/li>\n<li>Several ROS launch &#8220;launch-prefix&#8221; command\u00a0examples:<a href=\"%20http:\/\/wiki.ros.org\/roslaunch\/Tutorials\/Roslaunch%20Nodes%20in%20Valgrind%20or%20GDB\" target=\"_blank\">\u00a0http:\/\/wiki.ros.org\/roslaunch\/Tutorials\/Roslaunch%20Nodes%20in%20Valgrind%20or%20GDB<\/a><\/li>\n<li>Launching gdb with ROS\u00a0launch file:<a href=\"%20http:\/\/answers.ros.org\/question\/47210\/how-to-roslaunch-node-in-gdb\/\" target=\"_blank\">\u00a0http:\/\/answers.ros.org\/question\/47210\/how-to-roslaunch-node-in-gdb\/<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Requirements Imported ROS project into Eclipse workspace (see http:\/\/wiki.ros.org\/IDEs\u00a0for details) Installed gdbserver (apt-get install gdbserver) Follow the\u00a0steps below. 1) Adjust the launch file: Add this to the node tag if you want a new terminal window for the process 1launch-prefix=&quot;xterm -e gdbserver localhost:10000&quot; or add the following if you want to stay in the current [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46,113],"tags":[40,139,119],"class_list":["post-899","post","type-post","status-publish","format-standard","hentry","category-linux-it-2","category-robotics","tag-linux","tag-robotics","tag-ros"],"_links":{"self":[{"href":"https:\/\/www.ceh-photo.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/899","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ceh-photo.de\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ceh-photo.de\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ceh-photo.de\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ceh-photo.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=899"}],"version-history":[{"count":1,"href":"https:\/\/www.ceh-photo.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/899\/revisions"}],"predecessor-version":[{"id":902,"href":"https:\/\/www.ceh-photo.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/899\/revisions\/902"}],"wp:attachment":[{"href":"https:\/\/www.ceh-photo.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=899"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ceh-photo.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=899"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ceh-photo.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=899"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}