bluerov_ros_playground icon indicating copy to clipboard operation
bluerov_ros_playground copied to clipboard

ImportError: No module named bluerov.video

Open olayasturias opened this issue 7 years ago • 5 comments

When doing roslaunch bluerov_ros_playground video.launch, The following error appears:

Traceback (most recent call last): File "/catkin_ws/src/bluerov_ros_playground/src/bluerov/bin/video", line 3, in import bluerov.video as Video ImportError: No module named bluerov.video

However, I checked that the imported modules are in its place, and they are. I'm not sure if it is a problem of mine or maybe the import is done wrong.

olayasturias avatar Feb 09 '18 15:02 olayasturias

Ty for your reply @olayasturias, I'll try to reproduce it. EDIT: The software was developed for lunar, but the first version was compatible with catkin, I'll test again to make sure that everything is working fine with our latest update.

patrickelectric avatar Feb 09 '18 17:02 patrickelectric

@olayasturias it's working with my catkin and lunar install. Catkin:

patrick@patrick-ub:~/ws$ find . | grep bluerov/video
./src/bluerov_ros_playground/src/bluerov/video.py
./src/bluerov_ros_playground/src/bluerov/video.pyc

Lunar:

 patrick@dell ~/ros_ws/lunar$ find . | grep bluerov/video
./build_isolated/bluerov_ros_playground/lib/bluerov/video.py
./src/bluerov_ros_playground/src/bluerov/video.py
./install_isolated/lib/python3.6/site-packages/bluerov/video.py

have you runned catkin_make --pkg bluerov_ros_playground in catkin ? or catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --pkg bluerov_ros_playground in lunar ? And after that, the source command ?

patrickelectric avatar Feb 09 '18 18:02 patrickelectric

Hi Patrick, I'm using ROS Kinetic and python 2.7, so that may be part of the cause. I sourced the workspace, and it finds all the files correctly, so that's not the problem: the gazebo nodes, for example, run without any problem. The command ./src/bluerov_ros_playground/src/bluerov/video.py worked fine! However, it doesn't seem to be an "elegant" solution. On the other hand, I would like to publish the video in a ROS topic. Is your video node meant to do so?

olayasturias avatar Feb 12 '18 10:02 olayasturias

Ok, I solved it!!

I modified the line in video import bluerov.video as Video by

sys.path.insert(0, '/home/username/catkin_ws/src/bluerov_ros_playground/src/bluerov')
import video as Video

It's not an elegant solution, but it works and allows me to execute the file using roslaunch, which is far more intuitive than the previous solution.

When running it, the opencv window is opened. I think I will do some modifications to publish the image via ROS topics.

olayasturias avatar Feb 12 '18 11:02 olayasturias

Good to know ! It's a bit weird, I'll try a fresh install just to make sure that everything is working properly with kinetic.

If you want to send the video (and others BlueRov2 topics), you can use the bluerov_node, check the readme here.

patrickelectric avatar Feb 13 '18 00:02 patrickelectric