ros2 resource_error ai_generated true

[rosbag2_storage] Failed to open bag: unsupported compression format 'lz4' for storage plugin 'sqlite3'

ID: ros2/rosbag2-compression-unsupported-format

Also available as: JSON · Markdown · 中文
80%Fix Rate
83%Confidence
1Evidence
2024-07-12First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
Humble active
Iron active
Rolling active

Root Cause

The rosbag2 storage plugin (e.g., sqlite3) does not support the specified compression format (e.g., lz4, zstd). Supported formats depend on the plugin version and build options.

generic

中文

rosbag2存储插件(如sqlite3)不支持指定的压缩格式(如lz4、zstd)。支持的格式取决于插件版本和构建选项。

Official Documentation

https://github.com/ros2/rosbag2?tab=readme-ov-file#compression

Workarounds

  1. 90% success Check supported compression formats: ros2 bag info /path/to/bag. If unsupported, re-record the bag without compression: ros2 bag record -o my_bag --no-compression /topic1 /topic2. Then play back: ros2 bag play my_bag
    Check supported compression formats: ros2 bag info /path/to/bag. If unsupported, re-record the bag without compression: ros2 bag record -o my_bag --no-compression /topic1 /topic2. Then play back: ros2 bag play my_bag
  2. 85% success If you need compression, use a supported format like 'zstd'. Record with: ros2 bag record -o my_bag --compression-mode file --compression-format zstd /topic1. Ensure zstd is installed: sudo apt-get install libzstd-dev
    If you need compression, use a supported format like 'zstd'. Record with: ros2 bag record -o my_bag --compression-mode file --compression-format zstd /topic1. Ensure zstd is installed: sudo apt-get install libzstd-dev
  3. 75% success For custom builds, rebuild rosbag2 with the desired compression plugin: colcon build --packages-select rosbag2_compression --cmake-args -DCOMPRESSION_LZ4=ON. Then restart recording.
    For custom builds, rebuild rosbag2 with the desired compression plugin: colcon build --packages-select rosbag2_compression --cmake-args -DCOMPRESSION_LZ4=ON. Then restart recording.

中文步骤

  1. Check supported compression formats: ros2 bag info /path/to/bag. If unsupported, re-record the bag without compression: ros2 bag record -o my_bag --no-compression /topic1 /topic2. Then play back: ros2 bag play my_bag
  2. If you need compression, use a supported format like 'zstd'. Record with: ros2 bag record -o my_bag --compression-mode file --compression-format zstd /topic1. Ensure zstd is installed: sudo apt-get install libzstd-dev
  3. For custom builds, rebuild rosbag2 with the desired compression plugin: colcon build --packages-select rosbag2_compression --cmake-args -DCOMPRESSION_LZ4=ON. Then restart recording.

Dead Ends

Common approaches that don't work:

  1. 90% fail

    The system library is not enough; rosbag2 must be built with lz4 support enabled at compile time. Simply having the library doesn't enable the plugin.

  2. 85% fail

    Changing the environment variable only affects recording, not playback. If the bag was recorded with lz4, playback will still fail if lz4 is unsupported.