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/y2018/BUILD b/y2018/BUILD
index 129cd84..a17df89 100644
--- a/y2018/BUILD
+++ b/y2018/BUILD
@@ -63,7 +63,8 @@
         "//y2018/control_loops/drivetrain:polydrivetrain_plants",
         "//y2018/control_loops/superstructure/arm:arm_constants",
         "//y2018/control_loops/superstructure/intake:intake_plants",
-        "@com_github_google_glog//:glog",
+        "@com_google_absl//absl/log",
+        "@com_google_absl//absl/log:check",
     ],
 )
 
diff --git a/y2018/constants.cc b/y2018/constants.cc
index 41c8f3a..d12b9b5 100644
--- a/y2018/constants.cc
+++ b/y2018/constants.cc
@@ -9,7 +9,8 @@
 #include "sanitizer/lsan_interface.h"
 #endif
 
-#include "glog/logging.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 
 #include "aos/network/team_number.h"
 #include "aos/stl_mutex/stl_mutex.h"
diff --git a/y2018/control_loops/python/2d_plot.cc b/y2018/control_loops/python/2d_plot.cc
index 1d2a686..c65bae6 100644
--- a/y2018/control_loops/python/2d_plot.cc
+++ b/y2018/control_loops/python/2d_plot.cc
@@ -2,17 +2,18 @@
 #include <cmath>
 #include <thread>
 
-#include "gflags/gflags.h"
+#include "absl/flags/flag.h"
+#include "absl/flags/parse.h"
 #include "third_party/matplotlib-cpp/matplotlibcpp.h"
 
-DEFINE_double(yrange, 1.0, "+- y max");
+ABSL_FLAG(double, yrange, 1.0, "+- y max");
 
 double fx(double x, double yrange) {
   return 2.0 * ((1.0 / (1.0 + ::std::exp(-x * 2.0 / yrange)) - 0.5)) * yrange;
 }
 
 int main(int argc, char **argv) {
-  gflags::ParseCommandLineFlags(&argc, &argv, false);
+  absl::ParseCommandLine(argc, argv);
 
   matplotlibcpp::figure();
   ::std::vector<double> x;
@@ -21,10 +22,10 @@
 
   for (double i = -5.0; i < 5.0; i += 0.01) {
     x.push_back(i);
-    y.push_back(fx(i, FLAGS_yrange));
-    slope_y.push_back(
-        (fx(i + 0.0001, FLAGS_yrange) - fx(i - 0.0001, FLAGS_yrange)) /
-        (2.0 * 0.0001));
+    y.push_back(fx(i, absl::GetFlag(FLAGS_yrange)));
+    slope_y.push_back((fx(i + 0.0001, absl::GetFlag(FLAGS_yrange)) -
+                       fx(i - 0.0001, absl::GetFlag(FLAGS_yrange))) /
+                      (2.0 * 0.0001));
   }
 
   matplotlibcpp::plot(x, y, {{"label", "saturated x"}});
diff --git a/y2018/control_loops/python/BUILD b/y2018/control_loops/python/BUILD
index fcedf40..d286ce0 100644
--- a/y2018/control_loops/python/BUILD
+++ b/y2018/control_loops/python/BUILD
@@ -107,7 +107,8 @@
     target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         "//third_party/matplotlib-cpp",
-        "@com_github_gflags_gflags//:gflags",
+        "@com_google_absl//absl/flags:flag",
+        "@com_google_absl//absl/flags:parse",
     ],
 )
 
diff --git a/y2018/control_loops/superstructure/arm/BUILD b/y2018/control_loops/superstructure/arm/BUILD
index 319e591..495e214 100644
--- a/y2018/control_loops/superstructure/arm/BUILD
+++ b/y2018/control_loops/superstructure/arm/BUILD
@@ -76,7 +76,7 @@
         "//aos/analysis:in_process_plotter",
         "//frc971/control_loops/double_jointed_arm:ekf",
         "//frc971/control_loops/double_jointed_arm:trajectory",
-        "@com_github_gflags_gflags//:gflags",
+        "@com_google_absl//absl/flags:flag",
         "@org_tuxfamily_eigen//:eigen",
     ],
 )
diff --git a/y2018/control_loops/superstructure/arm/trajectory_plot.cc b/y2018/control_loops/superstructure/arm/trajectory_plot.cc
index eeb0fbc..1811b95 100644
--- a/y2018/control_loops/superstructure/arm/trajectory_plot.cc
+++ b/y2018/control_loops/superstructure/arm/trajectory_plot.cc
@@ -1,4 +1,4 @@
-#include "gflags/gflags.h"
+#include "absl/flags/flag.h"
 
 #include "aos/analysis/in_process_plotter.h"
 #include "aos/init.h"
@@ -8,9 +8,9 @@
 #include "y2018/control_loops/superstructure/arm/arm_constants.h"
 #include "y2018/control_loops/superstructure/arm/generated_graph.h"
 
-DEFINE_bool(forwards, true, "If true, run the forwards simulation.");
-DEFINE_bool(plot, true, "If true, plot");
-DEFINE_bool(plot_thetas, true, "If true, plot the angles");
+ABSL_FLAG(bool, forwards, true, "If true, run the forwards simulation.");
+ABSL_FLAG(bool, plot, true, "If true, plot");
+ABSL_FLAG(bool, plot_thetas, true, "If true, plot the angles");
 
 namespace y2018::control_loops::superstructure::arm {
 
@@ -18,8 +18,9 @@
   frc971::control_loops::arm::Dynamics dynamics(kArmConstants);
   frc971::control_loops::arm::Trajectory trajectory(
       &dynamics,
-      FLAGS_forwards ? MakeNeutralToFrontHighPath()
-                     : Path::Reversed(MakeNeutralToFrontHighPath()),
+      absl::GetFlag(FLAGS_forwards)
+          ? MakeNeutralToFrontHighPath()
+          : Path::Reversed(MakeNeutralToFrontHighPath()),
       0.001);
 
   constexpr double kAlpha0Max = 30.0;
@@ -254,7 +255,7 @@
     t += sim_dt;
   }
 
-  if (FLAGS_plot) {
+  if (absl::GetFlag(FLAGS_plot)) {
     aos::analysis::Plotter plotter;
 
     plotter.AddFigure();
@@ -324,7 +325,7 @@
     plotter.AddLine(t_array, torque1_hat_t_array, "torque1_hat");
     plotter.Publish();
 
-    if (FLAGS_plot_thetas) {
+    if (absl::GetFlag(FLAGS_plot_thetas)) {
       plotter.AddFigure();
       plotter.Title("Angles");
       plotter.AddLine(t_array, theta0_goal_t_array, "theta0_t_goal");
diff --git a/y2018/vision/BUILD b/y2018/vision/BUILD
index a2c2d8c..0f11714 100644
--- a/y2018/vision/BUILD
+++ b/y2018/vision/BUILD
@@ -5,6 +5,7 @@
     srcs = ["image_streamer.cc"],
     target_compatible_with = ["@platforms//os:linux"],
     deps = [
+        "//aos:init",
         "//aos/logging",
         "//aos/vision/blob:codec",
         "//aos/vision/events:epoll_events",
@@ -13,7 +14,7 @@
         "//aos/vision/image:image_stream",
         "//aos/vision/image:reader",
         "//y2018:vision_proto",
-        "@com_github_gflags_gflags//:gflags",
+        "@com_google_absl//absl/flags:flag",
     ],
 )
 
diff --git a/y2018/vision/image_streamer.cc b/y2018/vision/image_streamer.cc
index 26e7ca1..81f2c6c 100644
--- a/y2018/vision/image_streamer.cc
+++ b/y2018/vision/image_streamer.cc
@@ -4,8 +4,9 @@
 #include <fstream>
 #include <string>
 
-#include "gflags/gflags.h"
+#include "absl/flags/flag.h"
 
+#include "aos/init.h"
 #include "aos/logging/implementations.h"
 #include "aos/logging/logging.h"
 #include "aos/vision/blob/codec.h"
@@ -23,9 +24,9 @@
 using ::aos::vision::Int32Codec;
 using ::y2018::VisionControl;
 
-DEFINE_bool(single_camera, true, "If true, only use video0");
-DEFINE_int32(camera0_exposure, 300, "Exposure for video0");
-DEFINE_int32(camera1_exposure, 300, "Exposure for video1");
+ABSL_FLAG(bool, single_camera, true, "If true, only use video0");
+ABSL_FLAG(int32_t, camera0_exposure, 300, "Exposure for video0");
+ABSL_FLAG(int32_t, camera1_exposure, 300, "Exposure for video1");
 
 aos::vision::DataRef mjpg_header =
     "HTTP/1.0 200 OK\r\n"
@@ -288,18 +289,18 @@
 };
 
 int main(int argc, char **argv) {
-  gflags::ParseCommandLineFlags(&argc, &argv, false);
+  aos::InitGoogle(&argc, &argv);
 
   TCPServer<MjpegDataSocket> tcp_server_(80);
   aos::vision::CameraParams params0;
-  params0.set_exposure(FLAGS_camera0_exposure);
+  params0.set_exposure(absl::GetFlag(FLAGS_camera0_exposure));
   params0.set_brightness(-40);
   params0.set_width(320);
   // params0.set_fps(10);
   params0.set_height(240);
 
   aos::vision::CameraParams params1 = params0;
-  params1.set_exposure(FLAGS_camera1_exposure);
+  params1.set_exposure(absl::GetFlag(FLAGS_camera1_exposure));
 
   ::y2018::VisionStatus vision_status;
   ::aos::events::ProtoTXUdpSocket<::y2018::VisionStatus> status_socket(
@@ -315,7 +316,7 @@
           status_socket.Send(vision_status);
         }
       }));
-  if (!FLAGS_single_camera) {
+  if (!absl::GetFlag(FLAGS_single_camera)) {
     camera1.reset(new CameraStream(
         // params,
         // "/dev/v4l/by-path/platform-tegra-xhci-usb-0:3.1:1.0-video-index0",