# Overview

A graphical user interface or GUI enables people especially end users to interactive with ROS through graphical icons and visual indicators.

In fact, there has been multiple tools which can be used in Linux or Ubuntu to make a GUI, such as Qt, Gambas, GTK+ and Perl. Also in Github, there are a number of examples of ROS GUI, while most of them are written in Python, which drives us to find an easy way to create a ROS GUI for C++ developers.

A light weight and easy-to-build tool to write a GUI would be perfectly saving developers’ time and energy and helps better focusing on the original technical topic, which is ROS here. Among those above, Qt highlights itself for its broad use in different platforms and plenty of open-sourced resources.

# Establish a Qt development environment in ROS

Qt is a cross-platform application framework that is widely used for developing application software that can be run on various software and hardware platforms with little or no change in the underlying codebase, while having the power and speed of native applications.

An example GUI created by Qt is shown as following,

## 1) Qt SDK Installation

The newly updated version of Qt is Qt 5.5.1 ( http://www.qt.io/download-open-source/#section-2 ), though you can still follow this tutorial,

which shows a step by step tutorial to install Qt SDK 4.8 and Qt SDK 5.0 on Ubuntu.

## 2) First Qt program

For those who are new to use Qt, this tutorial may help you quickly develop a simple hello world program,

which is enough to make you familiar with the wedgets and qmake use in Qt.

## 3) make QtCreator runnable in Ubuntu terminal

In Step 1), it has shown us how to make "qmake" runnable in terminals. Similarly, we can set qtcreator runnable in Ubuntu terminal.

Note, we can simply install a qtcreator package with a command,

$sudo apt-get install qtcreator Then it perfectly runs in terminals, like$ qtcreator

However, this qtcreator installed in this way may not be the latest version.

What we need here is only to put a soft link to the qtcreator we have just installed. Here are some simple precedures.

1. Once the Qt program is installed, open up a terminal and use a text editor such as nano or gedit to edit your /etc/profile.
• Type/Copy/Paste: sudo -s nano /etc/profile
• or
• Type/Copy/Paste: sudo -s gedit /etc/profile

2. Scroll down to the end of the /etc/profile file and enter the following text below. You want to add this line below to your /etc/profile system wide file so that you will have the option to compile Qt programs from the terminal line.

3. Type/Copy/Paste:

$sudo apt-get install ros-indigo-qt-build ## 5) Import an existing ROS project to QtCreator The steps are • Click “File->Open File or Project” • Choose “CMakeLists.txt” in ros package folder • Choose or create a build directory for building and running Note: Not all the files in the ros package folder will be automatically imported to QtCreator, such as “include” folder. You might need to import them manually. # Create a Qt ROS GUI template ROS has been very friendly to Qt by providing a package, catkin_create_qt_pkg, to help building Qt environment in ROS, which you can refer to ROS WIKI at http://wiki.ros.org/qt_create/Tutorials/Qt%20App%20Templates To build a Qt ROS GUI template using that , in your workspace, type$ cd src

$catkin_create_qt_create qtros where “qtros” is the package name you created. Normally, it will show you as Through command “tree”, you can take a look at what has been generated for you and their structure. Enter the QtCreator from the terminal by typing$ qtcreator

Click “Configure Project”, then it will automatically compile the “qtros” project for you.

After that, once you modified your code you can switch to use “catkin_make” to compile in terminal window,

$~/ros_ws$ catkin_make

# Conclusion

This report gives some basic steps to start with C++ GUI in ROS. Following these procedures, I believe we can build more interactive GUI programs by just focusing on modifying the qnode files which has been a pure ROS problem.