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

Scripts in /scripts cannot see files in /src/<package name>

asked 2017-07-30 09:11:41 -0600

jchernus gravatar image

I am receiving the following error when trying to run a script in my /catkin_ws/src/<package name="">/scripts directory.

robond@udacity:~/catkin_ws$ rosrun sensor_stick capture_features_new.py 
Traceback (most recent call last):
  File "/home/robond/catkin_ws/src/sensor_stick/scripts/capture_features_new.py", line 7, in <module>
    from sensor_stick.pcl_helper import *
ImportError: No module named pcl_helper

All of the files that I am importing from are present in catkin_ws/src/<package name="">/src/<package name="">. Yet, somehow they are invisible to my script...

I have run catkin_make, and sourced devel/setup.bash. A complete noob to ROS, I warn you.

Does anyone have any idea what I'm doing wrong? Thanks in advance!

edit retag flag offensive close merge delete

Comments

So after many hours of trying to fix the problem I gave up, copied the package &renamed it. Fiddled around, but it always failed to make, so I deleted it. Tried to make the original again, success, and now the script runs! But why...? Did it just need a clean?

jchernus gravatar image jchernus  ( 2017-07-30 10:08:49 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-08-02 08:13:54 -0600

naveedhd gravatar image

updated 2017-08-02 08:14:13 -0600

The reason it cannot find your module is that it is not in your $PYTHONPATH. The standard way of solving this would be to write a setup.py in your package and invoke catkin_python_setup() in CMakeLists.txt as described in the last portion of this article: http://wiki.ros.org/rospy_tutorials/Tutorials/Makefile

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-07-30 09:11:41 -0600

Seen: 632 times

Last updated: Aug 02 '17