Skip to content

Commit 16d3cf4

Browse files
authored
Add function to get publisher actual qos settings (#169)
* Added rmw_publisher_get_actual_qos function Signed-off-by: ivanpauno <[email protected]> * Add RMW_QOS_POLICY_*_UNKNOWN enum value Signed-off-by: ivanpauno <[email protected]>
1 parent 0d7db0f commit 16d3cf4

File tree

2 files changed

+32
-3
lines changed

2 files changed

+32
-3
lines changed

rmw/include/rmw/rmw.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,32 @@ rmw_publisher_count_matched_subscriptions(
251251
const rmw_publisher_t * publisher,
252252
size_t * subscription_count);
253253

254+
/// Retrieve the actual qos settings of the publisher.
255+
/**
256+
* Query the underlying middleware to determine the qos settings
257+
* of the publisher.
258+
* The actual configuration applied when using RMW_*_SYSTEM_DEFAULT
259+
* can only be resolved after the creation of the publisher, and it
260+
* depends on the underlying rmw implementation.
261+
* If the underlying setting in use can't be represented in ROS terms,
262+
* it will be set to RMW_*_UNKNOWN.
263+
* The value of avoid_ros_namespace_conventions field is not resolved
264+
* with this function. The rcl function rcl_publisher_get_actual_qos
265+
* resolves it.
266+
*
267+
* \param[in] publisher the publisher object to inspect
268+
* \param[out] qos the actual qos settings
269+
* \return `RMW_RET_OK` if successful, or
270+
* \return `RMW_RET_INVALID_ARGUMENT` if either argument is null, or
271+
* \return `RMW_RET_ERROR` if an unexpected error occurs.
272+
*/
273+
RMW_PUBLIC
274+
RMW_WARN_UNUSED
275+
rmw_ret_t
276+
rmw_publisher_get_actual_qos(
277+
const rmw_publisher_t * publisher,
278+
rmw_qos_profile_t * qos);
279+
254280
/// Publish an already serialized message.
255281
/**
256282
* The publisher must already be registered with the correct message type

rmw/include/rmw/types.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,21 +175,24 @@ enum RMW_PUBLIC_TYPE rmw_qos_reliability_policy_t
175175
{
176176
RMW_QOS_POLICY_RELIABILITY_SYSTEM_DEFAULT,
177177
RMW_QOS_POLICY_RELIABILITY_RELIABLE,
178-
RMW_QOS_POLICY_RELIABILITY_BEST_EFFORT
178+
RMW_QOS_POLICY_RELIABILITY_BEST_EFFORT,
179+
RMW_QOS_POLICY_RELIABILITY_UNKNOWN
179180
};
180181

181182
enum RMW_PUBLIC_TYPE rmw_qos_history_policy_t
182183
{
183184
RMW_QOS_POLICY_HISTORY_SYSTEM_DEFAULT,
184185
RMW_QOS_POLICY_HISTORY_KEEP_LAST,
185-
RMW_QOS_POLICY_HISTORY_KEEP_ALL
186+
RMW_QOS_POLICY_HISTORY_KEEP_ALL,
187+
RMW_QOS_POLICY_HISTORY_UNKNOWN
186188
};
187189

188190
enum RMW_PUBLIC_TYPE rmw_qos_durability_policy_t
189191
{
190192
RMW_QOS_POLICY_DURABILITY_SYSTEM_DEFAULT,
191193
RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL,
192-
RMW_QOS_POLICY_DURABILITY_VOLATILE
194+
RMW_QOS_POLICY_DURABILITY_VOLATILE,
195+
RMW_QOS_POLICY_DURABILITY_UNKNOWN
193196
};
194197

195198
/// ROS MiddleWare quality of service profile.

0 commit comments

Comments
 (0)