0
$\begingroup$

Rosanswers logo

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 /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 rqt_mkpkg plugin is not listed.

UPDATE #4: I did the tutorial twice, so I had 2 copies of rqt_mypkg in different locations. When I initially started doing the tutorial, I created rqt_mypkg in my /home/user directory, but then after getting some errors, decided to do the tutorial again but this time under my existing project. As soon as I deleted /home/user/rqt_mypkg, I was able to run my plugin in /home/user/ros/src/rqt_mypkg! Thank you for the tips and helping to get me on the correct path by putting my plugin under the src directory.

Any help for this newbie would be much appreciated!


Originally posted by Green01 on ROS Answers with karma: 25 on 2022-01-27

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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/create_a_workspace


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.


Originally posted by 130s with karma: 10937 on 2022-01-27

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by 130s on 2022-02-01:
@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.

Comment by Green01 on 2022-02-02:
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
$\endgroup$

Your Answer

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