Found a workaround for the camera exposure issues we've seen

Calling SetExposure before the calls to configure the camera (image height,
width, frame rate) allows the camera exposure to come up properly.

If this isn't done, then the camera comes up with images that are darker
than the desired exposure, and then any following calls to camera_reader
have a brighter (proper) exposure.

NOTE: this changes the exposure values that we use, so we need to be sure
to verify that the exposure settings are still correct for indoor/outdoor
use in competition.

I think this also makes auto exposure come up properly-- we were having
some issues with this before.

Change-Id: Ia01913cd6e639565faad4a26ec1234649dc288ad
Signed-off-by: Jim Ostrowski <yimmy13@gmail.com>
diff --git a/y2022/vision/camera_reader_main.cc b/y2022/vision/camera_reader_main.cc
index 9a01679..5f19d64 100644
--- a/y2022/vision/camera_reader_main.cc
+++ b/y2022/vision/camera_reader_main.cc
@@ -8,9 +8,9 @@
 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, 5,
+DEFINE_uint32(exposure, 3,
               "Exposure time, in 100us increments; 0 implies auto exposure");
-DEFINE_uint32(outdoors_exposure, 13,
+DEFINE_uint32(outdoors_exposure, 2,
               "Exposure time when using --use_outdoors, in 100us increments; 0 "
               "implies auto exposure");
 
@@ -42,7 +42,13 @@
   const uint32_t exposure =
       (FLAGS_use_outdoors ? FLAGS_outdoors_exposure : FLAGS_exposure);
   if (exposure > 0) {
+    LOG(INFO) << "Setting camera to Manual Exposure mode with exposure = "
+              << exposure << " or " << static_cast<double>(exposure) / 10.0
+              << " ms";
     v4l2_reader.SetExposure(exposure);
+  } else {
+    LOG(INFO) << "Setting camera to use Auto Exposure";
+    v4l2_reader.UseAutoExposure();
   }
 
   CameraReader camera_reader(&event_loop, &calibration_data.message(),