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

rqt Plugin Tutorial Not Working

asked 2022-01-27 10:05:37 -0500

Green01 gravatar image

updated 2022-02-01 06:41:38 -0500

Hello - I am new to ROS. I followed this tutorial to create a rqt_mypkg python plugin. I am using Ubuntu 20.04 and ROS Noetic. After completing the tutorial, when I run the plugin with 'rqt --standalone rqt_mypkg' I get the following errors:

QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-public'

qt_gui_main() found no plugin matching "rqt_mypkg" try passing the option "--force-discover"

As I followed the steps in the tutorial, I coped the contents of each file from the tutorial and pasted into files on my system.

Things I've tried:

  • deleted ~/.config/ros.org/rqt_gui.ini
  • tried the --force-discover option on the 'rqt --standalone rqt_mypkg' command
  • made sure to run source <workspace>/catkin/devel/setup.bash (actually it is in my .bashrc plus I manually ran the command)
  • 'rqt --list-plugins does not list my rqt_mypkg plugin
  • when I run 'rqt', the GUI pops up but I don't see rqt_mypkg anywhere in the menus
  • the command 'rosrun rqt_mypkg rqt_mypkg' gives an error: "[rospack] Error: package 'rqt_mypkg' not found"

UPDATE #1: Do the errors have to do with my directory structure?

There is an existing ROS package in /home/user/ros. I can run catkin_make in /home/user/ros to compile and build that package. When I started the plugin tutorial, I did Step 1, the catkin_create_pkg command, in /home/user/ros. So I now have /home/user/ros/rqt_mypkg. I followed the tutorial exactly and all my rqt files are in /home/user/ros/rqt_mypkg. If I try to run catkin_make in /home/user/ros/rqt_mypkg, I get the message seen below, so instead I run catkin_make in /home/user/ros:

Base path: /home/user/ros/rqt_mypkg The specified base path "/home/user/ros/rqt_mypkg" contains a package but "catkin_make" must be invoked in the root of workspace

Is it correct that I created the the new plugin rqt_pkg underneath the ros project?

UPDATE #2: This is my current directory structure. The original workspace "ros" which is a fully functioning project that I am just trying to add a plugin to. 'rqt_mypkg' is the directory structure I added as I was doing the plugin tutorial.

ros/
   build/ 
      lots of files in here
   devel/
      lots of files in here
   src/
      CMakeLists.txt  (toplevel CMakeLists.txt for a catkin workspace)
      project1/
         CMakeList.txt (for the project1)
         package.xml
         x.launch
         src/
              project1.cpp
          include/
               include.txt
   rqt_mypkg/
       CMakeLists.txt (for the rqt_mypkg plugin)
       package.xml
       plugin.xml
       setup.py
       resource/
            MyPlugin.ui
       scripts/
            rqt_mypkg
       src/
            rqt_mypkg/
                 __init__.py
                 my_module.py

UPDATE #3: Some progress - thank you! Per your suggestion, I moved rqt_mypkg under ros/src directory. Now when I run catkin_make, I see it is getting compiled as I see these type of statements:

 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 -- ~~  traversing 2 packages in topological order:
 -- ~~  - rqt_mypkg
 -- ~~  - project1
 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 -- +++ processing catkin package: 'rqt_mypkg'
 -- ==> add_subdirectory(rqt_mypkg)

But when I run 'rqt --standalone rqt_mypkg --force -discover', I still get the same error:

qt_gui_main() found no plugin matching "rqt_mypkg" try passing the option "--force-discover"

When I run 'rqt --list-plugins' my ... (more)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-01-27 11:06:02 -0500

130s gravatar image

updated 2022-01-31 23:34:45 -0500

UPDATE-3: Sorry I missed the error msg was qt_gui_main(), but With that, now the issue seems to be with rqt setting. Googling with that error msg returns a few threads. I'd start with #q95091 to modify plugin.xml. If that's not yet good, please share plugin.xml if possible.


UPDATE-2: Yes, rqt_mypkg needs to be placed under src. You usually don't have to touch anything under your workspace directory except src. Everything else is meant to be auto-generated.


UPDATE: Thanks for the update. I think catkin wants packages to be placed in a folder with the specific name src.

Small experiment where I placed a catkin package at the top level of the workspace (which seems to be what you're doing AFIUC) proved that.

# mkdir /tmp/foows && cd /tmp/foows/ && git clone %RANDOM_CATKIN_REPO%
# catkin_make
Base path: /tmp/foows
The specified source space "/tmp/foows/src" does not exist

Worth checking tutorial for making your workspace http://wiki.ros.org/catkin/Tutorials/...


This is not an answer though it's too long for comment section so posting in the answer section.

the command 'rosrun rqt_mypkg rqt_mypkg' gives an error: "[rospack] Error: package 'rqt_mypkg' not found"

This indicates that ROS' file system look up module called rospack, which looks in to the paths defined in ROS_PACKAGE_PATH environment variable, cannot find rqt_mypkg, meaning the root cause is somewhere below rqt (ROS' GUI framework) level.

There can be various reasons why. Though you provided fairly good amount of info, I still cannot tell why this is happening for your particular case. I'd recommend looking for threads that talk about "[rospack] Error: package 'package' not found" issue.

edit flag offensive delete link more

Comments

@Green01 Looks like you got your GUI working? If so would you mind selecting this as an answer so that future readers know this helped? Or if you came up with your own original solution, you can post that as an answer instead.

130s gravatar image 130s  ( 2022-02-01 09:19:31 -0500 )edit
1

Yep, it is working now. Thanks for all your help. Quick summary for future folks. There were 2 problems: 1) My project was in the wrong directory. Project needs to be under 'src' as talked about in UPDATE-2 comments.
2) I had 2 copies of the same project which cause an error as talked about in UPDATE-4 comments

Green01 gravatar image Green01  ( 2022-02-02 06:47:42 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2022-01-27 10:05:37 -0500

Seen: 829 times

Last updated: Feb 01 '22