0
$\begingroup$

Rosanswers logo

Hi I am new to ROS

how do you debug your ros node, say you code it in python.

Is it possible to use run a ros node in an ide and set break points ect? I saw a link on setting up ide's but they seemed like it was for C++ IDE's


Originally posted by Sentinal_Bias on ROS Answers with karma: 418 on 2013-02-07

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

From commandline, you can run your script on debugger by:

$ roscd %YOUR_PKG_HOME%
$ gdb python
$ run %YOUR_SCRIPT_PATH%

If you'd prefer to sticking to eclipse, one dumb workaround to utilize make solution on wiki is:

1 Install pydev on eclipse, create your python project on eclipse by "File" --> "New" --> "Pydev Project". When successful, close eclipse.

2 Copy the .project file that was just generated by eclipse. Eg. by doing:

$ roscd %YOUR_PKG_HOME%
$ cp .project .project.org

3 Run make eclipse-project following http://www.ros.org/wiki/IDEs#Eclipse. If you don't have Makefile in the current dir, create one as the same wiki page suggests when error occurs.

4 Swap .project and remove .cproject:

$ mv .project.org .project 
$ rm .cproject

This sets up ROS python environment on eclipse. You should be able to run your ROS script in debug mode.

Apparently this is not smart and ideal, but works for me.

This works even on Groovy where make eclipse-project generates many unnecessary files & directories. In this case you might want to remove them & Makefile you no longer need by like:

$ rm -fR catkin* CATKIN_IGNORE cmake_install.cmake devel/ gtest/ Makefile test_results/

Originally posted by 130s with karma: 10937 on 2013-02-07

This answer was ACCEPTED on the original site

Post score: 3


Original comments

Comment by Sentinal_Bias on 2014-01-14:
Hi Thanks for the reply I also got this to work for python debugging http://winpdb.org/docs/ Its a graphical debugger for python. All I have to do is go the source directory and run it from the terminal from there.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.