fix(rosbag): widen Reader.messages start by 1ns to dodge rosbags MCAP chunk-filter off-by-one#279
Merged
Conversation
… chunk-filter off-by-one Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified Files
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Defensive workaround for an off-by-one bug in
rosbags' MCAP backend that causesRosbag2Reader.get_pointcloud(introduced in #277) to drop messages sitting at chunk boundaries. Observed loss is data-dependent but can exceed 50% for high-rate topics such as LiDAR packets.Root cause (in rosbags upstream)
rosbags/rosbag2/storage_mcap.py:591:message_end_timeis the inclusive timestamp of the chunk's last message, so the comparison should be<=. When the message we want is the last message of its chunk, the chunk is excluded from the search and the query returns empty.Fix
Widen
startby 1ns inRosbag2Reader.get_pointcloud. The interval[target_ns - 1, target_ns + 1)still uniquely identifies the target packet (timestamps within the same topic are not packed at 1ns spacing).Impact
On one production T4 dataset (50 frames, 6 LiDAR channels), 334 of 571
hesai_front_leftpackets (~58%) were previously unretrievable; all packets resolve after this fix.Follow-up
A separate issue will be filed against
rosbagsupstream to fix the comparison at the true root cause. Once that lands and we bump our pinnedrosbags, this widening remains correct and can stay as-is.Test plan
tests/rosbag/test_reader.pyexercises a packet at a chunk boundarypytest tests/rosbag/ -vpassesruff checkclean🤖 Generated with Claude Code