Move over to ABSL logging and flags.
Removes gperftools too since that wants gflags.
Here come the fireworks.
Change-Id: I79cb7bcf60f1047fbfa28bfffc21a0fd692e4b1c
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/y2024/localizer/localizer_replay.cc b/y2024/localizer/localizer_replay.cc
index ad0caae..52fd917 100644
--- a/y2024/localizer/localizer_replay.cc
+++ b/y2024/localizer/localizer_replay.cc
@@ -1,4 +1,4 @@
-#include "gflags/gflags.h"
+#include "absl/flags/flag.h"
#include "aos/configuration.h"
#include "aos/events/logging/log_reader.h"
@@ -14,31 +14,32 @@
#include "y2024/control_loops/drivetrain/drivetrain_base.h"
#include "y2024/localizer/localizer.h"
-DEFINE_string(config, "y2024/aos_config.json",
- "Name of the config file to replay using.");
-DEFINE_bool(override_config, false,
- "If set, override the logged config with --config.");
-DEFINE_int32(team, 971, "Team number to use for logfile replay.");
-DEFINE_string(output_folder, "/tmp/replayed",
- "Name of the folder to write replayed logs to.");
-DEFINE_string(constants_path, "y2024/constants/constants.json",
- "Path to the constant file");
+ABSL_FLAG(std::string, config, "y2024/aos_config.json",
+ "Name of the config file to replay using.");
+ABSL_FLAG(bool, override_config, false,
+ "If set, override the logged config with --config.");
+ABSL_FLAG(int32_t, team, 971, "Team number to use for logfile replay.");
+ABSL_FLAG(std::string, output_folder, "/tmp/replayed",
+ "Name of the folder to write replayed logs to.");
+ABSL_FLAG(std::string, constants_path, "y2024/constants/constants.json",
+ "Path to the constant file");
int main(int argc, char **argv) {
aos::InitGoogle(&argc, &argv);
- aos::network::OverrideTeamNumber(FLAGS_team);
+ aos::network::OverrideTeamNumber(absl::GetFlag(FLAGS_team));
const aos::FlatbufferDetachedBuffer<aos::Configuration> config =
- aos::configuration::ReadConfig(FLAGS_config);
+ aos::configuration::ReadConfig(absl::GetFlag(FLAGS_config));
// sort logfiles
const std::vector<aos::logger::LogFile> logfiles =
aos::logger::SortParts(aos::logger::FindLogs(argc, argv));
// open logfiles
- aos::logger::LogReader reader(
- logfiles, FLAGS_override_config ? &config.message() : nullptr);
+ aos::logger::LogReader reader(logfiles, absl::GetFlag(FLAGS_override_config)
+ ? &config.message()
+ : nullptr);
reader.RemapLoggedChannel("/localizer", "y2024.localizer.Status");
for (const auto orin : {"orin1", "imu"}) {
@@ -59,8 +60,9 @@
reader.RegisterWithoutStarting(factory.get());
- y2024::SendSimulationConstants(reader.event_loop_factory(), FLAGS_team,
- FLAGS_constants_path);
+ y2024::SendSimulationConstants(reader.event_loop_factory(),
+ absl::GetFlag(FLAGS_team),
+ absl::GetFlag(FLAGS_constants_path));
const aos::Node *node = nullptr;
if (aos::configuration::MultiNode(reader.configuration())) {
@@ -75,7 +77,7 @@
node_factory->AlwaysStart<frc971::imu_fdcan::DualImuBlender>(
"dual_imu_blender");
loggers.push_back(std::make_unique<aos::util::LoggerState>(
- factory.get(), node, FLAGS_output_folder));
+ factory.get(), node, absl::GetFlag(FLAGS_output_folder)));
});
reader.event_loop_factory()->Run();