Skip to content

Commit

Permalink
Merge commit '3739a0f1bceaed7e923d8f5d25b9db1f24f1d1fc'
Browse files Browse the repository at this point in the history
  • Loading branch information
yellowhatter committed Jan 13, 2025
2 parents 89735b1 + 3739a0f commit 1625212
Show file tree
Hide file tree
Showing 11 changed files with 180 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
if: ${{ matrix.BUILD_TYPE == 'source' }}
- name: Install Coverage Tools
if: ${{ matrix.BUILD_TYPE == 'binary' }}
run: sudo apt update && sudo apt install -y python3-colcon-coveragepy-result python3-colcon-lcov-result lcov
run: sudo apt update && sudo apt upgrade -y && sudo apt install -y python3-colcon-coveragepy-result python3-colcon-lcov-result lcov
- name: Build and run tests
id: action-ros-ci
uses: ros-tooling/[email protected]
Expand Down
76 changes: 73 additions & 3 deletions rmw_zenoh_cpp/config/DEFAULT_RMW_ZENOH_ROUTER_CONFIG.json5
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,15 @@

/// Which endpoints to connect to. E.g. tcp/localhost:7447.
/// By configuring the endpoints, it is possible to tell zenoh which router/peer to connect to at startup.
///
/// For TCP/UDP on Linux, it is possible additionally specify the interface to be connected to:
/// E.g. tcp/192.168.0.1:7447#iface=eth0, for connect only if the IP address is reachable via the interface eth0
///
/// It is also possible to specify a priority range and/or a reliability setting to be used on the link.
/// For example `tcp/localhost?prio=6-7;rel=0` assigns priorities "data_low" and "background" to the established link.
///
/// For TCP and TLS links, it is possible to specify the TCP buffer sizes:
/// E.g. tcp/192.168.0.1:7447#so_sndbuf=65000;so_rcvbuf=65000
connect: {
/// timeout waiting for all endpoints connected (0: no retry, -1: infinite timeout)
/// Accepts a single value (e.g. timeout_ms: 0)
Expand Down Expand Up @@ -52,8 +59,15 @@
/// Which endpoints to listen on. E.g. tcp/0.0.0.0:7447.
/// By configuring the endpoints, it is possible to tell zenoh which are the endpoints that other routers,
/// peers, or client can use to establish a zenoh session.
///
/// For TCP/UDP on Linux, it is possible additionally specify the interface to be listened to:
/// E.g. tcp/0.0.0.0:7447#iface=eth0, for listen connection only on eth0
///
/// It is also possible to specify a priority range and/or a reliability setting to be used on the link.
/// For example `tcp/localhost?prio=6-7;rel=0` assigns priorities "data_low" and "background" to the established link.
///
/// For TCP and TLS links, it is possible to specify the TCP buffer sizes:
/// E.g. tcp/192.168.0.1:7447#so_sndbuf=65000;so_rcvbuf=65000
listen: {
/// timeout waiting for all listen endpoints (0: no retry, -1: infinite timeout)
/// Accepts a single value (e.g. timeout_ms: 0)
Expand Down Expand Up @@ -87,7 +101,18 @@
period_increase_factor: 2,
},
},

/// Configure the session open behavior.
open: {
/// Configure the conditions to be met before session open returns.
return_conditions: {
/// Session open waits to connect to scouted peers and routers before returning.
/// When set to false, first publications and queries after session open from peers may be lost.
connect_scouted: true,
/// Session open waits to receive initial declares from connected peers before returning.
/// Setting to false may cause extra traffic at startup from peers.
declares: true,
},
},
/// Configure the scouting mechanisms and their behaviours
scouting: {
/// In client mode, the period in milliseconds dedicated to scouting for a router before failing.
Expand Down Expand Up @@ -168,6 +193,27 @@
},
},

// /// Overwrite QoS options for Zenoh messages by key expression (ignores Zenoh API QoS config for overwritten values)
// qos: {
// /// Overwrite QoS options for PUT and DELETE messages
// publication: [
// {
// /// PUT and DELETE messages on key expressions that are included by these key expressions
// /// will have their QoS options overwritten by the given config.
// key_exprs: ["demo/**", "example/key"],
// /// Configurations that will be applied on the publisher.
// /// Options that are supplied here will overwrite the configuration given in Zenoh API
// config: {
// congestion_control: "block",
// priority: "data_high",
// express: true,
// reliability: "best_effort",
// allowed_destination: "remote",
// },
// },
// ],
// },

// /// The declarations aggregation strategy.
// aggregation: {
// /// A list of key-expressions for which all included subscribers will be aggregated into.
Expand Down Expand Up @@ -209,6 +255,7 @@
// "messages": [
// "put", "delete", "declare_subscriber",
// "query", "reply", "declare_queryable",
// "liveliness_token", "liveliness_query", "declare_liveliness_subscriber",
// ],
// "flows":["egress","ingress"],
// "permission": "allow",
Expand Down Expand Up @@ -293,6 +340,8 @@
transport: {
unicast: {
/// Timeout in milliseconds when opening a link
open_timeout: 10000,
/// Timeout in milliseconds when accepting a link
accept_timeout: 10000,
/// Maximum number of zenoh session in pending state while accepting
accept_pending: 100,
Expand Down Expand Up @@ -395,6 +444,8 @@
drop: {
/// The maximum time in microseconds to wait for an available batch before dropping a droppable message if still no batch is available.
wait_before_drop: 1000,
/// The maximum deadline limit for multi-fragment messages.
max_wait_before_drop_fragments: 50000,
},
/// Behavior pushing CongestionControl::Block messages to the queue.
block: {
Expand Down Expand Up @@ -447,10 +498,29 @@
connect_certificate: null,
// Whether or not to verify the matching between hostname/dns and certificate when connecting,
// if set to false zenoh will disregard the common names of the certificates when verifying servers.
// This could be dangerous because your CA can have signed a server cert for foo.com, that's later being used to host a server at baz.com. If you wan't your
// ca to verify that the server at baz.com is actually baz.com, let this be true (default).
// This could be dangerous because your CA can have signed a server cert for foo.com, that's later being used to host a server at baz.com.
// If you want your ca to verify that the server at baz.com is actually baz.com, let this be true (default).
verify_name_on_connect: true,
// Whether or not to close links when remote certificates expires.
// If set to true, links that require certificates (tls/quic) will automatically disconnect when the time of expiration of the remote certificate chain is reached
// note that mTLS (client authentication) is required for a listener to disconnect a client on expiration
close_link_on_expiration: false,
/// Optional configuration for TCP system buffers sizes for TLS links
///
/// Configure TCP read buffer size (bytes)
// so_rcvbuf: 123456,
/// Configure TCP write buffer size (bytes)
// so_sndbuf: 123456,
},
// // Configure optional TCP link specific parameters
// tcp: {
// /// Optional configuration for TCP system buffers sizes for TCP links
// ///
// /// Configure TCP read buffer size (bytes)
// // so_rcvbuf: 123456,
// /// Configure TCP write buffer size (bytes)
// // so_sndbuf: 123456,
// }
},
/// Shared memory configuration.
/// NOTE: shared memory can be used only if zenoh is compiled with "shared-memory" feature, otherwise
Expand Down
76 changes: 73 additions & 3 deletions rmw_zenoh_cpp/config/DEFAULT_RMW_ZENOH_SESSION_CONFIG.json5
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,15 @@

/// Which endpoints to connect to. E.g. tcp/localhost:7447.
/// By configuring the endpoints, it is possible to tell zenoh which router/peer to connect to at startup.
///
/// For TCP/UDP on Linux, it is possible additionally specify the interface to be connected to:
/// E.g. tcp/192.168.0.1:7447#iface=eth0, for connect only if the IP address is reachable via the interface eth0
///
/// It is also possible to specify a priority range and/or a reliability setting to be used on the link.
/// For example `tcp/localhost?prio=6-7;rel=0` assigns priorities "data_low" and "background" to the established link.
///
/// For TCP and TLS links, it is possible to specify the TCP buffer sizes:
/// E.g. tcp/192.168.0.1:7447#so_sndbuf=65000;so_rcvbuf=65000
connect: {
/// timeout waiting for all endpoints connected (0: no retry, -1: infinite timeout)
/// Accepts a single value (e.g. timeout_ms: 0)
Expand Down Expand Up @@ -54,8 +61,15 @@
/// Which endpoints to listen on. E.g. tcp/0.0.0.0:7447.
/// By configuring the endpoints, it is possible to tell zenoh which are the endpoints that other routers,
/// peers, or client can use to establish a zenoh session.
///
/// For TCP/UDP on Linux, it is possible additionally specify the interface to be listened to:
/// E.g. tcp/0.0.0.0:7447#iface=eth0, for listen connection only on eth0
///
/// It is also possible to specify a priority range and/or a reliability setting to be used on the link.
/// For example `tcp/localhost?prio=6-7;rel=0` assigns priorities "data_low" and "background" to the established link.
///
/// For TCP and TLS links, it is possible to specify the TCP buffer sizes:
/// E.g. tcp/192.168.0.1:7447#so_sndbuf=65000;so_rcvbuf=65000
listen: {
/// timeout waiting for all listen endpoints (0: no retry, -1: infinite timeout)
/// Accepts a single value (e.g. timeout_ms: 0)
Expand Down Expand Up @@ -92,7 +106,18 @@
period_increase_factor: 2,
},
},

/// Configure the session open behavior.
open: {
/// Configure the conditions to be met before session open returns.
return_conditions: {
/// Session open waits to connect to scouted peers and routers before returning.
/// When set to false, first publications and queries after session open from peers may be lost.
connect_scouted: true,
/// Session open waits to receive initial declares from connected peers before returning.
/// Setting to false may cause extra traffic at startup from peers.
declares: true,
},
},
/// Configure the scouting mechanisms and their behaviours
scouting: {
/// In client mode, the period in milliseconds dedicated to scouting for a router before failing.
Expand Down Expand Up @@ -171,6 +196,27 @@
},
},

// /// Overwrite QoS options for Zenoh messages by key expression (ignores Zenoh API QoS config for overwritten values)
// qos: {
// /// Overwrite QoS options for PUT and DELETE messages
// publication: [
// {
// /// PUT and DELETE messages on key expressions that are included by these key expressions
// /// will have their QoS options overwritten by the given config.
// key_exprs: ["demo/**", "example/key"],
// /// Configurations that will be applied on the publisher.
// /// Options that are supplied here will overwrite the configuration given in Zenoh API
// config: {
// congestion_control: "block",
// priority: "data_high",
// express: true,
// reliability: "best_effort",
// allowed_destination: "remote",
// },
// },
// ],
// },

// /// The declarations aggregation strategy.
// aggregation: {
// /// A list of key-expressions for which all included subscribers will be aggregated into.
Expand Down Expand Up @@ -212,6 +258,7 @@
// "messages": [
// "put", "delete", "declare_subscriber",
// "query", "reply", "declare_queryable",
// "liveliness_token", "liveliness_query", "declare_liveliness_subscriber",
// ],
// "flows":["egress","ingress"],
// "permission": "allow",
Expand Down Expand Up @@ -296,6 +343,8 @@
transport: {
unicast: {
/// Timeout in milliseconds when opening a link
open_timeout: 10000,
/// Timeout in milliseconds when accepting a link
accept_timeout: 10000,
/// Maximum number of zenoh session in pending state while accepting
accept_pending: 100,
Expand Down Expand Up @@ -398,6 +447,8 @@
drop: {
/// The maximum time in microseconds to wait for an available batch before dropping a droppable message if still no batch is available.
wait_before_drop: 1000,
/// The maximum deadline limit for multi-fragment messages.
max_wait_before_drop_fragments: 50000,
},
/// Behavior pushing CongestionControl::Block messages to the queue.
block: {
Expand Down Expand Up @@ -450,10 +501,29 @@
connect_certificate: null,
// Whether or not to verify the matching between hostname/dns and certificate when connecting,
// if set to false zenoh will disregard the common names of the certificates when verifying servers.
// This could be dangerous because your CA can have signed a server cert for foo.com, that's later being used to host a server at baz.com. If you wan't your
// ca to verify that the server at baz.com is actually baz.com, let this be true (default).
// This could be dangerous because your CA can have signed a server cert for foo.com, that's later being used to host a server at baz.com.
// If you want your ca to verify that the server at baz.com is actually baz.com, let this be true (default).
verify_name_on_connect: true,
// Whether or not to close links when remote certificates expires.
// If set to true, links that require certificates (tls/quic) will automatically disconnect when the time of expiration of the remote certificate chain is reached
// note that mTLS (client authentication) is required for a listener to disconnect a client on expiration
close_link_on_expiration: false,
/// Optional configuration for TCP system buffers sizes for TLS links
///
/// Configure TCP read buffer size (bytes)
// so_rcvbuf: 123456,
/// Configure TCP write buffer size (bytes)
// so_sndbuf: 123456,
},
// // Configure optional TCP link specific parameters
// tcp: {
// /// Optional configuration for TCP system buffers sizes for TCP links
// ///
// /// Configure TCP read buffer size (bytes)
// // so_rcvbuf: 123456,
// /// Configure TCP write buffer size (bytes)
// // so_sndbuf: 123456,
// }
},
/// Shared memory configuration.
/// NOTE: shared memory can be used only if zenoh is compiled with "shared-memory" feature, otherwise
Expand Down
4 changes: 2 additions & 2 deletions rmw_zenoh_cpp/src/detail/graph_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ void GraphCache::parse_put(
range.first, range.second,
[entity](const std::pair<std::string, GraphNodePtr> & node_it)
{
// Match nodes if their zenoh sesion and node ids match.
// Match nodes if their zenoh session and node ids match.
return entity->zid() == node_it.second->zid_ && entity->nid() == node_it.second->nid_;
});
if (node_it == range.second) {
Expand Down Expand Up @@ -573,7 +573,7 @@ void GraphCache::parse_del(
range.first, range.second,
[entity](const std::pair<std::string, GraphNodePtr> & node_it)
{
// Match nodes if their zenoh sesion and node ids match.
// Match nodes if their zenoh session and node ids match.
return entity->zid() == node_it.second->zid_ && entity->nid() == node_it.second->nid_;
});
if (node_it == range.second) {
Expand Down
2 changes: 1 addition & 1 deletion rmw_zenoh_cpp/src/detail/graph_cache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ struct GraphNode
TopicMap pubs_ = {};
TopicMap subs_ = {};

// Entires for service/client.
// Entries for service/client.
TopicMap clients_ = {};
TopicMap services_ = {};
};
Expand Down
4 changes: 2 additions & 2 deletions rmw_zenoh_cpp/src/detail/liveliness_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ struct TopicInfo
};

///=============================================================================
/// Retuns the keyexpr for liveliness subscription.
/// Returns the keyexpr for liveliness subscription.
std::string subscription_token(size_t domain_id);

///=============================================================================
Expand Down Expand Up @@ -96,7 +96,7 @@ enum class EntityType : uint8_t
* <namespace> - The ROS namespace for this entity. If the namespace is absolute, this function will add in an _ for later parsing reasons.
* <nodename> - The ROS node name for this entity.
*
* For entities with topic infomation, the liveliness token keyexpr have additional fields:
* For entities with topic information, the liveliness token keyexpr have additional fields:
*
* <ADMIN_SPACE>/<domainid>/<zid>/<id>/<entity>/<namespace>/<nodename>/<topic_name>/<topic_type>/<topic_type_hash>/<topic_qos>
* <topic_name> - The ROS topic name for this entity.
Expand Down
4 changes: 2 additions & 2 deletions rmw_zenoh_cpp/src/detail/ordered_hash.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1457,7 +1457,7 @@ class ordered_hash : private Hash, private KeyEqual {
#endif

/*
* The insertion didn't happend at the end of the m_values container,
* The insertion didn't happened at the end of the m_values container,
* we need to shift the indexes in m_buckets_data.
*/
if (index_insert_position != m_values.size() - 1) {
Expand Down Expand Up @@ -1661,7 +1661,7 @@ class ordered_hash : private Hash, private KeyEqual {
static constexpr float REHASH_ON_HIGH_NB_PROBES__MIN_LOAD_FACTOR = 0.15f;

/**
* Protocol version currenlty used for serialization.
* Protocol version currently used for serialization.
*/
static const slz_size_type SERIALIZATION_PROTOCOL_VERSION = 1;

Expand Down
2 changes: 1 addition & 1 deletion rmw_zenoh_cpp/src/detail/rmw_wait_set_data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct rmw_wait_set_data_t
// there isn't a race in rmw_wait(). That could happen because of the following sequence:
//
// 1. Without taking a lock, rmw_wait() checks if any of the entities in the wait_set are ready,
// and if not attachs the condition_variable to it.
// and if not attaches the condition_variable to it.
// 2. It then takes the lock, and sleeps on the condition_variable.
//
// However, doing step 1 takes time, and checks in a particular order: guard_conditions, events,
Expand Down
2 changes: 1 addition & 1 deletion rmw_zenoh_cpp/src/detail/zenoh_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ std::optional<zenoh::Config> get_z_config(const ConfigurableEntity & entity);
/// @details The behavior is as follows:
/// - If not set or 0, the max value is returned.
/// - If less than 0, std::nullopt is returned.
/// - Else value of environemnt variable is returned.
/// - Else value of environment variable is returned.
/// @return The number of times to try connecting to a zenoh router and
/// std::nullopt if establishing a connection to a router is not required.
std::optional<uint64_t> zenoh_router_check_attempts();
Expand Down
Loading

0 comments on commit 1625212

Please sign in to comment.