DEV Community

Cover image for Bug of the week #9
pikoTutorial
pikoTutorial

Posted on • Originally published at pikotutorial.com

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
Enter fullscreen mode Exit fullscreen mode

Typically occurring when calling commands like:

ros2 topic echo /topic_name
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Top comments (0)