Repository navigation
ROSBag: parse the RealSense image footer instead of guessing it - #154
Open
TianHengZhuang wants to merge 1 commit into
Open
TianHengZhuang wants to merge 1 commit into
TianHengZhuang wants to merge 1 commit into
Conversation
RealSense SDK bags append a 4-byte little-endian float to every image message, holding the depth scale. The reader now derives the payload boundary from the sensor_msgs layout, decodes only the message bytes and exposes the footer value as Image.depth_units. Recordings of the same topics without a footer keep all their pixel data. Adds RealSense-style ROS 1 fixtures, generated by create_ros_fixture.py, covering both trailed and self-contained messages. Closes petercorke#151
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 28 |
| Duplication | 2 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
This branch has not been deployed
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.
Problem
RealSense SDK bags append four extra bytes to every image message: a little-endian float32 holding the depth scale (0.001 for 16UC1 depth). The reader currently strips four bytes from every connection as soon as one realsense_msgs connection is present, so the value is discarded instead of being exposed, and recordings whose messages are self-contained (for example Intel's published single_depth_color_640x480.bag) lose the last four bytes of every image.
Change
CDR encoded messages (ROS 2 wire format inside a ROS 1 container) use the same approach with CDR alignment.
Tests
tests/create_ros_fixture.py now also writes test_ros1_realsense.bag (four byte footer on every image, 0.001 on the depth stream) and test_ros1_realsense_notrailer.bag (same topics, no footer).
TestRosBagRealSense covers topic detection, decoding of both streams, depth_units == 0.001 on depth, 0.0 on colour, and the absence of the attribute for self-contained recordings.
The rosbag tests need the ros extra and the generated fixtures. I checked the decode path of both new bags and of the existing ROS 1 and ROS 2 fixtures with rosbags directly; the full suite runs in CI.