Skip to content

Commit

Permalink
Intra-process subscriber should use RMW actual qos. (#913) (#914)
Browse files Browse the repository at this point in the history
* Intra-process subscriber should use RMW actual qos. (#913)

Signed-off-by: Todd Malsbary <[email protected]>
  • Loading branch information
malsbat authored and ivanpauno committed Nov 25, 2019
1 parent 88a342d commit 59e7bbb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
9 changes: 5 additions & 4 deletions rclcpp/include/rclcpp/subscription.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,16 @@ class Subscription : public SubscriptionBase
using rclcpp::detail::resolve_intra_process_buffer_type;

// Check if the QoS is compatible with intra-process.
if (qos.get_rmw_qos_profile().history == RMW_QOS_POLICY_HISTORY_KEEP_ALL) {
rmw_qos_profile_t qos_profile = get_actual_qos().get_rmw_qos_profile();
if (qos_profile.history == RMW_QOS_POLICY_HISTORY_KEEP_ALL) {
throw std::invalid_argument(
"intraprocess communication is not allowed with keep all history qos policy");
}
if (qos.get_rmw_qos_profile().depth == 0) {
if (qos_profile.depth == 0) {
throw std::invalid_argument(
"intraprocess communication is not allowed with 0 depth qos policy");
}
if (qos.get_rmw_qos_profile().durability != RMW_QOS_POLICY_DURABILITY_VOLATILE) {
if (qos_profile.durability != RMW_QOS_POLICY_DURABILITY_VOLATILE) {
throw std::invalid_argument(
"intraprocess communication allowed only with volatile durability");
}
Expand All @@ -149,7 +150,7 @@ class Subscription : public SubscriptionBase
options.get_allocator(),
context,
this->get_topic_name(), // important to get like this, as it has the fully-qualified name
qos.get_rmw_qos_profile(),
qos_profile,
resolve_intra_process_buffer_type(options.intra_process_buffer_type, callback)
);
TRACEPOINT(
Expand Down
4 changes: 0 additions & 4 deletions rclcpp/test/test_subscription.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,6 @@ static std::vector<TestParameters> invalid_qos_profiles()
TestParameters(
rclcpp::QoS(rclcpp::KeepAll()),
"keep_all_qos"));
parameters.push_back(
TestParameters(
rclcpp::QoS(rclcpp::KeepLast(0)),
"keep_last_zero_depth_qos"));

return parameters;
}
Expand Down

0 comments on commit 59e7bbb

Please sign in to comment.