Setup debugger in Eclipse and rospy
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?
@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 ?
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:
Not sure if this is related but I also cant import tf from Eclipse
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, 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.