Bug of the week #9


Welcome to the next pikoTutorial !

The error we’re handling today is a ROS runtime error:

The message type 'X' is invalid

Typically occurring when calling ROS commands like:

ros2 topic echo /topic_name

What does it mean?

To understand where does this error come from, you must understand 2 ROS concepts:

  • underlay
  • overlay

Underlay allows you to create in your terminal a basic environment in which all the ROS tools (like ros2 topic, ros2 run, ros2 launch etc.) are available for you to use. You source the underlay by calling:

source /opt/ros/<distro>/setup.bash

Overlay allows you to extend that terminal environment with the project-specific packages. You source the overlay by calling:

source your_workspace/install/setup.bash

So if you were able to run a command like ros2 topic echo, but it failed with the mentioned error, it means that you have sourced the underlay, but the topic you want to examine uses some non-standard message type and you haven’t sourced the overlay of the workspace in which that message type is defined.

How to fix it?

Source you workspace environment with the following command:

source your_workspace/install/setup.bash