Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A way to convert ros2 bags from one distribution to another #1895

Open
chesterrc opened this issue Jan 13, 2025 · 6 comments
Open

A way to convert ros2 bags from one distribution to another #1895

chesterrc opened this issue Jan 13, 2025 · 6 comments
Labels
enhancement New feature or request

Comments

@chesterrc
Copy link

Description

A ros2 CLI tool to convert bag files to different distributions would be really helpful for collaborating with other users who have different ros2 distributions.

Related Issues

N/A

Completion Criteria

Argument in the CLI that would allow the conversion between different ROS2 distributions.

Implementation Notes / Suggestions

I would think that we want example metadata.yaml files of how different ROS2 distributions store their data as some sort of boilerplate.

@chesterrc chesterrc added the enhancement New feature or request label Jan 13, 2025
@Jeffxzj
Copy link

Jeffxzj commented Jan 23, 2025

Do you mean converting rosbag with different file formats? Like converting a SQLite3 formatted bag from older ROS2 distributions to an MCAP formatted bag using the ros2 bag cli ?

@lee-shun
Copy link

Do you mean converting rosbag with different file formats? Like converting a SQLite3 formatted bag from older ROS2 distributions to an MCAP formatted bag using the ros2 bag cli ?

Probably No. I think @chesterrc wants to ask if the bag recorded by Rolling can be played by Humble or vice versa. Because I got a similar request recently.

Do you have any suggestions?

1 similar comment
@lee-shun
Copy link

Do you mean converting rosbag with different file formats? Like converting a SQLite3 formatted bag from older ROS2 distributions to an MCAP formatted bag using the ros2 bag cli ?

Probably No. I think @chesterrc wants to ask if the bag recorded by Rolling can be played by Humble or vice versa. Because I got a similar request recently.

Do you have any suggestions?

@MichaelOrlov
Copy link
Contributor

Currently, the bag recorded by Humble can be replayed by all of its successor's distros up to the latest Rolling. We keep backward compatibility.
However, there is almost no way to make the bag recorded on Rolling to be replayed on Humble.
One workaround could be by deleting metadata.yaml file and run ros2 bag reindex path/to/robag2_folder on Humble.
The main difference is in the metadata serialized formats and internal data structures used when reading metadata.

One can see differences in a different version of metadata in unit tests https://github.com/ros2/rosbag2/blob/rolling/rosbag2_storage/test/rosbag2_storage/test_metadata_serialization.cpp
and in git history for the https://github.com/ros2/rosbag2/commits/rolling/rosbag2_storage/include/rosbag2_storage/bag_metadata.hpp

@lee-shun
Copy link

Oh,thank you for your quick reply!I will try this solution later!

Cheers 🍻

@jin3qin
Copy link

jin3qin commented Feb 5, 2025

Currently, the bag recorded by Humble can be replayed by all of its successor's distros up to the latest Rolling. We keep backward compatibility. However, there is almost no way to make the bag recorded on Rolling to be replayed on Humble. One workaround could be by deleting metadata.yaml file and run ros2 bag reindex path/to/robag2_folder on Humble. The main difference is in the metadata serialized formats and internal data structures used when reading metadata.

One can see differences in a different version of metadata in unit tests https://github.com/ros2/rosbag2/blob/rolling/rosbag2_storage/test/rosbag2_storage/test_metadata_serialization.cpp and in git history for the https://github.com/ros2/rosbag2/commits/rolling/rosbag2_storage/include/rosbag2_storage/bag_metadata.hpp

Hi MichaelOrlov, after I followed your method, but it still doesn't work. This is the printing of the operation process.

qing@ubuntu:~/M300_160_1$ ls
M300 1601 0.mcap metadata.yaml metadata.yaml.cp
qing@ubuntu:~/M300_160_1$ rm metadata.yaml.cp
qing@ubuntu:~/M300_160_1$ rm metadata.yaml
qingdhp:~/M300_160_1$ ls
M300_160_1_0.mcap
qing@ubuntu:~/M300_160_1$ cd ..
qing@ubuntu:~$ ros2 bag reindex M300_160_1
[INFO][1738726137.875949969][rosbag2_cpp]: Beginning reindexing bag in directory:M300_160_1

closing.
[INFO][1738726137.911760334][rosbag2_cpp]: Reindexing complete.
qing@ubuntu:~$ ros2 bag play M300_160_1

closing.
[INFO][1738726147.948193008][rosbag2_player]: Set rate to 1
yaml-cpp: error at line 1,column 12: bad conversion

Now I have an idea, take the ros2bag of version Rolling and compile it under version Humble, and then try to play ros'bag, do you have any suggestions? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants