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

ROS2 bagging custom msg: [ROSBAG2_TRANSPORT]: Topic '/my_topic/sync' has unknown type`

asked 2023-06-30 17:31:31 -0500

peteflorence gravatar image

Hi there, when I run a ros2 bag record /my_topic/sync which is a custom .msg type.

I'm getting a [ROSBAG2_TRANSPORT]: Topic '/my_topic/sync' has unknown type

The thing I'm confused about is:

  1. If I start a new terminal, and I try to ros2 topic echo /my_topic/sync that also doesn't work.
  2. But then in that terminal if I build and source the workspace's, then echo of the custom .msg does work.
  3. The confusing thing to me is that the same does not work for ros2 bag record.

The full error message is along the lines of:

Only topics with known type are supported. Reason: 'package 'my_topic' not found, searching: <just about everywhere else on my computer except the folder which has the .msg> I see several threads that pop up when I search this error, but all the ones I found relate to spamming of the error message continuously rather how to config it go away?

Any ideas? Would be much appreciated!

edit retag flag offensive close merge delete


Is this message type something define by your own? You need to source it by running . install/setup.bash

sdu568 gravatar image sdu568  ( 2023-06-30 18:23:39 -0500 )edit

I was running setup.bash. I found an answer, posting below.

peteflorence gravatar image peteflorence  ( 2023-06-30 18:27:01 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2023-06-30 18:31:04 -0500

peteflorence gravatar image

updated 2023-06-30 18:42:10 -0500

Answering my own question...

In the end a simple fix to the package.xml made this go away. Here's the full list of changes to the package.xml, I'm not sure which exactly were needed but definitely the <build_type> needed to be ament_cmake instead of architecture_independent:

- <buildtool_depend>catkin</buildtool_depend>

+ <buildtool_depend>ament_cmake</buildtool_depend>

+ <buildtool_depend>rosidl_default_generators</buildtool_depend>

+ <exec_depend>rosidl_default_runtime</exec_depend>

- <buildtool_depend>rosidl_default_generators</buildtool_depend>

+ <build_depend>rosidl_default_generators</build_depend>


- <architecture_independent/>

+ <build_type>ament_cmake</build_type>


Sorry for the ugly diff formatting but this was the best I could find to do!

edit flag offensive delete link more

Question Tools



Asked: 2023-06-30 17:31:31 -0500

Seen: 373 times

Last updated: Jun 30 '23