0
$\begingroup$

Rosanswers logo

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?


Originally posted by adaruna3 on ROS Answers with karma: 16 on 2015-03-19

Post score: 0

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

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.


Originally posted by 130s with karma: 10937 on 2015-03-23

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by adaruna3 on 2015-03-25:
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.

Comment by swang on 2020-03-16:
Thx 130s, it works for me to add my current package path to PYTHONPATH and then restart the terminal! :)

$\endgroup$
0
$\begingroup$

Rosanswers logo

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


Originally posted by adaruna3 with karma: 16 on 2015-03-25

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.