Add ULog to ROS2 bag script#121
Conversation
Does basic conversion from ulog to ros2 bag
bkueng
left a comment
There was a problem hiding this comment.
Looks good. I'm a bit surprised that this does not use mcap.
For mcap I saw there was a conversion script added here: foxglove/mcap#1531.
Can you also check the linting failures?
| r"\.ulg$", "", Path(ulog_file_name).name | ||
| ) | ||
|
|
||
| storage_options = rosbag2_py.StorageOptions(uri=rosbag_name, storage_id="sqlite3") |
|
Thank you for the quick feedback. I almost exclusively use ROS2 Humble, but have noticed that ROS2 Jazzy changes the default for rosbag2 from sqlite3 to mcap. Would you like the script to reflect this change? As for the pylint warnings, I believe I have resolved all of them except for 'unnecessary-lambda-assignment' and 'too-many-branches'. How would you like me to go about resolving these? |
bkueng
left a comment
There was a problem hiding this comment.
I almost exclusively use ROS2 Humble, but have noticed that ROS2 Jazzy changes the default for rosbag2 from sqlite3 to mcap. Would you like the script to reflect this change?
If you actually use it it's perfectly fine to keep sqlite3. Based on what I've seen ROS2 is generally moving over to mcap entirely, that's why I asked.
We could add both as options and make mcap the default, if that is easy to do?
As for the pylint warnings, I believe I have resolved all of them except for 'unnecessary-lambda-assignment' and 'too-many-branches'. How would you like me to go about resolving these?
For the lambda, you should be able to follow the hint and directly use def rosbag_write( topic, msg, timestamp): inside the condition.
For the other one it's fine if you add an ignore.
|
It looks like there is no clean way to check for the availability of a rosbag2 storage plugin from rosbag2_py in Humble, so I left sqlite3 as the default and added a parameter for mcap. If the user specifies mcap and they don't have it installed, it will error and the user can re-run the command without the parameter or install the storage plugin. I resolved the other pylint warnings, it looks like there is one last warning from pytest in 3.14 coming from pyulog internally. |
bkueng
left a comment
There was a problem hiding this comment.
Let's get this in then. I'll look into the unrelated CI failure
For various reasons, it has become convenient for my work to be able to convert ULog files to ROS2 bag files for post-flight analysis. Inspired by the ulog2rosbag script already in pyulog, I have created a similar script that works in ROS2, with a few additional features to make life easier:
Here is an example output:
I still haven't added support for composed message types, but I have successfully tested the script on various ULog files recorded in-house aswell as a SITL log file from online and with ROS2 distros Humble, Jazzy, and Lyrical, and all other topics seem to work. Please let me know what changes you would like to see and if this would be a good candidate for merging.