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/vision/camera_reader_main.cc b/y2022/vision/camera_reader_main.cc
index 278f14b..80b19d2 100644
--- a/y2022/vision/camera_reader_main.cc
+++ b/y2022/vision/camera_reader_main.cc
@@ -1,3 +1,5 @@
+#include "absl/flags/flag.h"
+
#include "aos/events/shm_event_loop.h"
#include "aos/init.h"
#include "y2022/vision/camera_reader.h"
@@ -5,14 +7,15 @@
// config used to allow running camera_reader independently. E.g.,
// bazel run //y2022/vision:camera_reader -- --config y2022/aos_config.json
// --override_hostname pi-7971-1 --ignore_timestamps true
-DECLARE_bool(use_outdoors);
-DEFINE_string(config, "aos_config.json", "Path to the config file to use.");
-DEFINE_double(duty_cycle, 0.65, "Duty cycle of the LEDs");
-DEFINE_uint32(exposure, 3,
- "Exposure time, in 100us increments; 0 implies auto exposure");
-DEFINE_uint32(outdoors_exposure, 2,
- "Exposure time when using --use_outdoors, in 100us increments; 0 "
- "implies auto exposure");
+ABSL_DECLARE_FLAG(bool, use_outdoors);
+ABSL_FLAG(std::string, config, "aos_config.json",
+ "Path to the config file to use.");
+ABSL_FLAG(double, duty_cycle, 0.65, "Duty cycle of the LEDs");
+ABSL_FLAG(uint32_t, exposure, 3,
+ "Exposure time, in 100us increments; 0 implies auto exposure");
+ABSL_FLAG(uint32_t, outdoors_exposure, 2,
+ "Exposure time when using --use_outdoors, in 100us increments; 0 "
+ "implies auto exposure");
namespace y2022::vision {
namespace {
@@ -21,7 +24,7 @@
void CameraReaderMain() {
aos::FlatbufferDetachedBuffer<aos::Configuration> config =
- aos::configuration::ReadConfig(FLAGS_config);
+ aos::configuration::ReadConfig(absl::GetFlag(FLAGS_config));
const aos::FlatbufferSpan<calibration::CalibrationData> calibration_data(
CalibrationData());
@@ -38,8 +41,9 @@
}
V4L2Reader v4l2_reader(&event_loop, "/dev/video0");
- const uint32_t exposure =
- (FLAGS_use_outdoors ? FLAGS_outdoors_exposure : FLAGS_exposure);
+ const uint32_t exposure = (absl::GetFlag(FLAGS_use_outdoors)
+ ? absl::GetFlag(FLAGS_outdoors_exposure)
+ : absl::GetFlag(FLAGS_exposure));
if (exposure > 0) {
LOG(INFO) << "Setting camera to Manual Exposure mode with exposure = "
<< exposure << " or " << static_cast<double>(exposure) / 10.0
@@ -52,7 +56,7 @@
CameraReader camera_reader(&event_loop, &calibration_data.message(),
&v4l2_reader);
- camera_reader.SetDutyCycle(FLAGS_duty_cycle);
+ camera_reader.SetDutyCycle(absl::GetFlag(FLAGS_duty_cycle));
event_loop.Run();
}