Using ros2 doctor to Identify Issues – ROS 2 Jazzy

ros2-doctor

In this tutorial, we will explore how to use the ros2 doctor command to identify and diagnose issues in your ROS 2 system.

The purpose of ros2 doctor is to check the health and configuration of your ROS 2 setup. It analyzes various aspects such as environment variables, network configuration, and running systems to identify potential issues or warnings.

Real-World Applications

ros2 doctor is useful when:

  • Setting up a new ROS 2 environment to ensure proper configuration
  • Troubleshooting issues or errors in your ROS 2 system
  • Collaborating on ROS 2 projects to ensure consistent setups across team members

Prerequisites

All my code for this project is located here on GitHub.

Check Your Setup

Open a new terminal window.

Run the following command:

ros2 doctor

Review the report for any warnings or errors.

If ros2 doctor finds no warnings, you’ll see “All <n> checks passed”

You don’t have to worry about UserWarnings. UserWarnings indicate non-ideal configurations, but the setup is still usable.

What you do need to pay attention to are errors. If any errors are found, you will see “UserWarning: ERROR:”. In this case, the check is considered failed, and you should address the errors.

Check a System

Let’s use ros2 doctor to analyze an actual system.

We will launch the robot and use ros2 doctor to analyze the running system.

Open a terminal window, and launch your robot.

I will type the following command:

x3 

or

bash ~/ros2_ws/src/yahboom_rosmaster/yahboom_rosmaster_bringup/scripts/rosmaster_x3_gazebo.sh

Open another terminal window, and move the robot around:

ros2 run yahboom_rosmaster_system_tests square_mecanum_controller

In a separate terminal, display the messages that are broadcasting over the /cmd_vel topic:

ros2 topic echo /mecanum_drive_controller/cmd_vel

While the robot is running, open another terminal and run:

ros2 doctor

Review the report to see if there are any warnings or errors related to the running nodes, topics, or services.

Get a Full Report

To get a more detailed report from ros2 doctor, use the –report argument.

Open a terminal window, and run the following command:

ros2 doctor --report

The report will provide detailed information categorized into five groups:

  • NETWORK CONFIGURATION
  • PLATFORM INFORMATION
  • RMW MIDDLEWARE
  • ROS 2 INFORMATION
  • TOPIC LIST

Cross-reference the information in the report with the warnings from running ros2 doctor to gain deeper insights into the issues.

That’s it. Keep building!