Allow using shortened channel names in foxglove_websocket
This makes the websocket server's defaults consistent with log_to_mcap.
By using shortened channel names, we make ti easier to reuse layouts
across nodes (e.g., this way, the /piX prefix will be removed for
the channels available on the current pi being debugged).
Change-Id: Ief1f0c5a8932425017b4718ec9f9d2bae1de2c72
Signed-off-by: James Kuszmaul <jabukuszmaul@gmail.com>
diff --git a/aos/util/foxglove_websocket.cc b/aos/util/foxglove_websocket.cc
index 715ba13..77dca20 100644
--- a/aos/util/foxglove_websocket.cc
+++ b/aos/util/foxglove_websocket.cc
@@ -11,6 +11,10 @@
"with a read_method of PIN (see aos/configuration.fbs; PIN is an "
"enum value). Having this enabled will cause foxglove to consume "
"extra shared memory resources.");
+DEFINE_bool(
+ canonical_channel_names, false,
+ "If set, use full channel names; by default, will shorten names to be the "
+ "shortest possible version of the name (e.g., /aos instead of /pi/aos).");
int main(int argc, char *argv[]) {
gflags::SetUsageMessage(
@@ -53,7 +57,10 @@
: aos::FoxgloveWebsocketServer::Serialization::kJson,
FLAGS_fetch_pinned_channels
? aos::FoxgloveWebsocketServer::FetchPinnedChannels::kYes
- : aos::FoxgloveWebsocketServer::FetchPinnedChannels::kNo);
+ : aos::FoxgloveWebsocketServer::FetchPinnedChannels::kNo,
+ FLAGS_canonical_channel_names
+ ? aos::FoxgloveWebsocketServer::CanonicalChannelNames::kCanonical
+ : aos::FoxgloveWebsocketServer::CanonicalChannelNames::kShortened);
event_loop.Run();
}