CARVIEW |
Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Support receiving frames in ROS2 CompressedImage format #13957
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support receiving frames in ROS2 CompressedImage format #13957
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for receiving frames in ROS2 CompressedImage format, addressing both the test harness and the DDS data path.
- Updates unit tests to use the new image_times variable for timestamp validation.
- Adds new type and serialization code for CompressedImage in sensor_msgs, including PubSubTypes and related topic/message classes.
- Adapts DDS streaming and proxy logic to choose between compressed and uncompressed image message handling based on profile encoding.
Reviewed Changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated no comments.
File | Description |
---|---|
unit-tests/dds/test-metadata.py | Updated test callback and wait_for_image logic to use image_times rather than the previous image_content. |
third-party/realdds/src/topics/ros2/sensor_msgs/* | New implementation files for handling CompressedImage type and corresponding PubSubTypes. |
third-party/realdds/src/dds-stream.* | Modified DDS streaming code to distinguish between compressed and uncompressed image topics and pass image data accordingly. |
third-party/realdds/* and src/dds/rs-dds-sensor-proxy.* | Adjustments in topic creation and callback signatures to support the CompressedImage format. |
Comments suppressed due to low confidence (3)
unit-tests/dds/test-metadata.py:110
- [nitpick] Consider adding additional test cases that simulate receiving multiple image callbacks to ensure the image_times list is appropriately managed (cleared and accumulated) under various timing scenarios.
if count is None or count <= len(image_times):
third-party/realdds/include/realdds/dds-stream-base.h:35
- [nitpick] Consider adding a brief comment explaining the purpose of the _compressed flag to improve clarity for future maintainers.
bool _compressed = false;
third-party/realdds/src/dds-stream.cpp:120
- Ensure that moving the image data from the frame does not cause unintended side effects elsewhere in the processing pipeline if the frame is referenced later.
_on_data_available( std::move( frame.raw().data() ), frame.timestamp(), std::move( sample ) );
// Will throw if an unexpected error occurs. | ||
// | ||
//Note - copies the data. | ||
//TODO - add an API for a function that loans the data and enables the user to free it later. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this TODO?
Same for all topics?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's the same for all topics. It's a reminder for a future improvement trying to implement zero copy.
if( is_streaming() && _on_data_available ) | ||
_on_data_available( std::move( frame ), std::move( sample ) ); | ||
topics::compressed_image_msg frame; | ||
while( _reader && topics::compressed_image_msg::take_next( *_reader, &frame, &sample ) ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we merge this 2 flows into a single one somehow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, I will move the logic to a template function in the h file, handle_data
will call it with appropriate type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@OhadMeir looks great, some questions for you to consider
Tracked on [RSDEV-3113]