Quality of Service
Policies for ROS2Communications
ROScon 2019
Macau 2019–11–01

AWS Robotics
Emerson Knapp eknapp@amazon.com
Github: emersonknapp© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential andTrademark

AWS Robotics
Contributing actively to ROS2 to help accelerate progress in therobotics community
https://github.com/aws-robotics
https://github.com/orgs/ros2/teams/aws-robotics
Members of ROS2 working groups – Security, ToolingAWS RoboMaker https://aws.amazon.com/robomaker© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential andTrademark

AgendaIntroduction to Quality of Service
QoS Policies available in ROS2
Using QoS in ROS2

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential andTrademark

Introduction toQuality of Service© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential andTrademark

What is Quality of Service (QoS)?
QoS Profile

Advanced behavior of publish
and subscribe (pub/sub)communications

Policy1 = Value 1
Policy2 = Value 2…
PolicyN = ValueN

QoS “type” = “Policy”
Collection of Policies = “Profile”

Topic
Message Type

Publisher© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential andTrademark

QoS Profile

SubscriptionRelationship to DDS QoS
Exposed QoS policies are pulled from
DDS specification

Publisher/subscription
Topic

Message type

QoS Policy

Formalized as ROS2 native
concept• Non-DDS RMWs can choose toprovide QoS

RMW APIrmw (DDS)“QoS forFree!”© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential andTrademark

rmw (nonDDS)“QoS
implemented”

rmw_simple“QoS notsupported”

QoS profile matching
Subscription
for <TOPIC>

Publishers offer profile
Subscriptions request

Request
QoS

Policies have compatibility rules
Subscriptions get “Actual QoS”

Publisherfor <TOPIC>

Offer
QoS

noCompatible?

yes

Successful
subscription!

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential andTrademarkNosubscription
createdQoS policies in ROS2

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential andTrademark

QoS policy: History“How many messages to keep locally?”Compare ROS1 “queue_size”
Legal values-KEEP_ALL
KEEP_LAST + depth

Compatibility
N/A—does not apply to matching© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential andTrademark

Example:• Image processing queueQoS policy: History
Too old

Message

Message

Message
History

Message

History

Message

Message
MessagePublisher

Subscription“missed”© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential andTrademark

QoS policy: Durability“Should Publishers provide old messages?”
Compare ROS1 “latching”
Legal values

Example:• VOLATILE: Late joining subscriptions
receive nothing• TRANSIENT_LOCAL: Publishers
provide old messages• Latest mission state machineCompatibility• TRANSIENT_LOCAL > VOLATILE© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential andTrademark

QoS policy: Durability

msg2
time=5msg2
time=5msg1
time=1msg1
time=1

Publisher

History: 2Durability: TRANSIENT_LOCAL© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential andTrademark

Subscription

History: 1
Durability: TRANSIENT_LOCAL
Joined at time: 6

QoS policy: Reliability“Do messages have to be delivered/received?”
Legal values

Example:• BEST_EFFORT: No delivery
guarantee• RELIABLE: Guaranteed delivery*• Visualizer for humans doesn’t needretry• Safety critical update must getthroughCompatibility• RELIABLE > BEST_EFFORT© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential andTrademark

QoS policy: Reliability

Diagnostic
Publisher

BEST_EFFORT

Cellular
NetworkWeb DashboardRELIABL
EDistance Sensor
RELIABLE

Safety CriticalSystem© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential andTrademark

QoS policy: Lifespan“How long before an un-sent message is not useful anymore?”

Legal values

Example:• Duration: duration

Estimated pose when moving.

Compatibility• Offered duration >= Requested
duration© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential andTrademark

QoS policy: LifespanMessage
Message
MessagePublisher© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential andTrademark

History

Lifespanexpired

New concept – event callbacks
Some QoS Policies generate “events”
Subscriptions already had “message callback”—now add “QoS Eventcallback”
Publishers get them too!

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential andTrademark

QoS policy: Deadline“How often must I send messages?”(minimum frequency)
Legal values• Period: duration

Compatibility• Offered period <= Requested periodCallbacks• Publisher — OfferedDeadlineMissed• Subscription —RequestedDeadlineMissed© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential andTrademark

Example:/cmd_vel safety watchdog!

QoS policy: Deadline
Message time = 4

Message time = 4

Time = 3

OfferedDeadlineMissed
callback

Time = 3

Message time = 2

Message time = 2

Message time = 1

Message time = 1

Publisher
Deadline = 1© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential andTrademarkRequestedDeadlineMissed callback

Subscription
Deadline = 1

QoS policy: Liveliness“What type of heartbeat to I need to give to prove I’m not dead?”
Legal values• Kind: AUTOMATIC, MANUAL_BY_TOPIC,MANUAL_BY_NODE• Lease Duration: duration

Compatibility••

MANUAL_BY_TOPIC > MANUAL_BY_NODE > AUTOMATIC
Offered lease duration <= Requested lease Duration

Callbacks••

Publisher—LivelinessLost
Subscription—LivelinessChanged© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential andTrademark

QoS policy: Liveliness (AUTOMATIC)

Publisher
Liveliness: AUTOMATICrmwimplementation

Subscription
Liveliness: AUTOMATIC

Heartbeatrmw
implementation

Subscription
Liveliness: AUTOMATIC

CRASH!

Publisher liveliness: Automatic© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential andTrademark

rmw
implementation

LivelinessChanged
callback

alive + 1

LivelinessChanged
callback

alive - 1

QoS policy: Liveliness (MANUAL*)

LivelinessLost
callback

Lease
Lease

Publisher
Liveliness: MANUAL_BY_NODE

Subscription
Liveliness: MANUAL_BY_NODE

Assert livelinessLivelinessChanged
callback

Lease
Lease

Assert livelinessalive - 1

Lease
Lease

Assert liveliness© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential andTrademark

alive + 1

Using QoS in ROS2

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential andTrademark

Using QoS in ROS2 code
New arguments to create_publisher/create_subscription• QoSProfile structure• QoSEventCallbacks (deadline, liveliness)
Pre-defined “preset profiles” available
When in doubt, just History© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential andTrademark

CLI usageros2 topic pub -hros2 topic echo -hTakes most QoS policies
Work ongoing to add to `ros2 topic info`© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential andTrademark

Thank you!

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential andTrademark