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/y2020/control_loops/drivetrain/drivetrain_base.cc b/y2020/control_loops/drivetrain/drivetrain_base.cc
index 952c3dc..7b42df5 100644
--- a/y2020/control_loops/drivetrain/drivetrain_base.cc
+++ b/y2020/control_loops/drivetrain/drivetrain_base.cc
@@ -60,7 +60,8 @@
           .finished() /*imu_transform*/,
   };
 
-  if (::aos::network::GetTeamNumber() != constants::Values::kCodingRobotTeamNumber) {
+  if (::aos::network::GetTeamNumber() !=
+      constants::Values::kCodingRobotTeamNumber) {
     // TODO(james): Check X/Y axis
     // transformations.
     kDrivetrainConfig.imu_transform = (Eigen::Matrix<double, 3, 3>() << 1.0,
diff --git a/y2020/control_loops/drivetrain/drivetrain_replay.cc b/y2020/control_loops/drivetrain/drivetrain_replay.cc
index 8373258..0035fb3 100644
--- a/y2020/control_loops/drivetrain/drivetrain_replay.cc
+++ b/y2020/control_loops/drivetrain/drivetrain_replay.cc
@@ -4,6 +4,8 @@
 // replayed, so that it can then be run through the plotting tool or analyzed
 // in some other way. The original drivetrain status data will be on the
 // /original/drivetrain channel.
+#include "gflags/gflags.h"
+
 #include "aos/configuration.h"
 #include "aos/events/logging/log_reader.h"
 #include "aos/events/logging/log_writer.h"
@@ -14,7 +16,6 @@
 #include "aos/util/simulation_logger.h"
 #include "frc971/control_loops/drivetrain/drivetrain.h"
 #include "frc971/control_loops/drivetrain/trajectory_generator.h"
-#include "gflags/gflags.h"
 #include "y2020/constants.h"
 #include "y2020/control_loops/drivetrain/drivetrain_base.h"
 #include "y2020/control_loops/drivetrain/localizer.h"
diff --git a/y2020/control_loops/drivetrain/drivetrain_replay_test.cc b/y2020/control_loops/drivetrain/drivetrain_replay_test.cc
index 08622cb..0baf34b 100644
--- a/y2020/control_loops/drivetrain/drivetrain_replay_test.cc
+++ b/y2020/control_loops/drivetrain/drivetrain_replay_test.cc
@@ -8,6 +8,7 @@
 // longer be valid.
 // TODO(james): Do something about that when the time comes--could just copy
 // the existing drivetrain config into this file and use it directly.
+#include "gflags/gflags.h"
 #include "gtest/gtest.h"
 
 #include "aos/configuration.h"
@@ -19,13 +20,10 @@
 #include "aos/network/team_number.h"
 #include "frc971/control_loops/drivetrain/drivetrain.h"
 #include "frc971/control_loops/drivetrain/trajectory_schema.h"
-#include "gflags/gflags.h"
 #include "y2020/control_loops/drivetrain/drivetrain_base.h"
 
-DEFINE_string(
-    logfile,
-    "external/drivetrain_replay/",
-    "Name of the logfile to read from.");
+DEFINE_string(logfile, "external/drivetrain_replay/",
+              "Name of the logfile to read from.");
 DEFINE_string(config, "y2020/aos_config.json",
               "Name of the config file to replay using.");
 
@@ -43,9 +41,9 @@
     // TODO(james): Actually enforce not sending on the same buses as the
     // logfile spews out.
     reader_.RemapLoggedChannel("/drivetrain",
-                              "frc971.control_loops.drivetrain.Status");
+                               "frc971.control_loops.drivetrain.Status");
     reader_.RemapLoggedChannel("/drivetrain",
-                              "frc971.control_loops.drivetrain.Output");
+                               "frc971.control_loops.drivetrain.Output");
 
     // Patch in any new channels.
     updated_config_ = aos::configuration::MergeWithConfig(
@@ -98,9 +96,7 @@
                 "/drivetrain");
   }
 
-  ~DrivetrainReplayTest() {
-    reader_.Deregister();
-  }
+  ~DrivetrainReplayTest() { reader_.Deregister(); }
 
   aos::logger::LogReader reader_;
   const aos::Node *roborio_;
diff --git a/y2020/control_loops/drivetrain/localizer_test.cc b/y2020/control_loops/drivetrain/localizer_test.cc
index 9e9e7dd..bb85921 100644
--- a/y2020/control_loops/drivetrain/localizer_test.cc
+++ b/y2020/control_loops/drivetrain/localizer_test.cc
@@ -2,6 +2,8 @@
 
 #include <queue>
 
+#include "gtest/gtest.h"
+
 #include "aos/events/logging/log_writer.h"
 #include "aos/network/message_bridge_server_generated.h"
 #include "aos/network/team_number.h"
@@ -9,7 +11,6 @@
 #include "frc971/control_loops/drivetrain/drivetrain.h"
 #include "frc971/control_loops/drivetrain/drivetrain_test_lib.h"
 #include "frc971/control_loops/team_number_test_environment.h"
-#include "gtest/gtest.h"
 #include "y2020/control_loops/drivetrain/drivetrain_base.h"
 #include "y2020/control_loops/superstructure/superstructure_status_generated.h"
 
diff --git a/y2020/control_loops/superstructure/hood/hood_encoder_zeroing_estimator.cc b/y2020/control_loops/superstructure/hood/hood_encoder_zeroing_estimator.cc
index eb9351b..dee4461 100644
--- a/y2020/control_loops/superstructure/hood/hood_encoder_zeroing_estimator.cc
+++ b/y2020/control_loops/superstructure/hood/hood_encoder_zeroing_estimator.cc
@@ -1,7 +1,7 @@
-#include <cmath>
-
 #include "y2020/control_loops/superstructure/hood/hood_encoder_zeroing_estimator.h"
 
+#include <cmath>
+
 namespace y2020::control_loops::superstructure::hood {
 
 HoodEncoderZeroingEstimator::HoodEncoderZeroingEstimator(
diff --git a/y2020/control_loops/superstructure/shooter/flywheel_controller.h b/y2020/control_loops/superstructure/shooter/flywheel_controller.h
index ce0e8bb..1d56407 100644
--- a/y2020/control_loops/superstructure/shooter/flywheel_controller.h
+++ b/y2020/control_loops/superstructure/shooter/flywheel_controller.h
@@ -3,8 +3,8 @@
 
 #include <memory>
 
-#include "frc971/control_loops/control_loop.h"
 #include "aos/time/time.h"
+#include "frc971/control_loops/control_loop.h"
 #include "frc971/control_loops/state_feedback_loop.h"
 #include "y2020/control_loops/superstructure/accelerator/integral_accelerator_plant.h"
 #include "y2020/control_loops/superstructure/finisher/integral_finisher_plant.h"
diff --git a/y2020/control_loops/superstructure/shooter/shooter_tuning_params_setter.cc b/y2020/control_loops/superstructure/shooter/shooter_tuning_params_setter.cc
index e919aae..5e3010d 100644
--- a/y2020/control_loops/superstructure/shooter/shooter_tuning_params_setter.cc
+++ b/y2020/control_loops/superstructure/shooter/shooter_tuning_params_setter.cc
@@ -1,7 +1,8 @@
-#include "aos/events/shm_event_loop.h"
-#include "aos/init.h"
 #include "gflags/gflags.h"
 #include "glog/logging.h"
+
+#include "aos/events/shm_event_loop.h"
+#include "aos/init.h"
 #include "y2020/control_loops/superstructure/shooter/shooter_tuning_params_generated.h"
 
 DEFINE_double(velocity_initial_finisher, 300.0, "Initial finisher velocity");
diff --git a/y2020/control_loops/superstructure/superstructure_lib_test.cc b/y2020/control_loops/superstructure/superstructure_lib_test.cc
index b13263a..b146149 100644
--- a/y2020/control_loops/superstructure/superstructure_lib_test.cc
+++ b/y2020/control_loops/superstructure/superstructure_lib_test.cc
@@ -3,6 +3,9 @@
 #include <chrono>
 #include <memory>
 
+#include "glog/logging.h"
+#include "gtest/gtest.h"
+
 #include "aos/events/logging/log_reader.h"
 #include "aos/events/logging/log_writer.h"
 #include "aos/network/team_number.h"
@@ -10,8 +13,6 @@
 #include "frc971/control_loops/control_loop_test.h"
 #include "frc971/control_loops/position_sensor_sim.h"
 #include "frc971/control_loops/team_number_test_environment.h"
-#include "glog/logging.h"
-#include "gtest/gtest.h"
 #include "y2020/constants.h"
 #include "y2020/control_loops/superstructure/accelerator/accelerator_plant.h"
 #include "y2020/control_loops/superstructure/finisher/finisher_plant.h"
diff --git a/y2020/control_loops/superstructure/superstructure_main.cc b/y2020/control_loops/superstructure/superstructure_main.cc
index 88dddf1..7e09db9 100644
--- a/y2020/control_loops/superstructure/superstructure_main.cc
+++ b/y2020/control_loops/superstructure/superstructure_main.cc
@@ -1,8 +1,7 @@
-#include "y2020/constants.h"
-#include "y2020/control_loops/superstructure/superstructure.h"
-
 #include "aos/events/shm_event_loop.h"
 #include "aos/init.h"
+#include "y2020/constants.h"
+#include "y2020/control_loops/superstructure/superstructure.h"
 
 int main(int argc, char **argv) {
   ::aos::InitGoogle(&argc, &argv);
diff --git a/y2020/control_loops/superstructure/superstructure_replay.cc b/y2020/control_loops/superstructure/superstructure_replay.cc
index 0148523..36a6778 100644
--- a/y2020/control_loops/superstructure/superstructure_replay.cc
+++ b/y2020/control_loops/superstructure/superstructure_replay.cc
@@ -4,13 +4,14 @@
 // replayed, so that it can then be run through the plotting tool or analyzed
 // in some other way. The original drivetrain status data will be on the
 // /original/drivetrain channel.
+#include "gflags/gflags.h"
+
 #include "aos/events/logging/log_reader.h"
 #include "aos/events/simulated_event_loop.h"
 #include "aos/init.h"
 #include "aos/json_to_flatbuffer.h"
 #include "aos/logging/log_message_generated.h"
 #include "aos/network/team_number.h"
-#include "gflags/gflags.h"
 #include "y2020/constants.h"
 #include "y2020/control_loops/superstructure/superstructure.h"
 
diff --git a/y2020/control_loops/superstructure/turret/aiming.h b/y2020/control_loops/superstructure/turret/aiming.h
index f38113d..45f690f 100644
--- a/y2020/control_loops/superstructure/turret/aiming.h
+++ b/y2020/control_loops/superstructure/turret/aiming.h
@@ -2,11 +2,11 @@
 #define y2020_CONTROL_LOOPS_SUPERSTRUCTURE_TURRET_AIMING_H_
 
 #include "aos/flatbuffers.h"
+#include "frc971/control_loops/aiming/aiming.h"
 #include "frc971/control_loops/drivetrain/drivetrain_status_generated.h"
 #include "frc971/control_loops/pose.h"
 #include "frc971/control_loops/profiled_subsystem_generated.h"
 #include "frc971/input/joystick_state_generated.h"
-#include "frc971/control_loops/aiming/aiming.h"
 #include "y2020/control_loops/superstructure/superstructure_status_generated.h"
 
 namespace y2020 {
@@ -62,7 +62,7 @@
   // position and shooter speed.
   double shot_distance_ = 0.0;  // meters
   // Real-world distance to the target.
-  double target_distance_ = 0.0;  // meters
+  double target_distance_ = 0.0;   // meters
   double inner_port_angle_ = 0.0;  // radians
 
   Eigen::Matrix<double, 2, 2> Tlr_to_la_;
diff --git a/y2020/control_loops/superstructure/turret/aiming_test.cc b/y2020/control_loops/superstructure/turret/aiming_test.cc
index fe71e31..b63d705 100644
--- a/y2020/control_loops/superstructure/turret/aiming_test.cc
+++ b/y2020/control_loops/superstructure/turret/aiming_test.cc
@@ -1,8 +1,9 @@
 #include "y2020/control_loops/superstructure/turret/aiming.h"
 
+#include "gtest/gtest.h"
+
 #include "aos/network/team_number.h"
 #include "frc971/control_loops/pose.h"
-#include "gtest/gtest.h"
 #include "y2020/constants.h"
 #include "y2020/control_loops/drivetrain/drivetrain_base.h"