Ask Your Question

How can I do a GUI ?

asked 2016-06-27 00:03:31 -0500

Piero-31 gravatar image

updated 2016-06-29 21:47:29 -0500


I am working on a project to create a GUI which would interact with a robot using ROS. It's something relatively new for me.

I have done the beginner tutorial for ROS. Then I have seen that maybe I could create a GUI with Qt so I have started a tutorial to use this framework. But I have seen that there is also the software framework rqt of ROS that could do a GUI. I don't understand if I can still do my GUI on Qt and then imported it in ROS to use it. Because I have tried to make the tutorial of rqt but I don't understant anything :/ I did not understand the plugins and how I am supposed to create a GUI with rqt reading the tutorial. Qt seems easier for me to use.

Can someone tell me if I can use Qt ? Or if not can someone help me to understand what I should do with rqt ? (or explain me the tutorial because I don't find where I should start and what to do with the tutorial of rqt).

Thank you,


EDIT : Actually, I have already a program using ROS which controls my robot. What I want is to create a GUI which would enable me to change graphically the parameters of the robot for example.

edit retag flag offensive close merge delete

5 Answers

Sort by » oldest newest most voted

answered 2016-06-27 06:47:55 -0500

Airuno2L gravatar image

There's nothing special about ROS that would prevent you from using any other software with it. You can use Qt or any GUI software you want with it.

Or you can use rqt, if you're having trouble with a tutorial you'll need to post a question with the specific problem you're having for someone to help. Are you working from these tutorials?

edit flag offensive delete link more


Thank you Yes I am using these tutorials. But it's not just a specific problem, I just don't understand what the tutorial makes me do. For example the first one to create a plugin, I don't understand for what it is usefull, is it to create a GUI ? What are the plugins used for ? It is not clea

Piero-31 gravatar image Piero-31  ( 2016-06-27 16:30:51 -0500 )edit

But if I make my GUI on Qt, how can I make it interracting with the robot on ROS ? I supposed that I have to make some changes. Is it explained somewhere ?

Piero-31 gravatar image Piero-31  ( 2016-06-27 16:34:55 -0500 )edit

Yes, the tutorials are often a bit cryptic and hard to understand

Kansai gravatar image Kansai  ( 2020-08-03 09:16:54 -0500 )edit

answered 2016-06-27 08:14:50 -0500

updated 2016-06-30 02:46:40 -0500

Have a look at the ros_qml package. Right now the installation process is not very straight forward, but it is definitely easier to create a graphical interface in Qt QML, than writing a plugin for rqt.

Publishing a message from QML is as easy as this:

import QtQuick 2.2
import QtQuick.Controls 1.2
import Ros 1.0

ApplicationWindow {

  Ros {
    id: ros

    Publisher {
      id: pub1
      topic: Topic {
        name: "/my_topic"
        type: "std_msgs/Header"

  Button {
    text: "Publish"
    onClicked: {
      var now =
      ros.loginfo('Sample info message with user data: ' + JSON.stringify(now))

      var msg = {
        seq: 0,
        stamp: now,
        frame_id: 'test_frame',


For more examples, please see examples/ folder.


ros_qml is an essential part for creating QML GUI "connected" to ROS. It is a QML plugin (module) that exposes ROS features, such as publishers and subscribers. So there is no choice between Qt Quick and ros_qml — you need both. Also the package sets up the proper environment for Qt Creator, such that code-completion works fine for ros_qml.

I believe QML is extremely good for simple GUIs and it is usually a matter of minutes to create an interface.

If you are confident with installing dependencies from source (as described in ros_qml/, then I would recommend to use QML. Otherwise it might be too confusing.

The main hitch with installation is that PyQt 5.4 (Python module used by ros_qml) is precompiled only for Python 3, while ros_qml is written for Python 2.7. Therefore, PyQt has to be built from sources and linked with appropriate version of Python.

P.S. There seems to be not much interest in the package so far, so I didn't bother to simplify the installation process yet.


A common approach to change robot's parameters dynamically is dynamic_reconfigure and it is usually used in combination with rqt_reconfigure GUI. The interface is quite limited, it lacks push buttons etc., but can be an alternative to full-featured GUI.

edit flag offensive delete link more


Thank you it seems really interesting. Do you recommend me to use this language ? Actually, I don't get where I have to write the code. On QtQuick ? or with ros_qml ? I don't know if it is that

Piero-31 gravatar image Piero-31  ( 2016-06-27 16:48:03 -0500 )edit

But I have never used Python, I use C++ to code. Can we use QML with C++ ?

Piero-31 gravatar image Piero-31  ( 2016-06-28 19:24:17 -0500 )edit

QML is a programming language itself. You don't need to write anything neither in Python nor in C++. However, in order to use ros_qml package you should have PyQt 5.4 library with Python 2.7 bindings on your system. Most probably you will have to compile that library by yourself.

Boris gravatar image Boris  ( 2016-06-28 20:01:42 -0500 )edit

So I need to learn this new language ? Is there nothing that exists using C++ ? Where do I have to put this library ?

Piero-31 gravatar image Piero-31  ( 2016-06-28 21:59:27 -0500 )edit

I don't understand what you mean by " Also the package sets up the proper environment for Qt Creator, such that code-completion works fine for ros_qml." Does that mean that I can use Qtcreator (and the interface I have made) with ros_qml ?

Piero-31 gravatar image Piero-31  ( 2016-06-28 22:03:05 -0500 )edit

Yes, you have to learn this new language. For the options with C++, please refer to other answers. ros_qml provides plugin for QML engine, but to make Qt Creator to recognize it you have to tell Qt Creator plugin's location. ros_qml script named does it automagically.

Boris gravatar image Boris  ( 2016-06-29 08:39:01 -0500 )edit

This questions is a bit out of scope for ROS Answers. Anyway, the library will be placed to appropriate location by the installation script. Please refer to PyQt5 installation instruction.

Boris gravatar image Boris  ( 2016-06-29 08:45:18 -0500 )edit

I edited my post because I think I was not clear enough. Is QML useful for what I want ? I want to add a GUI to interact with a code already made.

Piero-31 gravatar image Piero-31  ( 2016-06-29 21:49:36 -0500 )edit

answered 2016-06-28 03:25:28 -0500

lfr gravatar image

Hello !

If you want to understand the use of rqt, begin by doing: rosrun rqt_gui rqt_gui (after running a roscore obviously).
Then play with the gui and the available plugins. You will quickly understand what is a rqt plugin and the idea of rqt.
After that, you have to read the tutorial and you will be able to include your own gui plugin in rqt (in order to do what you want). You will see, rqt is not as scary as you think ;)


edit flag offensive delete link more


Thank you but I did not understand the tutorial and neither the gui of rqt.

Piero-31 gravatar image Piero-31  ( 2016-06-28 22:06:51 -0500 )edit

Just do it. Don't stay blocked. Run the rqt_gui and play with all you can. If you don't try really, nobody will be able to do it in your place. I want to help you but if you stay blocked facing any difficulty, I can't do anything more. Be courageous and good luck.

lfr gravatar image lfr  ( 2016-06-29 01:58:46 -0500 )edit

I spent almost 4 days so 28 hours trying and then I wanted some help but thank you.

Piero-31 gravatar image Piero-31  ( 2016-06-29 16:28:36 -0500 )edit

Hi, I have finally made a plugin with rqt, by myself only and so after 1 week of attempts, but my problem is still here. I don't know how the GUI plugin I've made can interact with my ROS code. I would like to set some parameters of my code, by using the GUI. Do you know something for that ?

Piero-31 gravatar image Piero-31  ( 2016-07-03 23:07:06 -0500 )edit

You have to write the includes you need (ros.h, ...) and you will be able to use the ros functions as you want. You can write data on topics in order to interact with other nodes (or use the ros services). If you want to set parameters, you would be able to interact with the ros parameter server.

lfr gravatar image lfr  ( 2016-07-04 01:55:57 -0500 )edit

Good luck !

lfr gravatar image lfr  ( 2016-07-04 01:56:13 -0500 )edit

answered 2016-06-27 08:14:09 -0500

rastaxe gravatar image

As @Airuno2L said, you can use any GUI library for that. By the way, if you are skilled with web developing, I would suggest the Robot Web Tool, look here.

edit flag offensive delete link more


Thank you I will have a look on it !

Piero-31 gravatar image Piero-31  ( 2016-06-27 16:35:50 -0500 )edit

answered 2017-08-24 21:24:33 -0500

pavankumarbn gravatar image


Creating GUI using Qt with PyQt or Pyside plugins is very easy compared to writing rqt plugin. All you need to do is a design desired GUI in QT Designer and convert created UI design file to python file using pyuic python compiler. Then start wiriting interacting code with GUI and ROS. That's it:)

Follow this tutorial

edit flag offensive delete link more


Please don't post link-only answers, this leaves the answer to be not self-contained. Please update your answer with the all of the relevant information to answer the question.

jayess gravatar image jayess  ( 2019-01-05 12:14:52 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2016-06-27 00:03:31 -0500

Seen: 14,448 times

Last updated: Jun 30 '16