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/y2023/vision/BUILD b/y2023/vision/BUILD
index ca057fd..d5168c1 100644
--- a/y2023/vision/BUILD
+++ b/y2023/vision/BUILD
@@ -86,6 +86,7 @@
"//third_party:opencv",
"//y2023/constants:constants_fbs",
"//y2023/constants:simulated_constants_sender",
+ "@org_tuxfamily_eigen//:eigen",
],
)
@@ -122,6 +123,7 @@
"//third_party:opencv",
"//third_party/apriltag",
"//y2023/constants:constants_fbs",
+ "@org_tuxfamily_eigen//:eigen",
],
)
diff --git a/y2023/vision/april_detection_test.cc b/y2023/vision/april_detection_test.cc
index b92557c..fea5105 100644
--- a/y2023/vision/april_detection_test.cc
+++ b/y2023/vision/april_detection_test.cc
@@ -1,17 +1,18 @@
#include <string>
+#include "glog/logging.h"
+#include "gtest/gtest.h"
+
#include "aos/events/simulated_event_loop.h"
#include "aos/flatbuffer_merge.h"
#include "aos/json_to_flatbuffer.h"
#include "aos/testing/path.h"
-#include "aprilrobotics.h"
#include "frc971/constants/constants_sender_lib.h"
#include "frc971/vision/target_mapper.h"
#include "frc971/vision/vision_generated.h"
-#include "glog/logging.h"
-#include "gtest/gtest.h"
#include "y2023/constants/constants_generated.h"
#include "y2023/constants/constants_list_generated.h"
+#include "y2023/vision/aprilrobotics.h"
namespace y2023::vision::testing {
class AprilDetectionTest : public ::testing::Test {
diff --git a/y2023/vision/aprilrobotics.h b/y2023/vision/aprilrobotics.h
index 01e3138..123f352 100644
--- a/y2023/vision/aprilrobotics.h
+++ b/y2023/vision/aprilrobotics.h
@@ -1,6 +1,13 @@
#include <string>
+#include "Eigen/Dense"
+#include "opencv2/core/eigen.hpp"
+#include "opencv2/imgproc.hpp"
+#include "third_party/apriltag/apriltag.h"
+#include "third_party/apriltag/apriltag_pose.h"
+#include "third_party/apriltag/tag16h5.h"
+
#include "aos/events/event_loop.h"
#include "aos/events/shm_event_loop.h"
#include "aos/network/team_number.h"
@@ -12,11 +19,6 @@
#include "frc971/vision/target_mapper.h"
#include "frc971/vision/vision_generated.h"
#include "frc971/vision/visualize_robot.h"
-#include "opencv2/core/eigen.hpp"
-#include "opencv2/imgproc.hpp"
-#include "third_party/apriltag/apriltag.h"
-#include "third_party/apriltag/apriltag_pose.h"
-#include "third_party/apriltag/tag16h5.h"
#include "y2023/constants/constants_generated.h"
namespace y2023 {
diff --git a/y2023/vision/aprilrobotics_main.cc b/y2023/vision/aprilrobotics_main.cc
index 6870ae1..5e5bad7 100644
--- a/y2023/vision/aprilrobotics_main.cc
+++ b/y2023/vision/aprilrobotics_main.cc
@@ -1,7 +1,7 @@
#include "aos/events/shm_event_loop.h"
#include "aos/init.h"
-#include "y2023/vision/aprilrobotics.h"
#include "frc971/constants/constants_sender_lib.h"
+#include "y2023/vision/aprilrobotics.h"
DEFINE_string(config, "aos_config.json", "Path to the config file to use.");
diff --git a/y2023/vision/calibrate_extrinsics.cc b/y2023/vision/calibrate_extrinsics.cc
index 7e650a3..91bdefd 100644
--- a/y2023/vision/calibrate_extrinsics.cc
+++ b/y2023/vision/calibrate_extrinsics.cc
@@ -1,7 +1,8 @@
#include "Eigen/Dense"
#include "Eigen/Geometry"
-
#include "absl/strings/str_format.h"
+#include <opencv2/core/eigen.hpp>
+
#include "aos/events/logging/log_reader.h"
#include "aos/events/logging/log_writer.h"
#include "aos/init.h"
@@ -16,8 +17,6 @@
#include "y2023/constants/constants_generated.h"
#include "y2023/vision/vision_util.h"
-#include <opencv2/core/eigen.hpp>
-
DEFINE_string(pi, "pi-7971-2", "Pi name to calibrate.");
DEFINE_bool(plot, false, "Whether to plot the resulting data.");
DEFINE_string(target_type, "charuco_diamond",
diff --git a/y2023/vision/camera_reader.cc b/y2023/vision/camera_reader.cc
index 3001c04..d5f39a0 100644
--- a/y2023/vision/camera_reader.cc
+++ b/y2023/vision/camera_reader.cc
@@ -3,6 +3,7 @@
#include "absl/strings/str_cat.h"
#include "absl/strings/str_split.h"
+
#include "aos/events/shm_event_loop.h"
#include "aos/init.h"
#include "aos/realtime.h"
diff --git a/y2023/vision/foxglove_image_converter.cc b/y2023/vision/foxglove_image_converter.cc
index 8f3032b..bfaafc8 100644
--- a/y2023/vision/foxglove_image_converter.cc
+++ b/y2023/vision/foxglove_image_converter.cc
@@ -1,7 +1,6 @@
-#include "frc971/vision/foxglove_image_converter_lib.h"
-
-#include "aos/init.h"
#include "aos/events/shm_event_loop.h"
+#include "aos/init.h"
+#include "frc971/vision/foxglove_image_converter_lib.h"
DEFINE_string(config, "aos_config.json", "Path to the config file to use.");
diff --git a/y2023/vision/game_pieces.h b/y2023/vision/game_pieces.h
index a99a99b..442d95c 100644
--- a/y2023/vision/game_pieces.h
+++ b/y2023/vision/game_pieces.h
@@ -4,7 +4,6 @@
#include "aos/events/shm_event_loop.h"
#include "frc971/vision/vision_generated.h"
#include "y2023/vision/game_pieces_generated.h"
-
#include "y2023/vision/yolov5.h"
namespace y2023 {
diff --git a/y2023/vision/image_logger.cc b/y2023/vision/image_logger.cc
index 29a95db..c2cfa0a 100644
--- a/y2023/vision/image_logger.cc
+++ b/y2023/vision/image_logger.cc
@@ -1,14 +1,15 @@
#include <sys/resource.h>
#include <sys/time.h>
+#include "gflags/gflags.h"
+#include "glog/logging.h"
+
#include "aos/configuration.h"
#include "aos/events/logging/log_writer.h"
#include "aos/events/shm_event_loop.h"
#include "aos/init.h"
#include "aos/logging/log_namer.h"
#include "frc971/input/joystick_state_generated.h"
-#include "gflags/gflags.h"
-#include "glog/logging.h"
DEFINE_string(config, "aos_config.json", "Config file to use.");
diff --git a/y2023/vision/localization_verifier.cc b/y2023/vision/localization_verifier.cc
index 3b366fa..c16f874 100644
--- a/y2023/vision/localization_verifier.cc
+++ b/y2023/vision/localization_verifier.cc
@@ -1,8 +1,9 @@
+#include "glog/logging.h"
+
#include "aos/init.h"
#include "frc971/constants/constants_sender_lib.h"
#include "frc971/control_loops/drivetrain/localization/localizer_output_generated.h"
#include "frc971/vision/vision_generated.h"
-#include "glog/logging.h"
#include "y2023/localizer/localizer.h"
#include "y2023/localizer/utils.h"
@@ -89,12 +90,12 @@
const std::string_view pi_name =
camera->calibration()->node_name()->string_view();
- event_loop.MakeWatcher(absl::StrCat("/", pi_name, "/camera"),
- [H_robot_camera, &localizer_fetcher](
- const frc971::vision::TargetMap &target_map) {
- HandleDetections(target_map, H_robot_camera,
- &localizer_fetcher);
- });
+ event_loop.MakeWatcher(
+ absl::StrCat("/", pi_name, "/camera"),
+ [H_robot_camera,
+ &localizer_fetcher](const frc971::vision::TargetMap &target_map) {
+ HandleDetections(target_map, H_robot_camera, &localizer_fetcher);
+ });
}
event_loop.Run();
}
diff --git a/y2023/vision/target_mapping.cc b/y2023/vision/target_mapping.cc
index 804583c..985a412 100644
--- a/y2023/vision/target_mapping.cc
+++ b/y2023/vision/target_mapping.cc
@@ -1,3 +1,12 @@
+#include "Eigen/Dense"
+#include "opencv2/aruco.hpp"
+#include "opencv2/calib3d.hpp"
+#include "opencv2/core/eigen.hpp"
+#include "opencv2/features2d.hpp"
+#include "opencv2/highgui.hpp"
+#include "opencv2/highgui/highgui.hpp"
+#include "opencv2/imgproc.hpp"
+
#include "aos/configuration.h"
#include "aos/events/logging/log_reader.h"
#include "aos/events/simulated_event_loop.h"
@@ -7,13 +16,6 @@
#include "frc971/vision/calibration_generated.h"
#include "frc971/vision/target_mapper.h"
#include "frc971/vision/visualize_robot.h"
-#include "opencv2/aruco.hpp"
-#include "opencv2/calib3d.hpp"
-#include "opencv2/core/eigen.hpp"
-#include "opencv2/features2d.hpp"
-#include "opencv2/highgui.hpp"
-#include "opencv2/highgui/highgui.hpp"
-#include "opencv2/imgproc.hpp"
#include "y2023/constants/simulated_constants_sender.h"
#include "y2023/vision/aprilrobotics.h"
#include "y2023/vision/vision_util.h"
diff --git a/y2023/vision/viewer.cc b/y2023/vision/viewer.cc
index 4fb96bc..b518a8e 100644
--- a/y2023/vision/viewer.cc
+++ b/y2023/vision/viewer.cc
@@ -1,15 +1,15 @@
+#include "absl/strings/match.h"
+#include "opencv2/calib3d.hpp"
+#include "opencv2/imgproc.hpp"
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc.hpp>
-#include "absl/strings/match.h"
#include "aos/events/shm_event_loop.h"
#include "aos/init.h"
#include "aos/json_to_flatbuffer.h"
#include "aos/time/time.h"
#include "frc971/constants/constants_sender_lib.h"
#include "frc971/vision/vision_generated.h"
-#include "opencv2/calib3d.hpp"
-#include "opencv2/imgproc.hpp"
#include "y2023/vision/vision_util.h"
DEFINE_string(config, "aos_config.json", "Path to the config file to use.");
diff --git a/y2023/vision/vision_util.h b/y2023/vision/vision_util.h
index 79f5c92..1f4d099 100644
--- a/y2023/vision/vision_util.h
+++ b/y2023/vision/vision_util.h
@@ -3,6 +3,7 @@
#include <string_view>
#include "opencv2/imgproc.hpp"
+
#include "y2023/constants/constants_generated.h"
namespace y2023::vision {
diff --git a/y2023/vision/yolov5.cc b/y2023/vision/yolov5.cc
index 7df4ffb..11f3a49 100644
--- a/y2023/vision/yolov5.cc
+++ b/y2023/vision/yolov5.cc
@@ -8,12 +8,12 @@
#include <tflite/public/edgetpu_c.h>
#include <chrono>
-#include <opencv2/dnn.hpp>
#include <string>
#include "absl/types/span.h"
#include "gflags/gflags.h"
#include "glog/logging.h"
+#include <opencv2/dnn.hpp>
DEFINE_double(conf_threshold, 0.9,
"Threshold value for confidence scores. Detections with a "
diff --git a/y2023/vision/yolov5.h b/y2023/vision/yolov5.h
index 7e2a521..9853b4f 100644
--- a/y2023/vision/yolov5.h
+++ b/y2023/vision/yolov5.h
@@ -6,11 +6,12 @@
#include <cstdint>
#include <fstream>
#include <iostream>
+#include <vector>
+
#include <opencv2/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/imgproc.hpp>
-#include <vector>
namespace y2023 {
namespace vision {