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_bot3/actors/autonomous_actor.cc b/y2022_bot3/actors/autonomous_actor.cc
index 814921d..334c7c4 100644
--- a/y2022_bot3/actors/autonomous_actor.cc
+++ b/y2022_bot3/actors/autonomous_actor.cc
@@ -174,7 +174,8 @@
void AutonomousActor::SendSuperstructureGoal() {
auto builder = superstructure_goal_sender_.MakeBuilder();
- superstructure::Goal::Builder superstructure_builder = builder.MakeBuilder<superstructure::Goal>();
+ superstructure::Goal::Builder superstructure_builder =
+ builder.MakeBuilder<superstructure::Goal>();
if (builder.Send(superstructure_builder.Finish()) !=
aos::RawSender::Error::kOk) {
AOS_LOG(ERROR, "Sending superstructure goal failed.\n");
diff --git a/y2022_bot3/constants.cc b/y2022_bot3/constants.cc
index 2ecae68..7ec5187 100644
--- a/y2022_bot3/constants.cc
+++ b/y2022_bot3/constants.cc
@@ -8,9 +8,10 @@
#endif
#include "absl/base/call_once.h"
+#include "glog/logging.h"
+
#include "aos/mutex/mutex.h"
#include "aos/network/team_number.h"
-#include "glog/logging.h"
#include "y2022_bot3/control_loops/superstructure/climber/integral_climber_plant.h"
#include "y2022_bot3/control_loops/superstructure/intake/integral_intake_plant.h"
diff --git a/y2022_bot3/control_loops/superstructure/superstructure_lib_test.cc b/y2022_bot3/control_loops/superstructure/superstructure_lib_test.cc
index 8eb6064..614bc08 100644
--- a/y2022_bot3/control_loops/superstructure/superstructure_lib_test.cc
+++ b/y2022_bot3/control_loops/superstructure/superstructure_lib_test.cc
@@ -1,13 +1,14 @@
#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_bot3/control_loops/drivetrain/drivetrain_dog_motor_plant.h"
#include "y2022_bot3/control_loops/superstructure/superstructure.h"
diff --git a/y2022_bot3/control_loops/superstructure/superstructure_replay.cc b/y2022_bot3/control_loops/superstructure/superstructure_replay.cc
index 4e041fc..e7b81cd 100644
--- a/y2022_bot3/control_loops/superstructure/superstructure_replay.cc
+++ b/y2022_bot3/control_loops/superstructure/superstructure_replay.cc
@@ -3,6 +3,8 @@
// 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_bot3/constants.h"
#include "y2022_bot3/control_loops/superstructure/superstructure.h"
diff --git a/y2022_bot3/wpilib_interface.cc b/y2022_bot3/wpilib_interface.cc
index b1fb08a..b917ddb 100644
--- a/y2022_bot3/wpilib_interface.cc
+++ b/y2022_bot3/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"
@@ -89,10 +91,10 @@
}
// TODO(niko): Might have to move these to medium once we know the actual values
-constexpr double kMaxFastEncoderPulsesPerSecond = std::max(
- {Values::kMaxDrivetrainEncoderPulsesPerSecond(),
- Values::kMaxIntakeEncoderPulsesPerSecond(),
- Values::kMaxClimberEncoderPulsesPerSecond()});
+constexpr double kMaxFastEncoderPulsesPerSecond =
+ std::max({Values::kMaxDrivetrainEncoderPulsesPerSecond(),
+ Values::kMaxIntakeEncoderPulsesPerSecond(),
+ Values::kMaxClimberEncoderPulsesPerSecond()});
static_assert(kMaxFastEncoderPulsesPerSecond <= 1300000,
"fast encoders are too fast");
constexpr double kMaxMediumEncoderPulsesPerSecond = 0;
@@ -203,8 +205,8 @@
CopyPosition(climber_encoder_right_, &climber_right,
Values::kClimberEncoderCountsPerRevolution(),
(Values::kClimberEncoderRatio() *
- Values::kClimberEncoderCountsPerRevolution()) /
- (2.0 * M_PI),
+ Values::kClimberEncoderCountsPerRevolution()) /
+ (2.0 * M_PI),
climber_pot_translate, true,
values_->climber_right.potentiometer_offset);
@@ -212,8 +214,8 @@
CopyPosition(climber_encoder_left_, &climber_left,
Values::kClimberEncoderCountsPerRevolution(),
(Values::kClimberEncoderRatio() *
- Values::kClimberEncoderCountsPerRevolution()) /
- (2.0 * M_PI),
+ Values::kClimberEncoderCountsPerRevolution()) /
+ (2.0 * M_PI),
climber_pot_translate, true,
values_->climber_left.potentiometer_offset);