Automatic reverse-lookup of channel names in Foxglove
This makes it so that if you want to visualize a logfile, then
you will be able to, e.g., refer to "/aos aos.timing.Report"
regardless of what node you are on, without having to alter your
layouts to refer to "/pi1/pose aos.timing.Report". This may end up
causing extra confusion because it masks what the "true" channel name
is, but I expect that defaulting to shorter names will make it easier to
use.
Fix existing layouts that had prefixes hardcoded.
Change-Id: Ic708f48868bbb4b1e60bfef9ebec36100a1763fd
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/util/log_to_mcap.cc b/aos/util/log_to_mcap.cc
index 2e66e67..9a0af48 100644
--- a/aos/util/log_to_mcap.cc
+++ b/aos/util/log_to_mcap.cc
@@ -6,6 +6,10 @@
DEFINE_string(node, "", "Node to replay from the perspective of.");
DEFINE_string(output_path, "/tmp/log.mcap", "Log to output.");
DEFINE_string(mode, "flatbuffer", "json or flatbuffer serialization.");
+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).");
// Converts an AOS log to an MCAP log that can be fed into Foxglove. To try this
// out, run:
@@ -48,9 +52,12 @@
std::unique_ptr<aos::EventLoop> mcap_event_loop =
reader.event_loop_factory()->MakeEventLoop("mcap", node);
CHECK(!FLAGS_output_path.empty());
- aos::McapLogger relogger(mcap_event_loop.get(), FLAGS_output_path,
- FLAGS_mode == "flatbuffer"
- ? aos::McapLogger::Serialization::kFlatbuffer
- : aos::McapLogger::Serialization::kJson);
+ aos::McapLogger relogger(
+ mcap_event_loop.get(), FLAGS_output_path,
+ FLAGS_mode == "flatbuffer" ? aos::McapLogger::Serialization::kFlatbuffer
+ : aos::McapLogger::Serialization::kJson,
+ FLAGS_canonical_channel_names
+ ? aos::McapLogger::CanonicalChannelNames::kCanonical
+ : aos::McapLogger::CanonicalChannelNames::kShortened);
reader.event_loop_factory()->Run();
}