Introduction and Usage of RQt in ROS2

Introduction and Usage of RQt in ROS2

OverviewRQt is a graphical user interface framework that implements various tools and interfaces in the form of plugins. One can run all the existing

Overview

RQt is a graphical user interface framework that implements various tools and interfaces in the form of plugins. One can run all the existing GUI tools as dockable windows within RQt! The tools can still run in a traditional standalone method, but RQt makes it easier to manage all the various windows in a single screen layout.

You can run any RQt tools/plugins easily by:

rqt

Screenshot from 2022-11-09 18-20-17

Plugins

These are the manually maintained list of rqt plugins provided by ROS’ desktop-full debian package. For the full, automatically generated list, see the corresponding metapackages.

Screenshot from 2022-11-09 19-38-07

Service Caller

Service caller is the one I use the most frequently. You could find which service you may call and call it easily just by fill the parameters in the blanks.

There is the contarst of two way to calling service, through rqt and command.

  ros2 service call \
  /pose_estimation/by_instance vision_interfaces/srv/GetModelFreeObjectPoseEstimationByInstance \
  '{"instance_id": "left_pallet_pose_estimation",  "expected_dimensions": [{"x": 0.52, "y":0.282, "z": 0.33}]}'

Screenshot from 2022-11-09 18-59-35

Service Type Browser

Type browser is another plugin I always use. When you are working on several projects, it’s a good way to remind you what the name/type/path of the service you want is. And also if you work on a project you developed long time ago, it will be a nice helper.

Screenshot from 2022-11-09 19-14-26

Perspectives

One of the most strong funtion is the UI of rqt which is developed based on Qt, a famous C/Cpp framework. It is dockable multiple widgets in a single window (no need to open multiple windows). People can adjust the size and layout of the window arbitrarily, and save and load a variety of customized layout configuration.

Screenshot from 2022-11-09 19-33-34

  1. You could choose and change the perspective configuration here.
  2. You could move every window by selecting and moving it freely.
  3. Every plugin can be opened more than one window.
  4. And every window could be maxmized, minimized and classified&sorted.
  5. Even most of the widgets also can be rearranged.

How to create your own plugin

Official Tutorial

For those who want to develop their own rqt plugins.

  1. Create your rqt plugin package
    Entry point for creating your rqt plugin either in python or C++.

  2. Writing a C++ Plugin
    Shows how to write a plugin for rqt in C++.

  3. Writing a Python Plugin
    Shows how to write a plugin for rqt in Python.

  4. Create rqt plugin using an existing Qt based tool
    No Description

  5. Using .ui file in rqt plugin
    In this tutorial python is used for now. C++ tutorial is pending.

  6. To show error or exception message to users
    Shows error/warning msgs or progress bar on GUI by using a component in rqt_py_common pkg

File Structure

Screenshot20221110142517

  • package.xml - The ROS package declaration.
  • plugin.xml - The referenced file with additional meta information regarding the plugin.
  • src/rqt_service_caller - Plugin functions.
    • service_caller.py
    • service_caller_widget.py
  • script/rqt_service_caller - Plugin entry.
  • resource/ServiceCaller.ui - Layout definition.

Some Interesting Trick in Source codes

I’ve found that there are two insteresting and maybe useful tricks in source codes. One is that there are many snippets in the codes that use recursion to process UI information. The other is about dry humour :

Q: Is there an operator with the meaning of NXOR?
A: Maybe … the operator is “==”

1668088385

LICENSED UNDER CC BY-NC-SA 4.0
Comment