Skip to content
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

feat: introduce the advanced publisher and subscriber (backport #368) #469

Merged
merged 3 commits into from
Feb 19, 2025

Conversation

mergify[bot]
Copy link

@mergify mergify bot commented Feb 18, 2025

With this PR, we replace the QueryingSubscriber and PublicationCache (+ a normal publisher)
with the AdvancedSubscriber and AdvancedPublisher.

NOTE: A deadlock is found when undeclaring advanced subscribers. It will be fixed once eclipse-zenoh/zenoh#1685 is merged and synced with zenoh-c.


This is an automatic backport of pull request #368 done by Mergify.

* feat: introduce the advanced publisher/subscriber

* chore: ament_uncrustify and ament_cpplint

* trigger CI

* refactor: remove the unneeded querying callbacks

* fix: reorder the advanced pub/sub options to match the ROS2 QoS

* chore: add tmp

* chore: apply the QoS mapping

* style: ament_cpplint + ament_uncrustify

* trigger CI

* refactor: remove the recovery option as it exceeds typical ROS use cases

* chore: remove the QoS for end-to-end reliability

* style: ament_uncrustify

* Cleanup

Signed-off-by: Yadunund <[email protected]>

---------

Signed-off-by: Yadunund <[email protected]>
Co-authored-by: Yadunund <[email protected]>
(cherry picked from commit 77561d8)

# Conflicts:
#	rmw_zenoh_cpp/src/detail/rmw_publisher_data.cpp
@mergify mergify bot added the conflicts label Feb 18, 2025
Copy link
Author

mergify bot commented Feb 18, 2025

Cherry-pick of 77561d8 has failed:

On branch mergify/bp/jazzy/pr-368
Your branch is up to date with 'origin/jazzy'.

You are currently cherry-picking commit 77561d8.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   rmw_zenoh_cpp/src/detail/graph_cache.cpp
	modified:   rmw_zenoh_cpp/src/detail/graph_cache.hpp
	modified:   rmw_zenoh_cpp/src/detail/rmw_publisher_data.hpp
	modified:   rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp
	modified:   rmw_zenoh_cpp/src/detail/rmw_subscription_data.hpp

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   rmw_zenoh_cpp/src/detail/rmw_publisher_data.cpp

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

Signed-off-by: Alejandro Hernandez Cordero <[email protected]>
Comment on lines 249 to 244
auto options = zenoh::Publisher::PutOptions::create_default();
options.attachment = create_map_and_set_sequence_num(
sequence_number_++,
entity_->copy_gid());
int64_t source_timestamp = rmw_zenoh_cpp::get_system_time_in_ns();
auto opts = zenoh::ext::AdvancedPublisher::PutOptions::create_default();
opts.put_options.attachment = rmw_zenoh_cpp::AttachmentData(
sequence_number_++, source_timestamp, entity_->copy_gid()).serialize_to_zbytes();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we're switching from create_map_and_set_sequence_num() to AttachmentData in this PR which was not part of #368.
Do we still need create_map_and_set_sequence_num?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's best if we do a backport of #294 but make modifications to drop the tracetools dependency. That should ensure we're consistent with our usage of AttachmentData instead of create_map_and_set_sequence_num. Please hold off on merging this and the humble backport in the meanwhile.

@ahcorde ahcorde requested a review from Yadunund February 19, 2025 09:29
@ahcorde
Copy link
Contributor

ahcorde commented Feb 19, 2025

@Yadunund the tracetools PR was merge and this one was updated

@ahcorde ahcorde removed the conflicts label Feb 19, 2025
Copy link
Member

@Yadunund Yadunund left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with all tests passing!

@Yadunund Yadunund merged commit 65a7a9c into jazzy Feb 19, 2025
4 checks passed
@Yadunund Yadunund deleted the mergify/bp/jazzy/pr-368 branch February 19, 2025 18:16
@Pleune
Copy link

Pleune commented Feb 27, 2025

Sorry to comment on a closed PR

Building zenoh-cpp 5dfb68c9ac966925e59bcb52f39b9bc26c0ad6d3 & zenoh-c 261493682c7dc54db3a07079315e009a2e7c1573 (1.2.1) and rmw_zenoh ecf21d45edb870ca2d3e24d38503842081420766 aginst the commits listed in the vendoring CMake file, all from the rolling, or in this case jazzy, branches, I get errors like below:

   > /build/rmw_zenoh_cpp/src/detail/rmw_publisher_data.hpp:114:15: error: 'AdvancedPublisher' in namespace 'zenoh::ext' does not name a type
   >   114 |   zenoh::ext::AdvancedPublisher pub_;
   >       |               ^~~~~~~~~~~~~~~~~
   > In file included from /build/rmw_zenoh_cpp/src/detail/rmw_node_data.hpp:30:
   > /build/rmw_zenoh_cpp/src/detail/rmw_subscription_data.hpp:142:29: error: 'AdvancedSubscriber' is not a member of 'zenoh::ext'
   >   142 |   std::optional<zenoh::ext::AdvancedSubscriber<void>> sub_;
   >       |                             ^~~~~~~~~~~~~~~~~~
   > /build/rmw_zenoh_cpp/src/detail/rmw_subscription_data.hpp:142:52: error: template argument 1 is invalid
   >   142 |   std::optional<zenoh::ext::AdvancedSubscriber<void>> sub_;
   >       |                                                    ^~
   > make[2]: *** [CMakeFiles/rmw_zenoh_cpp.dir/build.make:286: CMakeFiles/rmw_zenoh_cpp.dir/src/detail/rmw_subscription_data.cpp.o] Error 1
   > /build/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.hpp:57:24: error: 'ShmProvider' is not a member of 'zenoh'
   >    57 |   std::optional<zenoh::ShmProvider> & shm_provider();
   >       |                        ^~~~~~~~~~~
   > /build/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.hpp:57:35: error: template argument 1 is invalid
   >    57 |   std::optional<zenoh::ShmProvider> & shm_provider();
   >       |                                   ^
   > make[2]: *** [CMakeFiles/rmw_zenoh_cpp.dir/build.make:412: CMakeFiles/rmw_zenoh_cpp.dir/src/rmw_get_node_info_and_types.cpp.o] Error 1
   > make[2]: *** [CMakeFiles/rmw_zenoh_cpp.dir/build.make:482: CMakeFiles/rmw_zenoh_cpp.dir/src/rmw_init.cpp.o] Error 1
   > make[2]: *** [CMakeFiles/rmw_zenoh_cpp.dir/build.make:440: CMakeFiles/rmw_zenoh_cpp.dir/src/rmw_get_topic_endpoint_info.cpp.o] Error 1

Is there any obvious reason that this would be happening?

Thank you!

Sorry this seems unrelated to this PR. It was just the first thing to break. I need to debug my setup.

My problem is that flags such as Z_FEATURE_SHARED_MEMORY and Z_FEATURE_UNSTABLE_API are not defined anywhere, but they are needed before including zenoh.hxx. If someone see this and could provide any insight that would be very helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants