Skip to content

OGC rqt

ZeGrandmaster edited this page Dec 23, 2020 · 1 revision

Introduction

What is rqt?

rqt (or ROS Qt) is a software framework of ROS that implements the various GUI tools in the form of plugins. It is based on the Qt framework and users can write a custom plugin using python or C++. rqt supercedes the former GUI tools of ROS rxtools, which now is deprecated since ROS groovy.

Who is rqt for?

rqt is very useful for those who need a more visual look to their project (e.g. having a control window instead of typing terminal commands) or for those who need to represent a set of data received graphically (e.g. displaying bar charts or progress bars). However, do note that since it is based on the ROS environment, you must already have ROS installed before using rqt (See installation procedure).

Code Architecture

The code is roughly split into 3 parts, the code that determines the UI and layout, the code that handles the input-output (IO) of data and lastly the part of code that supports miscellaneous features. Since it is a GUI (Graphical User Interface) it doesn't really have much data processing other than adding prefixes to the data received (such as adding units to the data).

User Interface (UI)

UI

This is the part of the code that deals with the UI aspect of the rqt. Since our rqt was developed on top of the tutorial version of rqt (link here), it has a similar code structure to the tutorial rqt.

When the script is executed, it reads through my_module.py. It then loads the layout in the main_window.ui. main_window.ui contains a vertical box layout with 2 columns which will be populated by the widgets. The main layout is split into several sections, mainly command_window, summary_window and waypont_window. Each section has its own python file where the section will be populated by its own set of widgets.

For waypoint_window and aircraft_info, the python file is purely for UI purposes. However, the command_window due to its nature has both the UI elements and the I/O functionality for each of the UI element.

Other than the 3 main sections on the main-page of rqt, there are other UI elements such as pop-up windows and warning windows. These are located in the popup_window.py.

Input Output (I/O)

IO

Input

The rqt receives input from several sources and pass it into the output function through a Signal-Slot technique. The input sources are:

  • Ground Despatcher
  • Status Text Handler

Ground despatcher publishes information to rqt through ROS publisher/subscriber function. rqt receives 2 types of message from ground despatcher, namely Regular Payload and On-Demand text.

  • Regular Payload is a message type that consists of crucial aircraft information such as airspeed, altitude, GPS location, etc (more on RegularPayload link here). The ground dispatcher takes the message, decode it and send it to rqt through the ogc/from_despatcher/regular topic. The rqt then receives the message, obtain the aircraft id of the sender and display all the relevant information to the respective UI elements. For example, the current waypoint and the total waypoint is used to display the waypoint progress bar, and altitude is displayed both in the summary page and in the individual aircraft page.

  • On-Demand messages are miscellaneous texts that do not belong to Regular Payload or Status Text. It generally consists of confirmation messages or error messages. The rqt displays these on-demand messages in the text boxes located at the top of the summary_window. If the on-demand texts are from an aircraft, it will display it with the aircraft ID. For example, "Aircraft 1: ARM Command received".

Status Text Handler Status Text Handler is a function that decodes the message received from Air Despatcher that informs the state of the aircraft (entering VTOL mode, moving to waypoint 6, etc)

  • The rqt receives messages from status text handler in the form of a string that has the message type, sender id and the timestamp along with the main message. rqt then split this message and display only the sender id, message type and the message itself to the text boxes. Sample of a status text message is "Aircraft 2 [INFO]: Executing VTOL Transition"

Signal-Slot function

As mentioned previously, information from input needs to be passed through a Signal-Slot function in order to display it. In rqt we use Communicate (QObject) class which takes in the information from the ROS topics as a signal and emit it into its respective function for displaying purposes.

For example, the airspeed data is obtained through ogc/from_despatcher/regular and is passed into regular_payload function. Inside the function you will see the Communicate class being instantiated. Then the signal-slot will be declared by using .connect() function. In our case, we will be using airspeed_signal for the airspeed data and we will connect it to the self.airspeed_display which will display the airspeed in the UI. Then we use .emit() to emit the data to the destination.

The number of data and the data type that can be passed through is declared inside the Communicate() class. Taking the airspeed example, we declared the airspeed signal as such airspeed_signal = Signal(float, str) which means the .emit() must have 2 arguments, a float and an integer (float for airspeed data and integer for the aircraft ID the data is coming from). Hence the full emit expression will be Communicate.airspeed_signal.emit(data.airspeed, aircraft_id). Similarly, the receiving function, airspeed_display must have 2 arguments as well to receive both data properly.

Output

rqt output can be generally classified into 3 types. These are:

  • Output to UI display
  • Output to gnd_despatcher
  • Output to identifiers

The output to UI is basically displaying the data received. This is mainly handled in the my_module.py where each input message (such as airspeed, altitude, on-demand messages)

The output to ground despatcher is in the form of a command. These are the messages that you want the aircraft to receive and do something with it. Example of such messages is ARM commands, ping and load waypoint command. These messages are written in the command_window.py file

The identifiers file is a .json file that lists down all the information of identified aircraft and GCSs. The rqt uses ROS service client call in order to obtain the identified aircraft and overwrite the values with the new values that the user input. This can be found in command_window.py

Miscellaneous

Miscellaneous features are additional features which are not essential to the main function of rqt. These are mostly cautionary messages, checklists or other supporting features.

Checklists

Checklist code is located in checklist_window.py, and its main purpose is for the operator to have an in-built pre-flight checklist function. Before the operator completes the checklist of an aircraft, the ARM button would give a warning sign. This is to ensure that the pre-flight checklist has been conducted.

ROS log reader

This function is to enable users to open a ROS log and read it in a clearer format. The feature, therefore, splits each ROS log message into the source of the message, the severity level, timestamp, and the message itself and display it in a table format with a condensed message. This is to allow the user to read the logs easily and scroll through the entire log faster.

Telegram Sync Method

This function is responsible to sync the waypoint and identifiers folder between the GCS and a target aircraft.