Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support basic QoS settings #91

Merged
merged 36 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
1a3b459
Create querying subscriber if qos is transient local
Yadunund Jan 11, 2024
3f5a607
Update graph cache and introspection methods with qos
Yadunund Jan 11, 2024
eed1d12
Initialize pubcache only if durability is transient local
Yadunund Jan 11, 2024
32c788b
Set publisher congestion when appropriate
Yadunund Jan 11, 2024
eb91c0e
Make liveliness tokens more compact
Yadunund Jan 11, 2024
21a0d8c
Fix rmw_publisher_count_matched_subscriptions
Yadunund Jan 11, 2024
4e86b10
Explictly map qos settings
Yadunund Jan 15, 2024
9d49ef3
Reuse qos_profile_check_compatibility() from rmw_dds_common
Yadunund Jan 15, 2024
b7a27be
Make transient_local work
Yadunund Jan 16, 2024
48bb3e5
Close zenoh session in rmw_shutdown
Yadunund Jan 18, 2024
2099b8b
store adapted_qos_profiles in pub/sub/client/service
Yadunund Jan 18, 2024
7d7df28
Implement rmw_subscription_count_matched_publishers
Yadunund Jan 18, 2024
cba604f
Use optional for pubcache and set consolidation for querying sub
Yadunund Jan 18, 2024
762668b
Set default consolidation for client query
Yadunund Jan 18, 2024
594bb97
Switch to non-blocking channel for liveliness_get
Yadunund Jan 18, 2024
804e915
Resolve merge conflicts after fixes to services
Yadunund Jan 19, 2024
02fee09
Make shm manager optional
Yadunund Jan 19, 2024
446aec3
Cleanup
Yadunund Jan 19, 2024
bf7727b
Merge branch 'rolling' into yadu/qos-durability
Yadunund Jan 23, 2024
e0a1de1
Merge branch 'rolling' into yadu/qos-durability
Yadunund Jan 23, 2024
5314de6
Explicitly ensure subscription depth is minimum 1
Yadunund Jan 23, 2024
a9b4245
Build zenoh-c with shm feature but do not enable it in the session co…
Yadunund Jan 24, 2024
cd02957
Always drop shmbuf
Yadunund Jan 24, 2024
34f2623
Add comment on why timestamping is enabled in zenoh configs
Yadunund Jan 24, 2024
52d16cb
Rely on strtol to get queue depth
Yadunund Jan 24, 2024
a664ac2
Resolve merge conflicts with rolling
Yadunund Jan 25, 2024
5c2b179
Merge branch 'rolling' into yadu/qos-durability
Yadunund Jan 26, 2024
2ad493d
Stick to blocking channel for liveliness get
Yadunund Jan 29, 2024
1298abd
Define default history depth
Yadunund Jan 31, 2024
66494e3
Update rmw_zenoh_cpp/src/rmw_zenoh.cpp
Yadunund Feb 7, 2024
a807343
Update rmw_zenoh_cpp/src/rmw_zenoh.cpp
Yadunund Feb 7, 2024
c807b34
Add example for liveliness keyexpr
Yadunund Feb 7, 2024
0098371
Simplify split_keyexpr
Yadunund Feb 7, 2024
e85d45d
Increase and justify default depth
Yadunund Feb 7, 2024
966a043
Update rmw_zenoh_cpp/src/detail/liveliness_utils.cpp
Yadunund Feb 7, 2024
d088360
Fix minor cpplint problems.
clalancette Feb 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions rmw_zenoh_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ find_package(rcutils REQUIRED)
find_package(rosidl_typesupport_fastrtps_c REQUIRED)
find_package(rosidl_typesupport_fastrtps_cpp REQUIRED)
find_package(rmw REQUIRED)
find_package(rmw_dds_common REQUIRED)
clalancette marked this conversation as resolved.
Show resolved Hide resolved
find_package(zenoh_c_vendor REQUIRED)
find_package(zenohc REQUIRED)

Expand Down Expand Up @@ -57,6 +58,7 @@ target_link_libraries(rmw_zenoh_cpp
rosidl_typesupport_fastrtps_c::rosidl_typesupport_fastrtps_c
rosidl_typesupport_fastrtps_cpp::rosidl_typesupport_fastrtps_cpp
rmw::rmw
rmw_dds_common::rmw_dds_common_library
zenohc::lib
)

Expand Down
4 changes: 3 additions & 1 deletion rmw_zenoh_cpp/config/DEFAULT_RMW_ZENOH_ROUTER_CONFIG.json5
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@
timestamping: {
/// Whether data messages should be timestamped if not already.
/// Accepts a single boolean value or different values for router, peer and client.
enabled: { router: true, peer: false, client: false },
/// PublicationCache which is required for transient_local durability
/// only works when time-stamping is enabled.
enabled: { router: true, peer: true, client: false },
clalancette marked this conversation as resolved.
Show resolved Hide resolved
/// Whether data messages with timestamps in the future should be dropped or not.
/// If set to false (default), messages with timestamps in the future are retimestamped.
/// Timestamps are ignored if timestamping is disabled.
Expand Down
6 changes: 4 additions & 2 deletions rmw_zenoh_cpp/config/DEFAULT_RMW_ZENOH_SESSION_CONFIG.json5
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@
timestamping: {
/// Whether data messages should be timestamped if not already.
/// Accepts a single boolean value or different values for router, peer and client.
enabled: { router: true, peer: false, client: false },
/// PublicationCache which is required for transient_local durability
/// only works when time-stamping is enabled.
enabled: { router: true, peer: true, client: false },
/// Whether data messages with timestamps in the future should be dropped or not.
/// If set to false (default), messages with timestamps in the future are retimestamped.
/// Timestamps are ignored if timestamping is disabled.
Expand Down Expand Up @@ -234,7 +236,7 @@
},
/// Shared memory configuration
shared_memory: {
enabled: true, //
enabled: false,
},
/// Access control configuration
auth: {
Expand Down
1 change: 1 addition & 0 deletions rmw_zenoh_cpp/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<depend>rosidl_typesupport_fastrtps_c</depend>
<depend>rosidl_typesupport_fastrtps_cpp</depend>
<depend>rmw</depend>
<depend>rmw_dds_common</depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
Expand Down
56 changes: 53 additions & 3 deletions rmw_zenoh_cpp/src/detail/graph_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "rmw/validate_node_name.h"

#include "graph_cache.hpp"
#include "rmw_data_types.hpp"

///=============================================================================
using Entity = liveliness::Entity;
Expand Down Expand Up @@ -679,6 +680,46 @@ rmw_ret_t GraphCache::get_topic_names_and_types(
return fill_names_and_types(graph_topics_, allocator, topic_names_and_types);
}

///=============================================================================
rmw_ret_t GraphCache::publisher_count_matched_subscriptions(
const rmw_publisher_t * publisher,
size_t * subscription_count)
{
// TODO(Yadunund): Check if QoS settings also match.
*subscription_count = 0;
GraphNode::TopicMap::const_iterator topic_it = graph_topics_.find(publisher->topic_name);
if (topic_it != graph_topics_.end()) {
rmw_publisher_data_t * pub_data = static_cast<rmw_publisher_data_t *>(publisher->data);
GraphNode::TopicDataMap::const_iterator topic_data_it = topic_it->second.find(
pub_data->type_support->get_name());
if (topic_data_it != topic_it->second.end()) {
*subscription_count = topic_data_it->second->stats_.sub_count_;
}
}

return RMW_RET_OK;
}

///=============================================================================
rmw_ret_t GraphCache::subscription_count_matched_publishers(
const rmw_subscription_t * subscription,
size_t * publisher_count)
{
// TODO(Yadunund): Check if QoS settings also match.
*publisher_count = 0;
GraphNode::TopicMap::const_iterator topic_it = graph_topics_.find(subscription->topic_name);
if (topic_it != graph_topics_.end()) {
rmw_subscription_data_t * sub_data = static_cast<rmw_subscription_data_t *>(subscription->data);
GraphNode::TopicDataMap::const_iterator topic_data_it = topic_it->second.find(
sub_data->type_support->get_name());
if (topic_data_it != topic_it->second.end()) {
*publisher_count = topic_data_it->second->stats_.pub_count_;
}
}

return RMW_RET_OK;
}

///=============================================================================
rmw_ret_t GraphCache::get_service_names_and_types(
rcutils_allocator_t * allocator,
Expand Down Expand Up @@ -893,7 +934,7 @@ rmw_ret_t GraphCache::get_entities_info_by_topic(
entity_type == EntityType::Publisher ? nodes[i]->pubs_ :
nodes[i]->subs_;
const GraphNode::TopicDataMap & topic_data_map = entity_map.find(topic_name)->second;
for (const auto & [topic_data, _] : topic_data_map) {
for (const auto & [topic_type, topic_data] : topic_data_map) {
rmw_topic_endpoint_info_t & endpoint_info = endpoints_info->info_array[i];
endpoint_info = rmw_get_zero_initialized_topic_endpoint_info();

Expand All @@ -915,7 +956,7 @@ rmw_ret_t GraphCache::get_entities_info_by_topic(

ret = rmw_topic_endpoint_info_set_topic_type(
&endpoint_info,
_demangle_if_ros_type(topic_data).c_str(),
_demangle_if_ros_type(topic_type).c_str(),
allocator);
if (RMW_RET_OK != ret) {
return ret;
Expand All @@ -927,7 +968,16 @@ rmw_ret_t GraphCache::get_entities_info_by_topic(
if (RMW_RET_OK != ret) {
return ret;
}
// TODO(Yadunund): Set type_hash, qos_profile, gid.

ret = rmw_topic_endpoint_info_set_qos_profile(
&endpoint_info,
&topic_data->info_.qos_
);
if (RMW_RET_OK != ret) {
return ret;
}

// TODO(Yadunund): Set type_hash, gid.
}
}

Expand Down
8 changes: 8 additions & 0 deletions rmw_zenoh_cpp/src/detail/graph_cache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,14 @@ class GraphCache final
bool no_demangle,
rmw_names_and_types_t * topic_names_and_types) const;

rmw_ret_t publisher_count_matched_subscriptions(
const rmw_publisher_t * publisher,
size_t * subscription_count);

rmw_ret_t subscription_count_matched_publishers(
const rmw_subscription_t * subscription,
size_t * publisher_count);

rmw_ret_t get_service_names_and_types(
rcutils_allocator_t * allocator,
rmw_names_and_types_t * service_names_and_types) const;
Expand Down
Loading
Loading