Skip to content

Commit

Permalink
Add function to get publisher actual qos settings (ros2#169)
Browse files Browse the repository at this point in the history
* 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]>
Signed-off-by: Devin Bonnie <[email protected]>
  • Loading branch information
ivanpauno authored and dabonnie committed Apr 2, 2019
1 parent 571098b commit a95453e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
26 changes: 26 additions & 0 deletions rmw/include/rmw/rmw.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,32 @@ rmw_publisher_count_matched_subscriptions(
const rmw_publisher_t * publisher,
size_t * subscription_count);

/// Retrieve the actual qos settings of the publisher.
/**
* Query the underlying middleware to determine the qos settings
* of the publisher.
* The actual configuration applied when using RMW_*_SYSTEM_DEFAULT
* can only be resolved after the creation of the publisher, and it
* depends on the underlying rmw implementation.
* If the underlying setting in use can't be represented in ROS terms,
* it will be set to RMW_*_UNKNOWN.
* The value of avoid_ros_namespace_conventions field is not resolved
* with this function. The rcl function rcl_publisher_get_actual_qos
* resolves it.
*
* \param[in] publisher the publisher object to inspect
* \param[out] qos the actual qos settings
* \return `RMW_RET_OK` if successful, or
* \return `RMW_RET_INVALID_ARGUMENT` if either argument is null, or
* \return `RMW_RET_ERROR` if an unexpected error occurs.
*/
RMW_PUBLIC
RMW_WARN_UNUSED
rmw_ret_t
rmw_publisher_get_actual_qos(
const rmw_publisher_t * publisher,
rmw_qos_profile_t * qos);

/// Publish an already serialized message.
/**
* The publisher must already be registered with the correct message type
Expand Down
9 changes: 6 additions & 3 deletions rmw/include/rmw/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,21 +184,24 @@ enum RMW_PUBLIC_TYPE rmw_qos_reliability_policy_t
{
RMW_QOS_POLICY_RELIABILITY_SYSTEM_DEFAULT,
RMW_QOS_POLICY_RELIABILITY_RELIABLE,
RMW_QOS_POLICY_RELIABILITY_BEST_EFFORT
RMW_QOS_POLICY_RELIABILITY_BEST_EFFORT,
RMW_QOS_POLICY_RELIABILITY_UNKNOWN
};

enum RMW_PUBLIC_TYPE rmw_qos_history_policy_t
{
RMW_QOS_POLICY_HISTORY_SYSTEM_DEFAULT,
RMW_QOS_POLICY_HISTORY_KEEP_LAST,
RMW_QOS_POLICY_HISTORY_KEEP_ALL
RMW_QOS_POLICY_HISTORY_KEEP_ALL,
RMW_QOS_POLICY_HISTORY_UNKNOWN
};

enum RMW_PUBLIC_TYPE rmw_qos_durability_policy_t
{
RMW_QOS_POLICY_DURABILITY_SYSTEM_DEFAULT,
RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL,
RMW_QOS_POLICY_DURABILITY_VOLATILE
RMW_QOS_POLICY_DURABILITY_VOLATILE,
RMW_QOS_POLICY_DURABILITY_UNKNOWN
};

enum RMW_PUBLIC_TYPE rmw_qos_liveliness_policy_t
Expand Down

0 comments on commit a95453e

Please sign in to comment.