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

Support several Publishers/Subscribers per-Node on a same topic #29

Merged
merged 1 commit into from
Dec 15, 2023

Conversation

JEnoch
Copy link
Member

@JEnoch JEnoch commented Dec 13, 2023

Closing #27

Copy link
Member

@Charles-Schleich Charles-Schleich left a comment

Choose a reason for hiding this comment

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

A few General knowledge questions:
but otherwise LGTM.

Larger, more general discussion regarding project at
eclipse-zenoh/roadmap#107

Comment on lines +69 to +74
// List of DDS Readers declared by 1 Node for a same topic
// Issue #27: usually only 1 Reader, but may happen that 1 Node declares several Subscribers
// on the same topic. In this case `ros2 node info <node_id>` still shows only 1 Subscriber,
// but all the writers can be seen with `ros2 topic info <topic_name> -v`.
// Hence the choice here to aggregate all the Readers in 1 Subscriber representation.
// The Subscriber is declared undiscovered only when all its Readers are undiscovered.
Copy link
Member

Choose a reason for hiding this comment

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

General question,
What are the differences between Readers and Subscribers In this text ?
Are Subscribers a Zenoh concept, and Readers a ROS2 concept ?

Copy link
Member

Choose a reason for hiding this comment

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

Answering on behalf of @JEnoch . Here Readers are related to DDS while Subscribers are related to Zenoh.

Copy link
Member Author

Choose a reason for hiding this comment

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

To be more precise, in the context of this code:

  • Reader means DDS DataReader
  • Subscriber means ROS 2 Subscriber, which happens to map in this plugin to a Zenoh Subscriber.

Comment on lines +32 to +37
// List of DDS Writers declared by 1 Node for a same topic
// Issue #27: usually only 1 Writer, but may happen that 1 Node declares several Publishers
// on the same topic. In this case `ros2 node info <node_id>` still shows only 1 Publisher,
// but all the writers can be seen with `ros2 topic info <topic_name> -v`.
// Hence the choice here to aggregate all the Writers in 1 Publisher representation.
// The Publisher is declared undiscovered only when all its Writers are undiscovered.
Copy link
Member

Choose a reason for hiding this comment

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

General question,
What are the differences between Writers and Publishers In this text ?
Are Publishers a Zenoh concept, and Writers a ROS2 concept ?

Copy link
Member

Choose a reason for hiding this comment

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

Answering on behalf of @JEnoch . Here Writers are related to DDS while Publisher are related to Zenoh.

Copy link
Member Author

Choose a reason for hiding this comment

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

To be more precise, in the context of this code:

  • Writer means DDS DataWriter
  • Publisher means ROS 2 Publisher, which happens to map in this plugin to a Zenoh Publisher.

return Some(UndiscoveredMsgPub(
node_fullname,
self.msg_pub.remove(&name.clone()).unwrap(),
self.msg_pub.remove(&name).unwrap(),
Copy link
Member

Choose a reason for hiding this comment

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

Based on eclipse-zenoh/roadmap#107, unwrap() could be avoided here. However, multiple unwrap() are already present in the code, which should be IMHO removed. I'd would leave that to a separate PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

For this specific unwrap(), the panic should never happen here. The name has just been found in self.msg_pub hashmap (see call to find_map()). And this code is not async.

Do you think .expect("cannot happen") better than unwrap() in such case ?

@Mallets Mallets merged commit 00d9430 into main Dec 15, 2023
20 checks passed
@Mallets Mallets deleted the fix_27 branch December 15, 2023 16:28
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.

3 participants