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

Revision history [back]

I think the main problem is that the code does not check which message is actually read out of the ros2bag. You can do this by reading the ros topic:

serialized_message->topic_name

before deserializing.

Then make sure to map the topic name to the type by initially retrieving the topic and types from the ros2bag by

auto topics = reader.get_all_topics_and_types();

The error message is common if one tries to deserialize with the wrong message type.

I think the main problem is that the code does not check which message is actually read out of the ros2bag. You can do this by reading the ros topic:

serialized_message->topic_name

before deserializing.

Then make sure to map the topic name to the type by initially retrieving the topic and types from the ros2bag by

auto topics = reader.get_all_topics_and_types();

The error message is common if one tries to deserialize with the wrong message type.

You can find an expample at https://github.com/orascheg/ROS2BagFileParsing.git