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/y2022_bot3/BUILD b/y2022_bot3/BUILD
index 08f4e2c..f827497 100644
--- a/y2022_bot3/BUILD
+++ b/y2022_bot3/BUILD
@@ -120,8 +120,9 @@
"//y2022_bot3/control_loops/drivetrain:polydrivetrain_plants",
"//y2022_bot3/control_loops/superstructure/climber:climber_plants",
"//y2022_bot3/control_loops/superstructure/intake:intake_plants",
- "@com_github_google_glog//:glog",
"@com_google_absl//absl/base",
+ "@com_google_absl//absl/log",
+ "@com_google_absl//absl/log:check",
],
)
diff --git a/y2022_bot3/actors/BUILD b/y2022_bot3/actors/BUILD
index 783894f..8b99197 100644
--- a/y2022_bot3/actors/BUILD
+++ b/y2022_bot3/actors/BUILD
@@ -57,6 +57,7 @@
"//y2022_bot3/control_loops/drivetrain:drivetrain_base",
"//y2022_bot3/control_loops/superstructure:superstructure_goal_fbs",
"//y2022_bot3/control_loops/superstructure:superstructure_status_fbs",
+ "@com_google_absl//absl/flags:flag",
],
)
diff --git a/y2022_bot3/actors/autonomous_actor.cc b/y2022_bot3/actors/autonomous_actor.cc
index 6c5c244..42fa02c 100644
--- a/y2022_bot3/actors/autonomous_actor.cc
+++ b/y2022_bot3/actors/autonomous_actor.cc
@@ -4,6 +4,8 @@
#include <cinttypes>
#include <cmath>
+#include "absl/flags/flag.h"
+
#include "aos/logging/logging.h"
#include "aos/network/team_number.h"
#include "aos/util/math.h"
@@ -12,7 +14,7 @@
#include "y2022_bot3/constants.h"
#include "y2022_bot3/control_loops/drivetrain/drivetrain_base.h"
-DEFINE_bool(spline_auto, false, "If true, define a spline autonomous mode");
+ABSL_FLAG(bool, spline_auto, false, "If true, define a spline autonomous mode");
namespace y2022_bot3::actors {
@@ -84,7 +86,7 @@
return;
}
sent_starting_position_ = false;
- if (FLAGS_spline_auto) {
+ if (absl::GetFlag(FLAGS_spline_auto)) {
test_spline_ =
PlanSpline(std::bind(&AutonomousSplines::TestSpline, &auto_splines_,
std::placeholders::_1, alliance_),
@@ -135,7 +137,7 @@
AOS_LOG(INFO, "Aborting autonomous due to invalid alliance selection.");
return false;
}
- if (FLAGS_spline_auto) {
+ if (absl::GetFlag(FLAGS_spline_auto)) {
SplineAuto();
}
diff --git a/y2022_bot3/constants.cc b/y2022_bot3/constants.cc
index 8defbc6..49d8bb6 100644
--- a/y2022_bot3/constants.cc
+++ b/y2022_bot3/constants.cc
@@ -8,7 +8,8 @@
#endif
#include "absl/base/call_once.h"
-#include "glog/logging.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
#include "aos/mutex/mutex.h"
#include "aos/network/team_number.h"
diff --git a/y2022_bot3/control_loops/drivetrain/trajectory_generator_main.cc b/y2022_bot3/control_loops/drivetrain/trajectory_generator_main.cc
index 644ae8d..66cf014 100644
--- a/y2022_bot3/control_loops/drivetrain/trajectory_generator_main.cc
+++ b/y2022_bot3/control_loops/drivetrain/trajectory_generator_main.cc
@@ -1,6 +1,8 @@
#include <sys/resource.h>
#include <sys/time.h>
+#include "absl/flags/flag.h"
+
#include "aos/events/shm_event_loop.h"
#include "aos/init.h"
#include "frc971/control_loops/drivetrain/trajectory_generator.h"
@@ -8,8 +10,8 @@
using ::frc971::control_loops::drivetrain::TrajectoryGenerator;
-DEFINE_bool(skip_renicing, false,
- "If true, skip renicing the trajectory generator.");
+ABSL_FLAG(bool, skip_renicing, false,
+ "If true, skip renicing the trajectory generator.");
int main(int argc, char *argv[]) {
::aos::InitGoogle(&argc, &argv);
@@ -23,7 +25,7 @@
::y2022_bot3::control_loops::drivetrain::GetDrivetrainConfig());
event_loop.OnRun([]() {
- if (FLAGS_skip_renicing) {
+ if (absl::GetFlag(FLAGS_skip_renicing)) {
LOG(WARNING) << "Ignoring request to renice to -20 due to "
"--skip_renicing.";
} else {
diff --git a/y2022_bot3/control_loops/superstructure/superstructure_lib_test.cc b/y2022_bot3/control_loops/superstructure/superstructure_lib_test.cc
index 493d2f5..3f6a015 100644
--- a/y2022_bot3/control_loops/superstructure/superstructure_lib_test.cc
+++ b/y2022_bot3/control_loops/superstructure/superstructure_lib_test.cc
@@ -12,9 +12,6 @@
#include "y2022_bot3/control_loops/drivetrain/drivetrain_dog_motor_plant.h"
#include "y2022_bot3/control_loops/superstructure/superstructure.h"
-DEFINE_string(output_folder, "",
- "If set, logs all channels to the provided logfile.");
-
namespace y2022_bot3::control_loops::superstructure::testing {
namespace chrono = std::chrono;
diff --git a/y2022_bot3/control_loops/superstructure/superstructure_replay.cc b/y2022_bot3/control_loops/superstructure/superstructure_replay.cc
index e7b81cd..bc76582 100644
--- a/y2022_bot3/control_loops/superstructure/superstructure_replay.cc
+++ b/y2022_bot3/control_loops/superstructure/superstructure_replay.cc
@@ -3,7 +3,7 @@
// replayed, so that it can then be run through the plotting tool or analyzed
// in some other way. The original superstructure status data will be on the
// /original/superstructure channel.
-#include "gflags/gflags.h"
+#include "absl/flags/flag.h"
#include "aos/events/logging/log_reader.h"
#include "aos/events/logging/log_writer.h"
@@ -15,14 +15,14 @@
#include "y2022_bot3/constants.h"
#include "y2022_bot3/control_loops/superstructure/superstructure.h"
-DEFINE_int32(team, 971, "Team number to use for logfile replay.");
-DEFINE_string(output_folder, "/tmp/superstructure_replay/",
- "Logs all channels to the provided logfile.");
+ABSL_FLAG(int32_t, team, 971, "Team number to use for logfile replay.");
+ABSL_FLAG(std::string, output_folder, "/tmp/superstructure_replay/",
+ "Logs all channels to the provided logfile.");
int main(int argc, char **argv) {
aos::InitGoogle(&argc, &argv);
- aos::network::OverrideTeamNumber(FLAGS_team);
+ aos::network::OverrideTeamNumber(absl::GetFlag(FLAGS_team));
// open logfiles
aos::logger::LogReader reader(
@@ -40,11 +40,11 @@
aos::NodeEventLoopFactory *roborio =
factory.GetNodeEventLoopFactory("roborio");
- unlink(FLAGS_output_folder.c_str());
+ unlink(absl::GetFlag(FLAGS_output_folder).c_str());
std::unique_ptr<aos::EventLoop> logger_event_loop =
roborio->MakeEventLoop("logger");
auto logger = std::make_unique<aos::logger::Logger>(logger_event_loop.get());
- logger->StartLoggingOnRun(FLAGS_output_folder);
+ logger->StartLoggingOnRun(absl::GetFlag(FLAGS_output_folder));
roborio->OnStartup([roborio]() {
roborio->AlwaysStart<