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/constants.cc b/y2022/constants.cc
index 21ba9e4..ff1c738 100644
--- a/y2022/constants.cc
+++ b/y2022/constants.cc
@@ -8,10 +8,11 @@
#endif
#include "absl/base/call_once.h"
+#include "glog/logging.h"
+
#include "aos/mutex/mutex.h"
#include "aos/network/team_number.h"
#include "frc971/wpilib/wpilib_utils.h"
-#include "glog/logging.h"
#include "y2022/control_loops/superstructure/catapult/integral_catapult_plant.h"
#include "y2022/control_loops/superstructure/climber/integral_climber_plant.h"
#include "y2022/control_loops/superstructure/intake/integral_intake_plant.h"
@@ -219,7 +220,7 @@
0.0172237531191 - 0.0172237531191 +
0.00443383743660001 - 0.0117667224279;
- intake_front->potentiometer_offset = + 3.572389;
+ intake_front->potentiometer_offset = +3.572389;
intake_front->subsystem_params.zeroing_constants
.measured_absolute_position = 0.238611243887673;
diff --git a/y2022/control_loops/drivetrain/drivetrain_base.cc b/y2022/control_loops/drivetrain/drivetrain_base.cc
index f18ebf2..c58353e 100644
--- a/y2022/control_loops/drivetrain/drivetrain_base.cc
+++ b/y2022/control_loops/drivetrain/drivetrain_base.cc
@@ -9,8 +9,8 @@
#include "y2022/control_loops/drivetrain/kalman_drivetrain_motor_plant.h"
#include "y2022/control_loops/drivetrain/polydrivetrain_dog_motor_plant.h"
-using ::frc971::control_loops::drivetrain::DrivetrainConfig;
using ::frc971::control_loops::drivetrain::DownEstimatorConfig;
+using ::frc971::control_loops::drivetrain::DrivetrainConfig;
namespace chrono = ::std::chrono;
diff --git a/y2022/control_loops/superstructure/catapult/catapult.cc b/y2022/control_loops/superstructure/catapult/catapult.cc
index cdffecd..b0ec6fd 100644
--- a/y2022/control_loops/superstructure/catapult/catapult.cc
+++ b/y2022/control_loops/superstructure/catapult/catapult.cc
@@ -2,9 +2,10 @@
#include "Eigen/Dense"
#include "Eigen/Sparse"
+#include "glog/logging.h"
+
#include "aos/realtime.h"
#include "aos/time/time.h"
-#include "glog/logging.h"
#include "osqp++.h"
#include "osqp.h"
#include "y2022/control_loops/superstructure/catapult/catapult_plant.h"
diff --git a/y2022/control_loops/superstructure/catapult/catapult.h b/y2022/control_loops/superstructure/catapult/catapult.h
index 12c0116..a4c82de 100644
--- a/y2022/control_loops/superstructure/catapult/catapult.h
+++ b/y2022/control_loops/superstructure/catapult/catapult.h
@@ -2,8 +2,9 @@
#define Y2022_CONTROL_LOOPS_SUPERSTRUCTURE_CATAPULT_CATAPULT_H_
#include "Eigen/Dense"
-#include "frc971/control_loops/state_feedback_loop.h"
#include "glog/logging.h"
+
+#include "frc971/control_loops/state_feedback_loop.h"
#include "osqp++.h"
#include "y2022/constants.h"
#include "y2022/control_loops/superstructure/superstructure_goal_generated.h"
diff --git a/y2022/control_loops/superstructure/catapult/catapult_test.cc b/y2022/control_loops/superstructure/catapult/catapult_test.cc
index b37c3e0..7361bcd 100644
--- a/y2022/control_loops/superstructure/catapult/catapult_test.cc
+++ b/y2022/control_loops/superstructure/catapult/catapult_test.cc
@@ -2,6 +2,7 @@
#include "glog/logging.h"
#include "gtest/gtest.h"
+
#include "y2022/control_loops/superstructure/catapult/catapult_plant.h"
namespace y2022 {
diff --git a/y2022/control_loops/superstructure/collision_avoidance_test.cc b/y2022/control_loops/superstructure/collision_avoidance_test.cc
index 7c53be3..09d1a50 100644
--- a/y2022/control_loops/superstructure/collision_avoidance_test.cc
+++ b/y2022/control_loops/superstructure/collision_avoidance_test.cc
@@ -1,9 +1,10 @@
#include "y2022/control_loops/superstructure/collision_avoidance.h"
-#include "aos/commonmath.h"
-#include "aos/flatbuffers.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
+
+#include "aos/commonmath.h"
+#include "aos/flatbuffers.h"
#include "y2022/control_loops/superstructure/superstructure_goal_generated.h"
#include "y2022/control_loops/superstructure/superstructure_status_generated.h"
diff --git a/y2022/control_loops/superstructure/led_indicator.cc b/y2022/control_loops/superstructure/led_indicator.cc
index b636250..11a46e9 100644
--- a/y2022/control_loops/superstructure/led_indicator.cc
+++ b/y2022/control_loops/superstructure/led_indicator.cc
@@ -30,7 +30,7 @@
candle_.ConfigAllSettings(config, 0);
event_loop_->AddPhasedLoop([&](int) { DecideColor(); },
- std::chrono::milliseconds(20));
+ std::chrono::milliseconds(20));
}
// This method will be called once per scheduler run
diff --git a/y2022/control_loops/superstructure/led_indicator.h b/y2022/control_loops/superstructure/led_indicator.h
index 71bc73b..932481f 100644
--- a/y2022/control_loops/superstructure/led_indicator.h
+++ b/y2022/control_loops/superstructure/led_indicator.h
@@ -1,10 +1,11 @@
#ifndef Y2022_CONTROL_LOOPS_SUPERSTRUCTURE_LED_INDICATOR_H_
#define Y2022_CONTROL_LOOPS_SUPERSTRUCTURE_LED_INDICATOR_H_
+#include "ctre/phoenix/led/CANdle.h"
+
#include "aos/events/event_loop.h"
#include "aos/network/message_bridge_client_generated.h"
#include "aos/network/message_bridge_server_generated.h"
-#include "ctre/phoenix/led/CANdle.h"
#include "frc971/control_loops/control_loop.h"
#include "frc971/control_loops/control_loops_generated.h"
#include "frc971/control_loops/drivetrain/drivetrain_output_generated.h"
diff --git a/y2022/control_loops/superstructure/superstructure_lib_test.cc b/y2022/control_loops/superstructure/superstructure_lib_test.cc
index 7e2acab..c85d5d0 100644
--- a/y2022/control_loops/superstructure/superstructure_lib_test.cc
+++ b/y2022/control_loops/superstructure/superstructure_lib_test.cc
@@ -1,19 +1,20 @@
#include <chrono>
#include <memory>
+#include "gtest/gtest.h"
+
#include "aos/events/logging/log_writer.h"
#include "frc971/control_loops/capped_test_plant.h"
#include "frc971/control_loops/control_loop_test.h"
#include "frc971/control_loops/position_sensor_sim.h"
+#include "frc971/control_loops/subsystem_simulator.h"
#include "frc971/control_loops/team_number_test_environment.h"
-#include "gtest/gtest.h"
#include "y2022/control_loops/drivetrain/drivetrain_dog_motor_plant.h"
#include "y2022/control_loops/superstructure/catapult/catapult_plant.h"
#include "y2022/control_loops/superstructure/climber/climber_plant.h"
#include "y2022/control_loops/superstructure/intake/intake_plant.h"
#include "y2022/control_loops/superstructure/superstructure.h"
#include "y2022/control_loops/superstructure/turret/turret_plant.h"
-#include "frc971/control_loops/subsystem_simulator.h"
DEFINE_string(output_folder, "",
"If set, logs all channels to the provided logfile.");
@@ -35,10 +36,11 @@
PotAndAbsoluteEncoderSubsystem;
typedef Superstructure::RelativeEncoderSubsystem RelativeEncoderSubsystem;
using DrivetrainStatus = ::frc971::control_loops::drivetrain::Status;
-using PotAndAbsoluteEncoderSimulator = frc971::control_loops::SubsystemSimulator<
- frc971::control_loops::PotAndAbsoluteEncoderProfiledJointStatus,
- PotAndAbsoluteEncoderSubsystem::State,
- constants::Values::PotAndAbsEncoderConstants>;
+using PotAndAbsoluteEncoderSimulator =
+ frc971::control_loops::SubsystemSimulator<
+ frc971::control_loops::PotAndAbsoluteEncoderProfiledJointStatus,
+ PotAndAbsoluteEncoderSubsystem::State,
+ constants::Values::PotAndAbsEncoderConstants>;
using RelativeEncoderSimulator = frc971::control_loops::SubsystemSimulator<
frc971::control_loops::RelativeEncoderProfiledJointStatus,
RelativeEncoderSubsystem::State, constants::Values::PotConstants>;
diff --git a/y2022/control_loops/superstructure/superstructure_replay.cc b/y2022/control_loops/superstructure/superstructure_replay.cc
index b05cdb9..d7f03e6 100644
--- a/y2022/control_loops/superstructure/superstructure_replay.cc
+++ b/y2022/control_loops/superstructure/superstructure_replay.cc
@@ -1,8 +1,10 @@
-// This binary allows us to replay the superstructure code over existing logfile.
-// When you run this code, it generates a new logfile with the data all
+// This binary allows us to replay the superstructure code over existing
+// logfile. When you run this code, it generates a new logfile with the data all
// replayed, so that it can then be run through the plotting tool or analyzed
// in some other way. The original superstructure status data will be on the
// /original/superstructure channel.
+#include "gflags/gflags.h"
+
#include "aos/events/logging/log_reader.h"
#include "aos/events/logging/log_writer.h"
#include "aos/events/simulated_event_loop.h"
@@ -10,7 +12,6 @@
#include "aos/json_to_flatbuffer.h"
#include "aos/logging/log_message_generated.h"
#include "aos/network/team_number.h"
-#include "gflags/gflags.h"
#include "y2022/constants.h"
#include "y2022/control_loops/superstructure/superstructure.h"
diff --git a/y2022/localizer/kernel/adis16505.c b/y2022/localizer/kernel/adis16505.c
index 963ca4a..f0eb6ae 100644
--- a/y2022/localizer/kernel/adis16505.c
+++ b/y2022/localizer/kernel/adis16505.c
@@ -8,14 +8,12 @@
#include <linux/kernel.h> /* Needed for pr_info() */
#include <linux/kfifo.h>
#include <linux/module.h> /* Needed by all modules */
-#include <linux/poll.h>
-
-#include <linux/of_gpio.h>
-#include <linux/spi/spi.h>
-#include <linux/of_address.h>
#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_gpio.h>
#include <linux/of_platform.h>
-
+#include <linux/poll.h>
+#include <linux/spi/spi.h>
MODULE_LICENSE("GPL");
MODULE_AUTHOR("frc971");
@@ -115,10 +113,10 @@
return -EAGAIN;
}
- err = wait_event_interruptible(ts->wq,
- (spin_lock(&ts->fifo_read_lock),
- empty = !kfifo_is_empty(&ts->fifo),
- spin_unlock(&ts->fifo_read_lock), empty));
+ err = wait_event_interruptible(
+ ts->wq,
+ (spin_lock(&ts->fifo_read_lock), empty = !kfifo_is_empty(&ts->fifo),
+ spin_unlock(&ts->fifo_read_lock), empty));
if (err != 0) {
return err;
}
@@ -330,4 +328,4 @@
.remove = adis16505_remove,
};
-module_spi_driver(adis16505_driver);
+module_spi_driver(adis16505_driver);
diff --git a/y2022/localizer/localizer.cc b/y2022/localizer/localizer.cc
index ec81573..b774e18 100644
--- a/y2022/localizer/localizer.cc
+++ b/y2022/localizer/localizer.cc
@@ -909,43 +909,43 @@
absl::StrCat("/", kPisToUse[camera_index], "/camera"));
}
aos::TimerHandler *estimate_timer = event_loop_->AddTimer([this]() {
- const bool maybe_in_auto = utils_.MaybeInAutonomous();
- model_based_.set_use_aggressive_image_corrections(!maybe_in_auto);
- for (size_t camera_index = 0; camera_index < kPisToUse.size();
- ++camera_index) {
- if (model_based_.NumQueuedImageDebugs() ==
- ModelBasedLocalizer::kDebugBufferSize ||
- (last_visualization_send_ + kMinVisualizationPeriod <
- event_loop_->monotonic_now())) {
- auto builder = visualization_sender_.MakeBuilder();
- visualization_sender_.CheckOk(
- builder.Send(model_based_.PopulateVisualization(builder.fbb())));
+ const bool maybe_in_auto = utils_.MaybeInAutonomous();
+ model_based_.set_use_aggressive_image_corrections(!maybe_in_auto);
+ for (size_t camera_index = 0; camera_index < kPisToUse.size();
+ ++camera_index) {
+ if (model_based_.NumQueuedImageDebugs() ==
+ ModelBasedLocalizer::kDebugBufferSize ||
+ (last_visualization_send_ + kMinVisualizationPeriod <
+ event_loop_->monotonic_now())) {
+ auto builder = visualization_sender_.MakeBuilder();
+ visualization_sender_.CheckOk(
+ builder.Send(model_based_.PopulateVisualization(builder.fbb())));
+ }
+ if (target_estimate_fetchers_[camera_index].Fetch()) {
+ const std::optional<aos::monotonic_clock::duration> monotonic_offset =
+ utils_.ClockOffset(kPisToUse[camera_index]);
+ if (!monotonic_offset.has_value()) {
+ model_based_.TallyRejection(
+ RejectionReason::MESSAGE_BRIDGE_DISCONNECTED);
+ continue;
}
- if (target_estimate_fetchers_[camera_index].Fetch()) {
- const std::optional<aos::monotonic_clock::duration> monotonic_offset =
- utils_.ClockOffset(kPisToUse[camera_index]);
- if (!monotonic_offset.has_value()) {
- model_based_.TallyRejection(
- RejectionReason::MESSAGE_BRIDGE_DISCONNECTED);
- continue;
- }
- // TODO(james): Get timestamp from message contents.
- aos::monotonic_clock::time_point capture_time(
- target_estimate_fetchers_[camera_index]
- .context()
- .monotonic_remote_time -
- monotonic_offset.value());
- if (capture_time > target_estimate_fetchers_[camera_index]
- .context()
- .monotonic_event_time) {
- model_based_.TallyRejection(RejectionReason::IMAGE_FROM_FUTURE);
- continue;
- }
- capture_time -= imu_watcher_.pico_offset_error();
- model_based_.HandleImageMatch(
- capture_time, target_estimate_fetchers_[camera_index].get(),
- camera_index);
+ // TODO(james): Get timestamp from message contents.
+ aos::monotonic_clock::time_point capture_time(
+ target_estimate_fetchers_[camera_index]
+ .context()
+ .monotonic_remote_time -
+ monotonic_offset.value());
+ if (capture_time > target_estimate_fetchers_[camera_index]
+ .context()
+ .monotonic_event_time) {
+ model_based_.TallyRejection(RejectionReason::IMAGE_FROM_FUTURE);
+ continue;
}
+ capture_time -= imu_watcher_.pico_offset_error();
+ model_based_.HandleImageMatch(
+ capture_time, target_estimate_fetchers_[camera_index].get(),
+ camera_index);
+ }
}
});
event_loop_->OnRun([this, estimate_timer]() {
@@ -959,7 +959,6 @@
aos::monotonic_clock::time_point sample_time_pi,
std::optional<Eigen::Vector2d> encoders, Eigen::Vector3d gyro,
Eigen::Vector3d accel) {
-
model_based_.HandleImu(
sample_time_pico, gyro, accel, encoders,
utils_.VoltageOrZero(event_loop_->context().monotonic_event_time));
diff --git a/y2022/localizer/localizer.h b/y2022/localizer/localizer.h
index 59ad75c..fb56436 100644
--- a/y2022/localizer/localizer.h
+++ b/y2022/localizer/localizer.h
@@ -3,6 +3,7 @@
#include "Eigen/Dense"
#include "Eigen/Geometry"
+
#include "aos/containers/ring_buffer.h"
#include "aos/containers/sized_array.h"
#include "aos/events/event_loop.h"
diff --git a/y2022/localizer/localizer_main.cc b/y2022/localizer/localizer_main.cc
index fab1d51..29c2f1e 100644
--- a/y2022/localizer/localizer_main.cc
+++ b/y2022/localizer/localizer_main.cc
@@ -1,7 +1,7 @@
#include "aos/events/shm_event_loop.h"
#include "aos/init.h"
-#include "y2022/localizer/localizer.h"
#include "y2022/control_loops/drivetrain/drivetrain_base.h"
+#include "y2022/localizer/localizer.h"
DEFINE_string(config, "aos_config.json", "Path to the config file to use.");
diff --git a/y2022/localizer/localizer_replay.cc b/y2022/localizer/localizer_replay.cc
index 6dcbb1e..e706421 100644
--- a/y2022/localizer/localizer_replay.cc
+++ b/y2022/localizer/localizer_replay.cc
@@ -1,15 +1,16 @@
+#include "gflags/gflags.h"
+
#include "aos/configuration.h"
#include "aos/events/logging/log_reader.h"
#include "aos/events/logging/log_writer.h"
-#include "aos/util/simulation_logger.h"
#include "aos/events/simulated_event_loop.h"
#include "aos/init.h"
#include "aos/json_to_flatbuffer.h"
#include "aos/network/team_number.h"
+#include "aos/util/simulation_logger.h"
+#include "y2022/control_loops/drivetrain/drivetrain_base.h"
#include "y2022/localizer/localizer.h"
#include "y2022/localizer/localizer_schema.h"
-#include "gflags/gflags.h"
-#include "y2022/control_loops/drivetrain/drivetrain_base.h"
DEFINE_string(config, "y2022/aos_config.json",
"Name of the config file to replay using.");
@@ -39,10 +40,8 @@
// open logfiles
aos::logger::LogReader reader(logfiles, &config.message());
- reader.RemapLoggedChannel("/localizer",
- "frc971.controls.LocalizerStatus");
- reader.RemapLoggedChannel("/localizer",
- "frc971.controls.LocalizerOutput");
+ reader.RemapLoggedChannel("/localizer", "frc971.controls.LocalizerStatus");
+ reader.RemapLoggedChannel("/localizer", "frc971.controls.LocalizerOutput");
reader.RemapLoggedChannel("/localizer",
"frc971.controls.LocalizerVisualization");
diff --git a/y2022/localizer/localizer_test.cc b/y2022/localizer/localizer_test.cc
index ef14972..6083143 100644
--- a/y2022/localizer/localizer_test.cc
+++ b/y2022/localizer/localizer_test.cc
@@ -1,10 +1,11 @@
#include "y2022/localizer/localizer.h"
+#include "gtest/gtest.h"
+
#include "aos/events/logging/log_writer.h"
#include "aos/events/simulated_event_loop.h"
#include "frc971/control_loops/drivetrain/drivetrain_test_lib.h"
#include "frc971/control_loops/pose.h"
-#include "gtest/gtest.h"
#include "y2022/control_loops/drivetrain/drivetrain_base.h"
#include "y2022/control_loops/superstructure/superstructure_status_generated.h"
#include "y2022/vision/target_estimate_generated.h"
diff --git a/y2022/setpoint_setter.cc b/y2022/setpoint_setter.cc
index b588636..fa1e536 100644
--- a/y2022/setpoint_setter.cc
+++ b/y2022/setpoint_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 "y2022/setpoint_generated.h"
DEFINE_double(catapult_position, 0.03, "Catapult shot position");
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"
diff --git a/y2022/wpilib_interface.cc b/y2022/wpilib_interface.cc
index 8df3a3a..39e8dd2 100644
--- a/y2022/wpilib_interface.cc
+++ b/y2022/wpilib_interface.cc
@@ -12,6 +12,7 @@
#include <thread>
#include "ctre/phoenix/CANifier.h"
+
#include "frc971/wpilib/ahal/AnalogInput.h"
#include "frc971/wpilib/ahal/Counter.h"
#include "frc971/wpilib/ahal/DigitalGlitchFilter.h"
@@ -22,6 +23,9 @@
#include "frc971/wpilib/ahal/VictorSP.h"
#undef ERROR
+#include "ctre/phoenix/motorcontrol/can/TalonFX.h"
+#include "ctre/phoenix/motorcontrol/can/TalonSRX.h"
+
#include "aos/commonmath.h"
#include "aos/events/event_loop.h"
#include "aos/events/shm_event_loop.h"
@@ -32,8 +36,6 @@
#include "aos/util/log_interval.h"
#include "aos/util/phased_loop.h"
#include "aos/util/wrapping_counter.h"
-#include "ctre/phoenix/motorcontrol/can/TalonFX.h"
-#include "ctre/phoenix/motorcontrol/can/TalonSRX.h"
#include "frc971/autonomous/auto_mode_generated.h"
#include "frc971/control_loops/drivetrain/drivetrain_position_generated.h"
#include "frc971/input/robot_state_generated.h"