-
Notifications
You must be signed in to change notification settings - Fork 17
Add compressing and decompressing modes #24
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
Add compressing and decompressing modes #24
Conversation
|
FYI @jacobperron |
|
Just as a thought, it is probably worthwhile to look at the pluggable compression that rosbag2 has. It's probably overkill for right now, but it might a) allow you to have pluggable compression, and b) share some code with rosbag2. |
Yes, I actually copy-pasted part of the code from there. |
|
I tried this with the Results using a 640x480 rgb image:
That's a really promising bandwidth reduction. |
|
I think that the bridge mode (compressing/decompressing/normal) could be specified per topic and not globally, once we merge this I'll work on improving that. |
|
@jacobperron friendly ping, I think we should at least merge the first commit 5007b22. |
jacobperron
left a comment
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.
The approach sounds good to me; relying on zstd directly and later we can consider a plugin-based approach.
I think that we should make the compression mode per topic (as you suggest), since it's at the topic-level where this compression is happening.
I'd also like to see the following:
- Tests for the compression feature (to prevent regression)
- Green CI (Gpr and Rpr jobs).
- There's linter errors on Rolling
- It looks like there's an rclcpp API being used that's not available in Galactic. Preferable we could workaround this so we don't need to branch, but it's not a blocker.
|
@ivanpauno Submitting the bug fix as a separate PR would be nice, then we can merge that independently. |
Done, see #27. |
I think that we can do that in a follow-up PR, IIUC the current plan was to compress of the traffic. |
|
The Gpr branch is failing because |
I misunderstood the nature of #27. Is it possible we can keep the |
I think so. @jacobperron should we merge this as-is to avoid conflicts or do you prefer to first reintroduce compatibility with the galactic branch? |
|
#29 reintroduces compatibility with galactic, I think we can merge that one first and then go ahead with this one. |
|
Now that #30 is merged. I'm hopeful that rebasing on |
* Add domain_bridge/msg/CompressedMsg interface. * Add compress and decompress mode to the bridge. * Refactor existing tests to better reuse code. * Add tests for compress and decompress modes. Signed-off-by: Ivan Santiago Paunovic <[email protected]>
6a438f3 to
4122e0b
Compare
Rebased.
Either thing would have made this patch easier. |
Signed-off-by: Ivan Santiago Paunovic <[email protected]>
jacobperron
left a comment
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.
LGTM. I've left a few minor comments.
The rebase wasn't as easy as I would've wanted, because either:
The API create a GenericPublisher isn't flexible enough.
PublisherBase doesn't have a method to publish serialized messages.
That's too bad. I suppose we should support one of those options (or both) in rclcpp. If you agree, can you create an rclcpp ticket and reference it the code here as a comment? Thanks 🙇
| { | ||
| public: | ||
| explicit ScopedAsyncSpinner(std::shared_ptr<rclcpp::Context> context) | ||
| : executor_{get_executor_options_with_context(std::move(context))}, |
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.
Are the std:move calls necessary? It seems like the code would be more straightforward without them.
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.
They aren't necessary, but it's cheaper to move a shared pointer passed by value than to copy it again.
(i.e. this is avoiding to increment the reference count and then decrement it again in the destructor of the context argument)
IMO this is the standard way of getting part ownership of a shared_ptr.
Signed-off-by: Ivan Santiago Paunovic <[email protected]> Co-authored-by: Jacob Perron <[email protected]>
Signed-off-by: Ivan Santiago Paunovic <[email protected]>
jacobperron
left a comment
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.
LGTM
5007b22 fixes a bug.
90a4fc9 implements the compressing and decompressing modes.
There are a lot of things that could be improved but this is an okay first prototype.
e.g.:
In one terminal:
In another terminal:
ROS_DOMAIN_ID=2 ros2 topic echo /chatter