Ask Your Question
1

Setup debugger in Eclipse and rospy

asked 2016-03-25 09:17:05 -0600

Marq gravatar image

updated 2016-03-30 09:57:01 -0600

Hello,

I am working on setting up Eclipse to debug my ros python nodes. I have followed the tutorials on setting up your IDE and everything has been working as expected. I have successfully debugged code that publishes a topic but when I try and add a service Eclipse doesn't know how to resolve my "import awesomeService.srv" and I get the following error.

ImportError: No module named awesomService.srv

I have the following environment variables added to Eclipse to launch my code...

  • ROS_MASTER_URI
  • ROS_PACKAGE_PATH
  • ROS_ROOT

Does anyone know what variable I need to add so that it will resolve my service definition?

Thanks for your help!!!

-Marq


update: I have tried several options and the only one I have been able to get working is adding to my sys path with the absolute location to the Python classes generated by catkin_make. To debug my code I need:

import os
import sys
sys.path.insert(0, '/home/MyCatkinWS/devel/lib/python2.7/dist-packages/MyPackage/srv')
from _CheckOutputState import *

When not debugging my code and running it in a terminal I only need

from myPackage.srv import CheckOutputState, CheckOutputStateResponse

How does ROS get/resolve the location of the python classes generated by catkin_make when run in the terminal?

edit retag flag offensive close merge delete

Comments

@Marq, is this problem specific to the Eclipse Python debugger ? I assume you're using Pydev ? Does the problem also occur if you launch your nodes not in debugging mode ?

al-dev gravatar imageal-dev ( 2016-04-01 12:23:03 -0600 )edit

Yes the problem is specific to Eclipse (debugger and regular run mode). Yes I am using Pydev and have the following as part of my PYTHONPATH that is used in the run:

/home/MyCatkinWS/devel/lib/python2.7/dist-packages

Not sure if this is related but I also cant import tf from Eclipse

Marq gravatar imageMarq ( 2016-04-04 08:58:23 -0600 )edit

Can you import any ROS package when running via PyDev ? Can you run the following program : #!/usr/bin/env python import rospy ? When you say that this is the PYTHONPATH used in the run, did you check by printing the environment variable in the script ?

al-dev gravatar imageal-dev ( 2016-04-09 22:31:23 -0600 )edit

al-dev, Thanks so much for your help!!

I can use (and debug) some ROS packages like rospy and std_mgsg.msg. So far I am only having problems with my services and tf.

I checked my PYTHONPATH in eclipse. Right click on project->properties->PyDev-PYTHONPATH under the External Libraries tab.

Marq gravatar imageMarq ( 2016-04-15 08:59:26 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-03-27 13:01:07 -0600

al-dev gravatar image

If your service has been properly registered, you should be able to find it with rossrv list. As for the import command, have you tried from packagewheretheserviceisdefined.srv import awesomService.srv ?

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-03-25 09:05:59 -0600

Seen: 403 times

Last updated: Mar 30 '16