# How do I get started making RQT plugins?

Hey,

So I'm fairly new at ROS, QT and RQT, and I'm trying to figure out how everything "fits together."

I've looked at the guide for making RQT plugins yourself, but I'm still having some trouble figuring out how to actually set everything up.

Once I have a QT widget made, say with a couple of buttons and a text label, how do I actually add ROS functions to those? I thought I'd just add the ROS-related code to my QT project, but it keeps telling me it can't find the ros/ros.h header file that it needs when I try to build, and I can't find that file anywhere on my ros install.

Do I need my entire QT project to be in a catkin workspace, maybe? And how am I supposed to build it--using QT's built in "build" button, or through the catkin build commands?

So what I'm really looking for is some guide to get me from the start (e.g. no code) to maybe some hello world RQT widget; I just need to understand how I'm supposed to structure everything/ make everything fit together.

My setup: I need to work in C++ because some libraries I'm going to end up needing aren't available for python; I also want to "hard code" my QT widget (so not using a .ui file) because I need to populate some menus and drop downs while the program is running, which is hard to do when a .ui file is involved; I'm on ROS Indigo (can't use Hydro on Ubuntu 14.04)

Thanks a lot for any input you may have. :)

edit retag close merge delete

Sort by » oldest newest most voted

Once I have a QT widget made, say with a couple of buttons and a text label, how do I actually add ROS functions to those? I thought I'd just add the ROS-related code to my QT project

Your right. You just have to add "interface" between your Qt widgets and rqt plugin framework. For rqt plugin in C++, only the class that extends rqt_gui_cpp::Plugin is rqt specific. So create it, and use your custom Qt classes from there.

but it keeps telling me it can't find the ros/ros.h header file that it needs when I try to build, and I can't find that file anywhere on my ros install.

Please provide more info; e.g. command you ran and its full (or sufficient amount of ) output.

There may be only a handful of plugins written in C++. One good example is rqt_image_view. See its code as a reference (note that this plugin, however, is written all-in-one style of Plugin class and Qt widget).

more

In order to work from inside QtCreator with ROS projects you have to first start it properly. As you know after the installation you have to source both the setup.bash in ROS' installation folder as well as the one in YOUR_CATKIN_WS/devel/. This are however not known outside the terminal environment. That is why if you launch your QtCreator the normal way that is not through the qtcreator command in your terminal) QtCreator will throw errors at you (missing ros.h included). If you start the IDE from within your terminal you are good to go:

• Run catkin_make in your top-level folder of your catkin workspace. This will create all the need to have folders you have to have in your package in order for it to be a proper package
• Launch QtCreator via the terminal (with the environment variables for ROS set)
• Go to Open File or Project in your File menu. Navigate to the CMakeLists.txt in the root of your package (YOUR_CATKIN_WS/src/YOUR_PACKAGE/CMakeLists.txt) and open it. When asked where QtCreator should put the build files go to the top-level folder of your catkin workspace, select the build folder and then the folder with the name of your package (this is automatically created after you run catkin_make).

Now you can work with all packages that you create in your catkin workspace without any issues.

EDIT: As for the Rqt plugin story you can easily do that by following these articles. It's a little bit too much work omho and you might screw things up especially with Python but after 2-3 tries you should be able to do this on your own without too much of a fuss.

more