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

Be explicit about reliability in Lifespan demos #350

Merged
merged 1 commit into from
May 23, 2019
Merged
Show file tree
Hide file tree
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 quality_of_service_demo/rclcpp/src/lifespan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ int main(int argc, char * argv[])

rclcpp::QoS qos_profile(history);
qos_profile
// Guaranteed delivery is needed to send messages to late-joining subscriptions.
.reliable()
// Store messages on the publisher so that they can be affected by Lifespan.
.transient_local()
.lifespan(lifespan_duration);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from rclpy.executors import SingleThreadedExecutor
from rclpy.qos import QoSDurabilityPolicy
from rclpy.qos import QoSProfile
from rclpy.qos import QoSReliabilityPolicy


def parse_args():
Expand Down Expand Up @@ -51,7 +52,10 @@ def main(args=None):

qos_profile = QoSProfile(
depth=parsed_args.history,
Copy link
Member

Choose a reason for hiding this comment

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

Unrelated to this PR: I would recommend making arguments match the QoS setting for clarity. Briefly, this looked like a bug, assigning a history setting to a depth setting.

durability=QoSDurabilityPolicy.RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL,
# Guaranteed delivery is needed to send messages to late-joining subscription.
reliability=QoSReliabilityPolicy.RELIABLE,
# Store messages on the publisher so that they can be affected by Lifespan.
durability=QoSDurabilityPolicy.TRANSIENT_LOCAL,
lifespan=lifespan)

listener = Listener(
Expand Down