Setting compression mode when using rosbag2_py.SequentialCompressionWriter
bmdyrdal opened this issue · 7 comments
Hi folks,
I'm writing a component for recording specific topics, and wanted to use the rosbag2_py library.
I'm having some difficulties finding out how I can set the compression mode? I see that you can set it in the bagmetadata, but I don't see how I can use that?
Anyone who has any examples of how I can do this?
Thanks in advance!
@bmdyrdal What storage backend and ROS 2 distro are you going to use?
If this is for Iron or Rolling - we have a special field in the StorageOptions
Please refer to the https://github.com/ros2/rosbag2#recording-with-a-storage-configuration and https://github.com/ros2/rosbag2/blob/rolling/rosbag2_storage_mcap/README.md#writer-configuration and https://github.com/ros2/rosbag2/blob/rolling/rosbag2_storage_sqlite3/README.md#storage-configuration-file
to see how to write config files for storage backend.
As far as I see the constructor of the Sequential Compression Writer has an argument of type rosbag2_compression::CompressionOptions
However, this argument is not bound to Python accordingly in rosbag2_py
rosbag2/rosbag2_py/src/rosbag2_py/_writer.cpp
Lines 109 to 110 in d788e51
Furthermore, the rosbag2_compression::CompressionOptions
is not bound to Python.
So wouldn't it be correct to adapt the pybind11 code in rosbag2_py to adapt the API of the cpp version?
@MichaelOrlov Using Humble, store it using sqlite3 in our file system.
Works fine using it from the command line.
@simonsag96 Is spot on with his comment! 👍
While waiting for this I ended up writing a python node which starts the recording as a subprocess.
@bmdyrdal @simonsag96 Yes. The solution would be to provide pybind11 code in rosbag2_py package to map rosbag2_compression::CompressionOptions
to Python and use it as the default parameter in the Python version of the SequentialCompressionWriter
.
But unfortunately, I don't have time for this task. If some of you can provide a PR it would be great, otherwise, this task will go in the backlog.
Thanks for your answer @MichaelOrlov!
I could implement this over the course of next week!
@simonsag96 I needed this myself today, so I put together this PR: #1425