Interesting Practice of Robot Programming 11-Graphical Debugging Tool (rqt)

If the robot debugging tool uses ssh, run and use it in the terminal.

Of course, there are also many humanized debugging tools, such as the rqt series:

Keywords: Python C++ Qt

The interface that does not enable specific functions is as follows:

This section takes the console as an example for detailed introduction.

the goal

Learn about rqt_console, a tool for viewing log messages.

Basic concepts

rqt_console is a graphical user interface (GUI) tool for viewing log messages in ROS 2. Usually, log messages will be displayed in the terminal. Using rqt_console, you can collect these messages over time, carefully review, filter, save, and even reload the saved files for review at different times in a more organized way. Nodes use logs to output messages about events and status in a variety of ways. For users, their content is usually informative.

Feature pack

  1. rqt_concole
  2. turtlesim


1 Departure

Two ways to openrqt_console

The first one, rqt, then go to plugins->logging->console

The second kind,

  • ros2 run rqt_console rqt_console

After opening, the interface is as follows:

The first part of the console is where the log messages from the system are displayed.

(In the middle, you can choose to filter messages by exclusion severity level. You can also use the plus button on the right to add more exclusion filters. The bottom is used to highlight messages that contain the entered string. You can also add to this section More filters.)

It seems that the first picture above does not correspond to the text... Then look back...

Now start turtlesim in the new terminal using the following command:

  • ros2 run turtlesim turtlesim_node

First compare:



2 Message display

In order to generate the log message displayed by rqt_console, let the robot hit the wall. In the new terminal, enter the ros2 topic pub command (explained in detail in the topic tutorial):

  • ros2 topic pub -r 1 /turtle1/cmd_vel geometry_msgs/msg/Twist "{linear: {x: 2.0, y: 0.0, z: 0.0}, angular: {x: 0.0,y: 0.0,z: 0.1}}"

Since the above command publishes the topic at a steady speed, the robot keeps hitting the wall. In rqt_console, you will see the same message showing the warning severity level over and over again, as shown below:

The robot positions are as follows:

Press Ctrl+C in the terminal where the ros2 topic pub command is running to stop.

3 Recording log level

The logging levels of ROS 2 are sorted by severity:

- Fatal- Error- Warn- Info- Debug

There is no exact standard for what each level represents, but the following assumptions can be made:

  • Fatal A fatal message indicates that the system will terminate in an attempt to protect itself from damage.
  • Error The error message indicates that a major problem does not necessarily damage the system, but it prevents the system from operating properly.
  • Warn Warning messages indicate unexpected activities or undesirable results that may represent deeper problems, but do not directly impair functionality.
  • Info Information messages indicate events and status updates as a visual verification that the system is operating as expected.
  • Debug The debug message details the entire step-by-step process executed by the system.

The default level is Infoinformation. You will only see messages with the default severity level and higher severity levels.

Normally, only Debug messages are hidden because they are the only level with a lower severity than Info. For example, if you set the default level to warning, you will only see warnings, errors, and fatal messages.

Set the default log level

You can set the default logger level the first time you run the /turtlesim node with remapping. Enter the following command in the terminal:

  • ros2 run turtlesim turtlesim_node --ros-args --log-level WARN

Now you will not see the initial information level warning that appeared in the console the last time Turtlesim was started. That's because the priority of the information message is lower than the new default severity, warning.

to sum up

If you need to double check the log messages from the system, rqt_console can be very useful. You may want to check log messages for various reasons, usually to find out what went wrong and the series of events that caused the problem.

Small homework

  1. Read turtlesim/rqt source code
  2. Part of the code hints Chinese