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

Default subscriber QOS to BestEffort, account for TRANSIENT_LOCAL #991

Open
wants to merge 2 commits into
base: ros2
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
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,23 @@ def __init__(self, topic, client_id, callback, node_handle, msg_type=None, raw=F
# incompatible. Here we make a "best effort" attempt to match existing
# publishers for the requested topic. This is not perfect because more
# publishers may come online after our subscriber is set up, but we try
# to provide sane defaults. For more information, see:
# to provide sane defaults.
# For this reason we use volatile durability and best effort reliability
# to prioritize topic compatibility when the publisher policy is not known.
# For more information, see:
# - https://docs.ros.org/en/rolling/Concepts/About-Quality-of-Service-Settings.html
# - https://github.com/RobotWebTools/rosbridge_suite/issues/551
# - https://github.com/RobotWebTools/rosbridge_suite/issues/769
qos = QoSProfile(
depth=10,
durability=DurabilityPolicy.VOLATILE,
reliability=ReliabilityPolicy.RELIABLE,
reliability=ReliabilityPolicy.BEST_EFFORT,
)

infos = node_handle.get_publishers_info_by_topic(topic)
if any(pub.qos_profile.durability == DurabilityPolicy.TRANSIENT_LOCAL for pub in infos):
qos.durability = DurabilityPolicy.TRANSIENT_LOCAL
qos.reliability = ReliabilityPolicy.RELIABLE
if any(pub.qos_profile.reliability == ReliabilityPolicy.BEST_EFFORT for pub in infos):
qos.reliability = ReliabilityPolicy.BEST_EFFORT

Expand Down
Loading