# [ROS2] Retrieving QOS settings for a topic

Hi, since a subscriber can receive a topic message only if its QOS profile is compatible with the QOS profile of the publisher, is there a way to retrieve the DURABILITY and the RELIABILITY settings for a topic?

I think that the command

$ros2 topic info /topic can be a good place to introduce this important feature. What do you think? Walter edit retag close merge delete ## 2 Answers Sort by » oldest newest most voted At least on foxy, you can use the --verbose flag with the command: $ ros2 topic info /topic_name --verbose


User gvdhoorn pointed out the --verbose or -v flag that can be used to output the QoS parameters and which nodes are publishing / subscribing to the topic. For example...

\$ ros2 topic info /robot_description --verbose
Type: std_msgs/msg/String

Publisher count: 1

Node name: robot_state_publisher
Node namespace: /
Topic type: std_msgs/msg/String
Endpoint type: PUBLISHER
GID: 01.0f.71.ef.91.21.00.00.01.00.00.00.00.00.14.03.00.00.00.00.00.00.00.00
QoS profile:
Reliability: RMW_QOS_POLICY_RELIABILITY_RELIABLE
Durability: RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL
Lifespan: 2147483651294967295 nanoseconds
Liveliness: RMW_QOS_POLICY_LIVELINESS_AUTOMATIC
Liveliness lease duration: 2147483651294967295 nanoseconds

Subscription count: 2

Node name: rqt_gui_py_node_10355
Node namespace: /
Topic type: std_msgs/msg/String
Endpoint type: SUBSCRIPTION
GID: 01.0f.71.ef.73.28.00.00.01.00.00.00.00.00.11.04.00.00.00.00.00.00.00.00
QoS profile:
Reliability: RMW_QOS_POLICY_RELIABILITY_RELIABLE
Durability: RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL
Lifespan: 2147483651294967295 nanoseconds
Liveliness: RMW_QOS_POLICY_LIVELINESS_AUTOMATIC
Liveliness lease duration: 2147483651294967295 nanoseconds

Node name: rviz2
Node namespace: /
Topic type: std_msgs/msg/String
Endpoint type: SUBSCRIPTION
GID: 01.0f.71.ef.8b.21.00.00.01.00.00.00.00.00.16.04.00.00.00.00.00.00.00.00
QoS profile:
Reliability: RMW_QOS_POLICY_RELIABILITY_RELIABLE
Durability: RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL
Lifespan: 2147483651294967295 nanoseconds
Liveliness: RMW_QOS_POLICY_LIVELINESS_AUTOMATIC
Liveliness lease duration: 2147483651294967295 nanoseconds

more

Currently there is no way to get this information in the rclcpp or rclpy API.

I'm am pretty sure the information is available in the lower level middleware interface, so it would just need to be exposed through our middleware abstraction layer. Unfortunately this can be a tedious thing to do, but if you're interested I'd recommend opening an issue on the ros2/rmw repository or on the ros2/ros2 repository asking for this feature.

This feature is related to a series of other features which generally have to do with providing more information from the underlying middleware about the entities in the ROS graph, e.g. ability to associate publishers/subscriptions and the nodes that created them or which machine and process a node comes from.

more

Has this changed in the last two years? It would be very useful to get the qos settings so we can subscribe dynamically.

( 2020-12-08 14:02:48 -0500 )edit