ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

When embedding a message, such as std_msgs/Header, as a field in a custom message, it should be visible when using ros2 topic echo. However, based on the output you provided, it seems that only the fields defined in your custom message (count, nch, and length) are being displayed.

To use the common_interfaces/Header.msg, you can include it in your custom message definition and use it as a field in your message. Here's an example:

    # MyCustomMessage.msg

    #include "std_msgs/Header.msg"

MyCustomMessage:
std_msgs/Header header
int32 count
int32 nch
int32 length

By including std_msgs/Header.msg and using header as a field in your custom message, you should be able to access and display the embedded message when using ros2 topic echo.

If the embedded message is still not being displayed, please ensure that your custom message is correctly built and sourced in your ROS 2 workspace.