From c41216376a0488c9d6a6f55af2b53ba06541d4b4 Mon Sep 17 00:00:00 2001 From: Benjamin Chung Date: Sat, 14 Jun 2025 06:34:37 +0000 Subject: [PATCH] Add an explicatory comment to Zenoh publisher's handling of the uOrb topic number (or lack thereof) --- src/modules/zenoh/publishers/uorb_publisher.hpp | 2 +- src/modules/zenoh/zenoh_config.cpp | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/modules/zenoh/publishers/uorb_publisher.hpp b/src/modules/zenoh/publishers/uorb_publisher.hpp index 6a90d435d5..110cbea8eb 100644 --- a/src/modules/zenoh/publishers/uorb_publisher.hpp +++ b/src/modules/zenoh/publishers/uorb_publisher.hpp @@ -56,7 +56,7 @@ public: _cdr_ops(ops) { if (instance <= 0) { // default (<0) or =0 - _uorb_sub = orb_subscribe(meta); + _uorb_sub = orb_subscribe(meta); // orb_subscribe subscribes to the 0th/first instance by default } else { // otherwise _uorb_sub = orb_subscribe_multi(meta, instance); diff --git a/src/modules/zenoh/zenoh_config.cpp b/src/modules/zenoh/zenoh_config.cpp index 8a0d3913e7..1a88194348 100644 --- a/src/modules/zenoh/zenoh_config.cpp +++ b/src/modules/zenoh/zenoh_config.cpp @@ -234,21 +234,28 @@ int Zenoh_Config::cli(int argc, char *argv[]) { if (argc == 1) { dump_config(); + } else if (argc == 2) { if (strcmp(argv[1], "delete") == 0) { printf("The type of resource to be deleted (publisher/subscriber) must be specified.\n"); + } else if (strcmp(argv[1], "add") == 0) { printf("The type of resource to be added (publisher/subscriber) must be specified.\n"); + } else { printf("Unrecognized command\n"); } + } else if (argc == 3) { if (strcmp(argv[1], "net") == 0) { SetNetworkConfig(argv[2], 0); + } else if (strcmp(argv[1], "delete") == 0) { printf("The name of the resource to be deleted needs to be specified.\n"); + } else if (strcmp(argv[1], "add") == 0) { printf("The name of the Zenoh/uOrb topic pair to be linked needs to be specified.\n"); + } else { printf("Unrecognized command\n"); } @@ -256,6 +263,7 @@ int Zenoh_Config::cli(int argc, char *argv[]) } else if (argc == 4) { if (strcmp(argv[1], "net") == 0) { SetNetworkConfig(argv[2], argv[3]); + } else if (strcmp(argv[1], "delete") == 0) { if (strcmp(argv[2], "publisher") == 0) { int res = DeletePubSub(argv[3], ZENOH_PUB_CONFIG_PATH); @@ -270,12 +278,15 @@ int Zenoh_Config::cli(int argc, char *argv[]) if (res < 0) { printf("Could not delete subscriber topic %s\n", argv[3]); } + } else { printf("Unrecognized command\n"); } + } else { printf("Unrecognized command\n"); } + } else if (argc >= 5) { if (strcmp(argv[1], "add") == 0) { if (strcmp(argv[2], "publisher") == 0) { @@ -312,9 +323,11 @@ int Zenoh_Config::cli(int argc, char *argv[]) } else { printf("Could not add %s -> uORB %s to subscribers\n", argv[3], argv[4]); } + } else { printf("Unrecognized command\n"); } + } else { printf("Unrecognized command\n"); }