Run clang-format on the entire repo

This patch clang-formats the entire repo. Third-party code is
excluded.

I needed to fix up the .clang-format file so that all the header
includes are ordered properly. I could have sworn that it used to work
without the extra modification, but I guess not.

Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: I64bb9f2c795401393f9dfe2fefc4f04cb36b52f6
diff --git a/y2022/vision/ball_color.cc b/y2022/vision/ball_color.cc
index dd1ae6e..b1ebd85 100644
--- a/y2022/vision/ball_color.cc
+++ b/y2022/vision/ball_color.cc
@@ -2,15 +2,16 @@
 
 #include <chrono>
 #include <cmath>
-#include <opencv2/highgui/highgui.hpp>
 #include <thread>
 
+#include "glog/logging.h"
+#include "opencv2/imgproc.hpp"
+#include <opencv2/highgui/highgui.hpp>
+
 #include "aos/events/event_loop.h"
 #include "aos/events/shm_event_loop.h"
 #include "frc971/input/joystick_state_generated.h"
 #include "frc971/vision/vision_generated.h"
-#include "glog/logging.h"
-#include "opencv2/imgproc.hpp"
 
 namespace y2022 {
 namespace vision {
diff --git a/y2022/vision/ball_color_test.cc b/y2022/vision/ball_color_test.cc
index b8ad359..96f59aa 100644
--- a/y2022/vision/ball_color_test.cc
+++ b/y2022/vision/ball_color_test.cc
@@ -1,14 +1,15 @@
 #include "y2022/vision/ball_color.h"
 
 #include <cmath>
+
+#include "glog/logging.h"
+#include "gtest/gtest.h"
 #include <opencv2/highgui/highgui.hpp>
 #include <opencv2/imgproc.hpp>
 
 #include "aos/events/simulated_event_loop.h"
 #include "aos/json_to_flatbuffer.h"
 #include "aos/testing/test_logging.h"
-#include "glog/logging.h"
-#include "gtest/gtest.h"
 #include "y2022/constants.h"
 
 DEFINE_string(output_folder, "",
diff --git a/y2022/vision/blob_detector.cc b/y2022/vision/blob_detector.cc
index 228d8d7..2c6ff44 100644
--- a/y2022/vision/blob_detector.cc
+++ b/y2022/vision/blob_detector.cc
@@ -4,13 +4,14 @@
 #include <optional>
 #include <string>
 
-#include "aos/network/team_number.h"
-#include "aos/time/time.h"
-#include "frc971/vision/geometry.h"
 #include "opencv2/features2d.hpp"
 #include "opencv2/highgui/highgui.hpp"
 #include "opencv2/imgproc.hpp"
 
+#include "aos/network/team_number.h"
+#include "aos/time/time.h"
+#include "frc971/vision/geometry.h"
+
 DEFINE_bool(
     use_outdoors, true,
     "If set, use the color filters and exposure for an outdoor setting.");
diff --git a/y2022/vision/calibrate_extrinsics.cc b/y2022/vision/calibrate_extrinsics.cc
index 6793bc4..d8b57dc 100644
--- a/y2022/vision/calibrate_extrinsics.cc
+++ b/y2022/vision/calibrate_extrinsics.cc
@@ -1,6 +1,7 @@
 #include "Eigen/Dense"
 #include "Eigen/Geometry"
 #include "absl/strings/str_format.h"
+
 #include "aos/events/logging/log_reader.h"
 #include "aos/events/logging/log_writer.h"
 #include "aos/init.h"
diff --git a/y2022/vision/camera_reader.cc b/y2022/vision/camera_reader.cc
index b64bc2b..ba7abaf 100644
--- a/y2022/vision/camera_reader.cc
+++ b/y2022/vision/camera_reader.cc
@@ -4,6 +4,8 @@
 #include <cmath>
 #include <thread>
 
+#include "opencv2/imgproc.hpp"
+
 #include "aos/events/event_loop.h"
 #include "aos/events/shm_event_loop.h"
 #include "aos/flatbuffer_merge.h"
@@ -11,7 +13,6 @@
 #include "frc971/vision/calibration_generated.h"
 #include "frc971/vision/v4l2_reader.h"
 #include "frc971/vision/vision_generated.h"
-#include "opencv2/imgproc.hpp"
 #include "y2022/vision/blob_detector.h"
 
 DEFINE_string(image_png, "", "A set of PNG images");
diff --git a/y2022/vision/image_decimator.cc b/y2022/vision/image_decimator.cc
index 5fda423..b3cf2e0 100644
--- a/y2022/vision/image_decimator.cc
+++ b/y2022/vision/image_decimator.cc
@@ -1,6 +1,6 @@
 #include "aos/events/shm_event_loop.h"
-#include "aos/init.h"
 #include "aos/flatbuffers.h"
+#include "aos/init.h"
 #include "frc971/vision/vision_generated.h"
 
 DEFINE_string(config, "aos_config.json", "Path to the config file to use.");
@@ -14,17 +14,14 @@
       : slow_image_sender_(
             event_loop->MakeSender<CameraImage>("/camera/decimated")),
         image_fetcher_(event_loop->MakeFetcher<CameraImage>("/camera")) {
-    aos::TimerHandler *timer =
-        event_loop->AddTimer(
-            [this]() {
-              if (image_fetcher_.Fetch()) {
-                const aos::FlatbufferSpan<CameraImage> image(
-                    {reinterpret_cast<const uint8_t *>(
-                         image_fetcher_.context().data),
-                     image_fetcher_.context().size});
-                slow_image_sender_.CheckOk(slow_image_sender_.Send(image));
-              }
-            });
+    aos::TimerHandler *timer = event_loop->AddTimer([this]() {
+      if (image_fetcher_.Fetch()) {
+        const aos::FlatbufferSpan<CameraImage> image(
+            {reinterpret_cast<const uint8_t *>(image_fetcher_.context().data),
+             image_fetcher_.context().size});
+        slow_image_sender_.CheckOk(slow_image_sender_.Send(image));
+      }
+    });
     event_loop->OnRun([event_loop, timer]() {
       timer->Setup(event_loop->monotonic_now(),
                    std::chrono::milliseconds(1000));
@@ -35,7 +32,7 @@
   aos::Sender<CameraImage> slow_image_sender_;
   aos::Fetcher<CameraImage> image_fetcher_;
 };
-}
+}  // namespace frc971::vision
 
 int main(int argc, char *argv[]) {
   aos::InitGoogle(&argc, &argv);
diff --git a/y2022/vision/target_estimator.cc b/y2022/vision/target_estimator.cc
index b84cf21..ff72b11 100644
--- a/y2022/vision/target_estimator.cc
+++ b/y2022/vision/target_estimator.cc
@@ -1,15 +1,16 @@
 #include "y2022/vision/target_estimator.h"
 
 #include "absl/strings/str_format.h"
-#include "aos/time/time.h"
 #include "ceres/ceres.h"
-#include "frc971/control_loops/quaternion_utils.h"
-#include "frc971/vision/geometry.h"
 #include "opencv2/core/core.hpp"
 #include "opencv2/core/eigen.hpp"
 #include "opencv2/features2d.hpp"
 #include "opencv2/highgui/highgui.hpp"
 #include "opencv2/imgproc.hpp"
+
+#include "aos/time/time.h"
+#include "frc971/control_loops/quaternion_utils.h"
+#include "frc971/vision/geometry.h"
 #include "y2022/constants.h"
 
 DEFINE_bool(freeze_roll, false, "If true, don't solve for roll");
diff --git a/y2022/vision/target_estimator.h b/y2022/vision/target_estimator.h
index ac170e8..7a2b9a2 100644
--- a/y2022/vision/target_estimator.h
+++ b/y2022/vision/target_estimator.h
@@ -7,6 +7,7 @@
 #include "Eigen/Geometry"
 #include "opencv2/core/types.hpp"
 #include "opencv2/imgproc.hpp"
+
 #include "y2022/vision/blob_detector.h"
 #include "y2022/vision/target_estimate_generated.h"
 
diff --git a/y2022/vision/viewer.cc b/y2022/vision/viewer.cc
index e455f66..58db722 100644
--- a/y2022/vision/viewer.cc
+++ b/y2022/vision/viewer.cc
@@ -1,12 +1,13 @@
 #include <algorithm>
 #include <map>
+#include <random>
+
+#include "absl/strings/str_format.h"
 #include <opencv2/calib3d.hpp>
 #include <opencv2/features2d.hpp>
 #include <opencv2/highgui/highgui.hpp>
 #include <opencv2/imgproc.hpp>
-#include <random>
 
-#include "absl/strings/str_format.h"
 #include "aos/events/shm_event_loop.h"
 #include "aos/init.h"
 #include "aos/time/time.h"
diff --git a/y2022/vision/viewer_replay.cc b/y2022/vision/viewer_replay.cc
index 5d09d55..66087e5 100644
--- a/y2022/vision/viewer_replay.cc
+++ b/y2022/vision/viewer_replay.cc
@@ -1,13 +1,14 @@
+#include "opencv2/calib3d.hpp"
+#include "opencv2/features2d.hpp"
+#include "opencv2/highgui/highgui.hpp"
+#include "opencv2/imgproc.hpp"
+
 #include "aos/events/logging/log_reader.h"
 #include "aos/events/simulated_event_loop.h"
 #include "aos/init.h"
 #include "frc971/control_loops/drivetrain/drivetrain_status_generated.h"
 #include "frc971/input/joystick_state_generated.h"
 #include "frc971/vision/vision_generated.h"
-#include "opencv2/calib3d.hpp"
-#include "opencv2/features2d.hpp"
-#include "opencv2/highgui/highgui.hpp"
-#include "opencv2/imgproc.hpp"
 #include "y2022/control_loops/superstructure/superstructure_status_generated.h"
 #include "y2022/vision/blob_detector.h"