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

ROS rqt plugin: ImportError (unrelated to previous post)

asked 2015-03-19 11:38:18 -0500

adaruna3 gravatar image

updated 2015-03-24 16:05:52 -0500

Hello all. I am new to creating Plugins in ROS rqt_gui. I recently had the Plugin user interface working (it would pop up the widgets described in a separate .ui file I created); however, this was only the front end user interface popping up with no functionality. Once I tried adding back end functionality (allowing sliders to actually change data for other nodes through topics) it has stopped working. The user interface no longer comes up at all. This happened immediately after adding back end functionality and running a catkin_make. My current error is:

RosPluginProvider.load(drone_GUI/My Plugin) exception raised in __builtin__.__import__(drone_GUI.my_module, [MyPlugin]):
Traceback (most recent call last):
  File "/opt/ros/hydro/lib/python2.7/dist-packages/rqt_gui/ros_plugin_provider.py", line 77, in load
    module = __builtin__.__import__(attributes['module_name'], fromlist=[attributes['class_from_class_type']], level=0)
ImportError: No module named my_module

PluginManager._load_plugin() could not load plugin "drone_GUI/My Plugin":
Traceback (most recent call last):
  File "/opt/ros/hydro/lib/python2.7/dist-packages/qt_gui/plugin_handler.py", line 98, in load
    self._load()
  File "/opt/ros/hydro/lib/python2.7/dist-packages/qt_gui/plugin_handler_direct.py", line 54, in _load
    self._plugin = self._plugin_provider.load(self._instance_id.plugin_id, self._context)
  File "/opt/ros/hydro/lib/python2.7/dist-packages/qt_gui/composite_plugin_provider.py", line 71, in load
    instance = plugin_provider.load(plugin_id, plugin_context)
  File "/opt/ros/hydro/lib/python2.7/dist-packages/qt_gui/composite_plugin_provider.py", line 71, in load
    instance = plugin_provider.load(plugin_id, plugin_context)
  File "/opt/ros/hydro/lib/python2.7/dist-packages/rqt_gui_py/ros_py_plugin_provider.py", line 60, in load
    return super(RosPyPluginProvider, self).load(plugin_id, plugin_context)
  File "/opt/ros/hydro/lib/python2.7/dist-packages/qt_gui/composite_plugin_provider.py", line 71, in load
    instance = plugin_provider.load(plugin_id, plugin_context)
  File "/opt/ros/hydro/lib/python2.7/dist-packages/rqt_gui/ros_plugin_provider.py", line 83, in load
    raise e
ImportError: No module named my_module

However, the module name has not changed since the catkin_make and it has been in the same location. The package paths are as follows:

/drone_GUI
    /msg
        colorRange.msg
/resource
    widget.ui
/src
    /drone_GUI
       __init__.py
       __init__.pyc
       my_module.py
       my_module.pyc
CMakeLists.txt
package.xml
plugin.xml

Thank you in advance for the help. I didn't include any of the files for brevity, but let me know what else you need and I'll post it quickly.

This is the new information that 130s requested:

angel@g6:~/catkin_ws/src/drone_GUI/src/drone_GUI$ export | grep ROS
declare -x ROSLISP_PACKAGE_DIRECTORIES="/home/angel/catkin_ws/devel/share/common-lisp"
declare -x ROS_DISTRO="hydro"
declare -x ROS_ETC_DIR="/opt/ros/hydro/etc/ros"
declare -x ROS_MASTER_URI="http://localhost:11311"
declare -x ROS_PACKAGE_PATH="/home/angel/catkin_ws/src:/opt/ros/hydro/share:/opt/ros/hydro/stacks"
declare -x ROS_ROOT="/opt/ros/hydro/share/ros"
declare -x ROS_TEST_RESULTS_DIR="/home/angel/catkin_ws/build/test_results"
angel@g6:~/catkin_ws/src/drone_GUI/src/drone_GUI$ echo $PYTHONPATH
/home/angel/catkin_ws/devel/lib/python2.7/dist-packages:/opt/ros/hydro/lib/python2.7/dist-packages

I am not sure if the environment variables are correct, but looking through the other posts, they seem to be?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2015-03-25 12:54:09 -0500

adaruna3 gravatar image

Just to let everyone know, the problem was what I said. After adding the python setup.py file, the gui came up and worked after building with catkin_make. My source was: Create the setup for the rqt plugin

edit flag offensive delete link more
1

answered 2015-03-23 10:40:02 -0500

130s gravatar image

It would always help if you include the following in your original post:

env | grep ROS
env | grep PYTHON

And Google returns a number of results on ros.org about " ImportError: No module named" errors, many of which were that PYTHONPATH didn't include the path your module is located at. Make sure you source the right setup.bash file. Also cleaning your workspace (by removing build and devel, and rebuild by catkin) might help.

edit flag offensive delete link more

Comments

Hello 130s, I edited the post and added the information you requested. I recently saw that for creating a python rqt_gui plugin you need to have a setup.py file on Tutorial. I am currently working on adding this file.

adaruna3 gravatar image adaruna3  ( 2015-03-25 09:26:33 -0500 )edit

Thx 130s, it works for me to add my current package path to PYTHONPATH and then restart the terminal! :)

swang gravatar image swang  ( 2020-03-16 12:15:12 -0500 )edit

Question Tools

Stats

Asked: 2015-03-19 11:38:18 -0500

Seen: 945 times

Last updated: Mar 25 '15