Skip to content

Are typesupport libraries needed to be present when deserializing a message in the bag #1809

@karthiknit1

Description

@karthiknit1

Description

As ROS 2 bags are now having message definitions stored in the bag, I did not find a way to deserialize the message in the bag without loading the type support libraries for the message types stored in the bag.

For example, ROS 1 bags play the bag file even without registering the custom message type (present in the bag) by building a custom message package with the ROS Environment.

Whereas ROS 2 bags when playing just ignores the custom message type (present in the bag) without registering the custom message package with the ROS Environment. But why? The required definition is already present in the bag. How to bypass loading type support libraries for custom message, as it requires to perform colcon build on the message package (which may or may not be available to the user if the bag file is shared by other user). This is applicable to both .db3 and .mcap

I see that cdr deserializer requires typesupport libraries to be loaded for it to deserialize the message appropriately.

@r7vme, @MichaelOrlov - Correct me, if my understanding is wrong. Also, please provide an example on how to deserialize the message in C++ (without typesupport) from the bag file that contains message definition.

Expected Behavior

Behavior should be same as ROS 1 when playing the bag

Actual Behavior

I see the following warnings when playing the bag without registering the custom message.

[INFO] [1726516729.204952700] [rosbag2_storage]: Opened database 'D:/customMsgTestsqlite3/customMsgTestsqlite3_0.db3' for READ_ONLY.
[WARN] [1726516729.211764300] [ROSBAG2_TRANSPORT]: Topic '/tp033bd2d3_9065_44f4_963b_92f2da38c5fe' has unknown type 'depend_msgs/msg/FullNameDepend' . Only topics with known type are supported. Reason: 'package 'depend_msgs' not found, searching: [D:\Downloads\ros2-jazzy-20240705-windows-release-amd64.zip\ros2-windows]
[WARN] [1726516729.212114400] [ROSBAG2_TRANSPORT]: Topic '/tp515e517f_9f6a_49f7_a4e0_a210f92fbb95' has unknown type 'depend_msgs/msg/OneDepend' . Only topics with known type are supported. Reason: 'package 'depend_msgs' not found
[WARN] [1726516729.212387300] [ROSBAG2_TRANSPORT]: Topic '/tp6ffaa37d_edf5_4721_bf8d_65e5e171063c' has unknown type 'depend_msgs/msg/NestedDepend' . Only topics with known type are supported. Reason: 'package 'depend_msgs' not found
[WARN] [1726516729.212666800] [ROSBAG2_TRANSPORT]: Topic '/tpd13aabaa_f1a1_4513_9fae_3a0630817a1a' has unknown type 'depend_msgs/msg/NoDepend' . Only topics with known type are supported. Reason: 'package 'depend_msgs' not found

To Reproduce

** Steps to reproduce the behavior, e.g.
Execute "ros2 bag play" on the bag file attached to reproduce the warnings.

System (please complete the following information)

  • OS: Windows 11
  • ROS 2 Distro: Jazzy
  • Install Method: release archive
  • Version: Latest release

Additional context

** Add any other context about the problem here **
customMsgTestsqlite3.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions