-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanup of bridge args and code (clippy warnings)
- Loading branch information
Showing
9 changed files
with
138 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
use async_liveliness_monitor::LivelinessMonitor; | ||
// | ||
// Copyright (c) 2022 ZettaScale Technology | ||
// | ||
|
@@ -12,6 +11,7 @@ use async_liveliness_monitor::LivelinessMonitor; | |
// Contributors: | ||
// ZettaScale Zenoh Team, <[email protected]> | ||
// | ||
use async_liveliness_monitor::LivelinessMonitor; | ||
use clap::{App, Arg}; | ||
use std::time::{Duration, SystemTime}; | ||
use zenoh::config::{Config, ModeDependentValue}; | ||
|
@@ -47,41 +47,41 @@ fn parse_args() -> (Config, Option<f32>) { | |
// zenoh related arguments: | ||
// | ||
.arg(Arg::from_usage( | ||
r#"-i, --id=[HEX_STRING] \ | ||
r"-i, --id=[HEX_STRING] \ | ||
'The identifier (as an hexadecimal string, with odd number of chars - e.g.: 0A0B23...) that zenohd must use. | ||
WARNING: this identifier must be unique in the system and must be 16 bytes maximum (32 chars)! | ||
If not set, a random UUIDv4 will be used.'"#, | ||
If not set, a random UUIDv4 will be used.'" | ||
)) | ||
.arg(Arg::from_usage( | ||
r#"-m, --mode=[MODE] 'The zenoh session mode.'"#) | ||
r"-m, --mode=[MODE] 'The zenoh session mode.'") | ||
.possible_values(["peer", "client"]) | ||
.default_value("peer") | ||
) | ||
.arg(Arg::from_usage( | ||
r#"-c, --config=[FILE] \ | ||
'The configuration file. Currently, this file must be a valid JSON5 file.'"#, | ||
r"-c, --config=[FILE] \ | ||
'The configuration file. Currently, this file must be a valid JSON5 file.'" | ||
)) | ||
.arg(Arg::from_usage( | ||
r#"-l, --listen=[ENDPOINT]... \ | ||
r"-l, --listen=[ENDPOINT]... \ | ||
'A locator on which this router will listen for incoming sessions. | ||
Repeat this option to open several listeners.'"#, | ||
Repeat this option to open several listeners.'" | ||
), | ||
) | ||
.arg(Arg::from_usage( | ||
r#"-e, --connect=[ENDPOINT]... \ | ||
r"-e, --connect=[ENDPOINT]... \ | ||
'A peer locator this router will try to connect to. | ||
Repeat this option to connect to several peers.'"#, | ||
Repeat this option to connect to several peers.'" | ||
)) | ||
.arg(Arg::from_usage( | ||
r#"--no-multicast-scouting \ | ||
r"--no-multicast-scouting \ | ||
'By default the zenoh bridge listens and replies to UDP multicast scouting messages for being discovered by peers and routers. | ||
This option disables this feature.'"# | ||
This option disables this feature.'" | ||
)) | ||
.arg(Arg::from_usage( | ||
r#"--rest-http-port=[PORT | IP:PORT] \ | ||
r"--rest-http-port=[PORT | IP:PORT] \ | ||
'Configures HTTP interface for the REST API (disabled by default, setting this option enables it). Accepted values:' | ||
- a port number | ||
- a string with format `<local_ip>:<port_number>` (to bind the HTTP server to a specific interface)."# | ||
- a string with format `<local_ip>:<port_number>` (to bind the HTTP server to a specific interface)." | ||
)) | ||
// | ||
// DDS related arguments: | ||
|
@@ -111,35 +111,13 @@ This option is not active by default, unless the "ROS_LOCALHOST_ONLY" environmen | |
|
||
app = app | ||
.arg(Arg::from_usage( | ||
r#"-a, --allow=[String]... 'A regular expression matching the set of 'partition/topic-name' that must be routed via zenoh. By default, all partitions and topics are allowed. | ||
If both '--allow' and '--deny' are set a partition and/or topic will be allowed if it matches only the 'allow' expression. | ||
Repeat this option to configure several topic expressions. These expressions are concatenated with '|'. | ||
Examples of expressions: '.*/TopicA', 'Partition-?/.*', 'cmd_vel|rosout'...'"# | ||
)) | ||
.arg(Arg::from_usage( | ||
r#"--deny=[String]... 'A regular expression matching the set of 'partition/topic-name' that must not be routed via zenoh. By default, no partitions and no topics are denied. | ||
If both '--allow' and '--deny' are set a partition and/or topic will be allowed if it matches only the 'allow' expression. | ||
Repeat this option to configure several topic expressions. These expressions are concatenated with '|'. | ||
Examples of expressions: '.*/TopicA', 'Partition-?/.*', 'cmd_vel|rosout'...'"# | ||
)) | ||
.arg(Arg::from_usage( | ||
r#"--max-frequency=[String]... 'Specifies a maximum frequency of data routing over zenoh for a set of topics. The string must have the format "<regex>=<float>": | ||
- "regex" is a regular expression matching the set of 'partition/topic-name' (same syntax than --allow option) | ||
for which the data (per DDS instance) must be routed at no higher rate than the specified max frequency. | ||
r#"--pub-max-frequency=[String]... 'Specifies a maximum frequency of publications routing over zenoh for a set of Publishers. | ||
The string must have the format "<regex>=<float>": | ||
- "regex" is a regular expression matching a Publisher interface name | ||
- "float" is the maximum frequency in Hertz; if publication rate is higher, downsampling will occur when routing. | ||
Repeat this option to configure several topics expressions with a max frequency.'"# | ||
)) | ||
.arg(Arg::from_usage( | ||
r#"-r, --generalise-sub=[String]... 'A list of key expression to use for generalising subscriptions (usable multiple times).'"# | ||
)) | ||
.arg(Arg::from_usage( | ||
r#"-w, --generalise-pub=[String]... 'A list of key expression to use for generalising publications (usable multiple times).'"# | ||
)) | ||
.arg(Arg::from_usage( | ||
r#"-f, --fwd-discovery 'When set, rather than creating a local route when discovering a local DDS entity, this discovery info is forwarded to the remote plugins/bridges. Those will create the routes, including a replica of the discovered entity.'"# | ||
).alias("forward-discovery") | ||
) | ||
.arg(Arg::from_usage( | ||
r#"--queries-timeout=[float]... 'A float in seconds (default: 5.0 sec) that will be used as a timeout when the bridge | ||
queries any other remote bridge for discovery information and for historical data for TRANSIENT_LOCAL DDS Readers it serves | ||
(i.e. if the query to the remote bridge exceed the timeout, some historical samples might be not routed to the Readers, but the route will not be blocked forever)."# | ||
|
@@ -201,11 +179,7 @@ r#"--watchdog=[PERIOD] 'Experimental!! Run a watchdog thread that monitors the | |
{ | ||
insert_json5!(config, args, "plugins/ros2/shm_enabled", if "dds-enable-shm"); | ||
} | ||
insert_json5!(config, args, "plugins/ros2/allow", for "allow", .collect::<Vec<_>>()); | ||
insert_json5!(config, args, "plugins/ros2/deny", for "deny", .collect::<Vec::<_>>()); | ||
insert_json5!(config, args, "plugins/ros2/max_frequencies", for "max-frequency", .collect::<Vec<_>>()); | ||
insert_json5!(config, args, "plugins/ros2/generalise_pubs", for "generalise-pub", .collect::<Vec<_>>()); | ||
insert_json5!(config, args, "plugins/ros2/generalise_subs", for "generalise-sub", .collect::<Vec<_>>()); | ||
insert_json5!(config, args, "plugins/ros2/pub_max_frequencies", for "pub-max-frequency", .collect::<Vec<_>>()); | ||
insert_json5!(config, args, "plugins/ros2/queries_timeout", if "queries-timeout", .parse::<f64>().unwrap()); | ||
|
||
let watchdog_period = if args.is_present("watchdog") { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.