ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

debug ros node python

asked 2013-02-07 00:55:46 -0500

Sentinal_Bias gravatar image

updated 2014-01-28 17:15:09 -0500

ngrennan gravatar image

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

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2013-02-07 05:10:57 -0500

130s gravatar image

updated 2013-02-07 18:01:27 -0500

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/
edit flag offensive delete link more

Comments

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.

Sentinal_Bias gravatar image Sentinal_Bias  ( 2014-01-13 23:24:57 -0500 )edit

Question Tools

Stats

Asked: 2013-02-07 00:55:46 -0500

Seen: 3,425 times

Last updated: Feb 07 '13