Chapter 11. Designing a GUI for a Robot Using Qt and Python

In the last chapter, we discussed the integration of robotic hardware components and software packages for performing autonomous navigation. After the integration, the next step is to build a GUI to control the robot. We are building a GUI that can act as a trigger for the underlying ROS commands. Instead of running all the commands on the terminal, the user can work with the GUI buttons. The GUI we are going to design is for a typical hotel room with nine tables. The user can set a table position in the map of the hotel room and command the robot to go to a particular table to deliver food. After delivering the food, the user can command the robot to go to its home position.

Some of the most popular GUI frameworks currently available are Qt (http://qt.digia.com) and GTK+ (http://www.gtk.org/), Qt and GTK+ are open source, cross-platform user interface toolkits and development platforms. These two software frameworks are widely used in Linux desktop environments, like GNOME and KDE.

In this chapter, we will be using Python binding of the Qt framework to implement the GUI because Python binding of Qt is more stable than other UI Python bindings. We can see how to develop a GUI from scratch and program it using Python. After discussing basic Python and Qt programming, we will discuss ROS interfaces of Qt, which are already available in ROS. We will first look at what is the Qt UI framework is and how to install it on our PC.

Installing Qt on Ubuntu 14.04.2 LTS

Qt is a cross-platform application framework that is widely used to develop application software with a GUI interface as well as command line tools. Qt is available on almost all operating systems, like Windows, Mac OS X, Android, and so on. The main programming language used for developing Qt applications is C++ but there are bindings available for languages such as Python, Ruby, Java, and so on. Let's take a look at how to install Qt SDK on Ubuntu 14.04.2. We will install Qt from the Advance Packaging Tool (APT) in Ubuntu. The APT already comes with the Ubuntu installation. So for installing Qt/Qt SDK, we can simply use the following command, which will install Qt SDK and its required dependencies from the Ubuntu package repository. We can install Qt version 4 using the following command:

$ sudo apt-get install qt-sdk

This command will install the entire Qt SDK and its libraries required for our project. The packages available on Ubuntu repositories may not be the latest versions. To get the latest version of Qt, we can download the online or offline installer of Qt for various OS platforms from the following link:

http://qt-project.org/downloads

After installing Qt on our system, we can see how we can develop a GUI using Qt and interface with Python.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.90.141