Robotics StackExchange | Archived questions

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

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 install.sh, 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: ``` 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!

Asked by peteflorence on 2023-06-30 17:31:31 UTC

Comments

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

Asked by sdu568 on 2023-06-30 18:23:39 UTC

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

Asked by peteflorence on 2023-06-30 18:27:01 UTC

Answers

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 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>

<export>

- <architecture_independent/>

+ <build_type>ament_cmake</build_type>

</export>

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

Asked by peteflorence on 2023-06-30 18:31:04 UTC

Comments