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

Make transition event topic reliable to avoid topic lost #1171

Open
wants to merge 3 commits into
base: rolling
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions rcl_lifecycle/src/com_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ rcl_lifecycle_com_interface_publisher_init(

// initialize publisher
rcl_publisher_options_t publisher_options = rcl_publisher_get_default_options();
// transition event topic needs to be latched for the subscription joins later.
publisher_options.qos.durability = RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL;
publisher_options.qos.depth = 1;
Comment on lines +112 to +113
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
publisher_options.qos.durability = RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL;
publisher_options.qos.depth = 1;
// transition event topic needs to be latched for the subscription joins later.
publisher_options.qos.durability = RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL;
publisher_options.qos.depth = 1;

changing publisher's QoS to transient local should not break any downstream subscriptions, https://docs.ros.org/en/rolling/Concepts/Intermediate/About-Quality-of-Service-Settings.html#id6.

IMO this transition event topic needs to be latched to deliver the latest state for the subscribers that join later. probably adding comments why we use transient local with depth 1 would be useful.

besides, Managed Node Design also says the following.

A topic should be provided to broadcast the new life cycle state when it changes. This topic must be latched.

rcl_ret_t ret = rcl_publisher_init(
&com_interface->pub_transition_event, node_handle,
ts_pub_notify, pub_transition_event_topic, &publisher_options);
Expand Down