Upgrade wpiformat and use clang-format's include sorting (#8350)

This PR also uses the newly added -default-branch flag to generate the list of changed files with respect to the correct branch (2027).
This commit is contained in:
Tyler Veness
2025-11-11 18:05:12 -08:00
committed by GitHub
parent a0f4727179
commit 1705b2d61c
321 changed files with 677 additions and 628 deletions

View File

@@ -2,10 +2,10 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include <gtest/gtest.h>
#include "wpi/math/util/ComputerVisionUtil.hpp"
#include <gtest/gtest.h>
TEST(ComputerVisionUtilTest, ObjectToRobotPose) {
wpi::math::Pose3d robot{1_m, 2_m, 0_m,
wpi::math::Rotation3d{0_deg, 0_deg, 30_deg}};

View File

@@ -2,6 +2,8 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/linalg/DARE.hpp"
#include <stdexcept>
#include <Eigen/Core>
@@ -9,7 +11,6 @@
#include <gtest/gtest.h>
#include "wpi/math/fmt/Eigen.hpp"
#include "wpi/math/linalg/DARE.hpp"
#include "wpi/math/linalg/EigenCore.hpp"
#include "wpi/util/expected"
#include "wpi/util/print.hpp"

View File

@@ -2,6 +2,8 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/util/MathUtil.hpp"
#include <limits>
#include <numbers>
@@ -9,7 +11,6 @@
#include "wpi/math/geometry/Translation2d.hpp"
#include "wpi/math/geometry/Translation3d.hpp"
#include "wpi/math/util/MathUtil.hpp"
#include "wpi/units/angle.hpp"
#include "wpi/units/length.hpp"
#include "wpi/units/time.hpp"

View File

@@ -2,10 +2,11 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/util/StateSpaceUtil.hpp"
#include <gtest/gtest.h>
#include "wpi/math/linalg/EigenCore.hpp"
#include "wpi/math/util/StateSpaceUtil.hpp"
TEST(StateSpaceUtilTest, CostParameterPack) {
constexpr wpi::math::Matrixd<3, 3> mat =

View File

@@ -2,12 +2,13 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/controller/ArmFeedforward.hpp"
#include <cmath>
#include <numbers>
#include <gtest/gtest.h>
#include "wpi/math/controller/ArmFeedforward.hpp"
#include "wpi/math/linalg/EigenCore.hpp"
#include "wpi/math/system/NumericalIntegration.hpp"
#include "wpi/units/angular_acceleration.hpp"

View File

@@ -2,9 +2,10 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/controller/ControlAffinePlantInversionFeedforward.hpp"
#include <gtest/gtest.h>
#include "wpi/math/controller/ControlAffinePlantInversionFeedforward.hpp"
#include "wpi/math/linalg/EigenCore.hpp"
#include "wpi/units/time.hpp"

View File

@@ -2,9 +2,10 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/controller/DifferentialDriveAccelerationLimiter.hpp"
#include <gtest/gtest.h>
#include "wpi/math/controller/DifferentialDriveAccelerationLimiter.hpp"
#include "wpi/math/system/plant/LinearSystemId.hpp"
#include "wpi/units/math.hpp"

View File

@@ -2,12 +2,13 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/controller/DifferentialDriveFeedforward.hpp"
#include <cmath>
#include <Eigen/Core>
#include <gtest/gtest.h>
#include "wpi/math/controller/DifferentialDriveFeedforward.hpp"
#include "wpi/math/controller/LinearPlantInversionFeedforward.hpp"
#include "wpi/math/system/plant/LinearSystemId.hpp"
#include "wpi/units/acceleration.hpp"

View File

@@ -2,11 +2,12 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/controller/ElevatorFeedforward.hpp"
#include <cmath>
#include <gtest/gtest.h>
#include "wpi/math/controller/ElevatorFeedforward.hpp"
#include "wpi/math/controller/LinearPlantInversionFeedforward.hpp"
#include "wpi/math/linalg/EigenCore.hpp"
#include "wpi/units/acceleration.hpp"

View File

@@ -2,9 +2,10 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/controller/ImplicitModelFollower.hpp"
#include <gtest/gtest.h>
#include "wpi/math/controller/ImplicitModelFollower.hpp"
#include "wpi/math/system/plant/LinearSystemId.hpp"
namespace wpi::math {

View File

@@ -2,11 +2,12 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/controller/LTVDifferentialDriveController.hpp"
#include <cmath>
#include <gtest/gtest.h>
#include "wpi/math/controller/LTVDifferentialDriveController.hpp"
#include "wpi/math/system/NumericalIntegration.hpp"
#include "wpi/math/system/plant/LinearSystemId.hpp"
#include "wpi/math/trajectory/TrajectoryGenerator.hpp"

View File

@@ -2,9 +2,10 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/controller/LTVUnicycleController.hpp"
#include <gtest/gtest.h>
#include "wpi/math/controller/LTVUnicycleController.hpp"
#include "wpi/math/trajectory/TrajectoryGenerator.hpp"
#include "wpi/math/util/MathUtil.hpp"
#include "wpi/units/math.hpp"

View File

@@ -2,11 +2,12 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/controller/LinearPlantInversionFeedforward.hpp"
#include <cmath>
#include <gtest/gtest.h>
#include "wpi/math/controller/LinearPlantInversionFeedforward.hpp"
#include "wpi/math/linalg/EigenCore.hpp"
#include "wpi/units/time.hpp"

View File

@@ -2,11 +2,12 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/controller/LinearQuadraticRegulator.hpp"
#include <cmath>
#include <gtest/gtest.h>
#include "wpi/math/controller/LinearQuadraticRegulator.hpp"
#include "wpi/math/linalg/EigenCore.hpp"
#include "wpi/math/system/LinearSystem.hpp"
#include "wpi/math/system/plant/DCMotor.hpp"

View File

@@ -2,12 +2,13 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/controller/SimpleMotorFeedforward.hpp"
#include <cmath>
#include <gtest/gtest.h>
#include "wpi/math/controller/LinearPlantInversionFeedforward.hpp"
#include "wpi/math/controller/SimpleMotorFeedforward.hpp"
#include "wpi/math/linalg/EigenCore.hpp"
#include "wpi/units/acceleration.hpp"
#include "wpi/units/length.hpp"

View File

@@ -2,11 +2,12 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/controller/proto/SimpleMotorFeedforwardProto.hpp"
#include <gtest/gtest.h>
#include "../../ProtoTestBase.hpp"
#include "wpi/math/controller/SimpleMotorFeedforward.hpp"
#include "wpi/math/controller/proto/SimpleMotorFeedforwardProto.hpp"
#include "wpi/units/acceleration.hpp"
#include "wpi/units/velocity.hpp"

View File

@@ -2,11 +2,12 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/controller/struct/SimpleMotorFeedforwardStruct.hpp"
#include <gtest/gtest.h>
#include "../../StructTestBase.hpp"
#include "wpi/math/controller/SimpleMotorFeedforward.hpp"
#include "wpi/math/controller/struct/SimpleMotorFeedforwardStruct.hpp"
#include "wpi/units/acceleration.hpp"
#include "wpi/units/velocity.hpp"

View File

@@ -2,11 +2,12 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/estimator/AngleStatistics.hpp"
#include <numbers>
#include <gtest/gtest.h>
#include "wpi/math/estimator/AngleStatistics.hpp"
#include "wpi/math/linalg/EigenCore.hpp"
TEST(AngleStatisticsTest, Mean) {

View File

@@ -2,6 +2,8 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/estimator/DifferentialDrivePoseEstimator3d.hpp"
#include <limits>
#include <random>
#include <tuple>
@@ -10,7 +12,6 @@
#include <gtest/gtest.h>
#include "wpi/math/estimator/DifferentialDrivePoseEstimator3d.hpp"
#include "wpi/math/geometry/Pose2d.hpp"
#include "wpi/math/geometry/Rotation2d.hpp"
#include "wpi/math/kinematics/DifferentialDriveKinematics.hpp"

View File

@@ -2,6 +2,8 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/estimator/DifferentialDrivePoseEstimator.hpp"
#include <limits>
#include <numbers>
#include <random>
@@ -11,7 +13,6 @@
#include <gtest/gtest.h>
#include "wpi/math/estimator/DifferentialDrivePoseEstimator.hpp"
#include "wpi/math/geometry/Pose2d.hpp"
#include "wpi/math/geometry/Rotation2d.hpp"
#include "wpi/math/kinematics/DifferentialDriveKinematics.hpp"

View File

@@ -2,13 +2,14 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/estimator/ExtendedKalmanFilter.hpp"
#include <cmath>
#include <vector>
#include <Eigen/QR>
#include <gtest/gtest.h>
#include "wpi/math/estimator/ExtendedKalmanFilter.hpp"
#include "wpi/math/linalg/EigenCore.hpp"
#include "wpi/math/system/NumericalJacobian.hpp"
#include "wpi/math/system/plant/DCMotor.hpp"

View File

@@ -2,13 +2,14 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/estimator/KalmanFilter.hpp"
#include <array>
#include <cmath>
#include <Eigen/Core>
#include <gtest/gtest.h>
#include "wpi/math/estimator/KalmanFilter.hpp"
#include "wpi/math/system/plant/DCMotor.hpp"
#include "wpi/math/system/plant/LinearSystemId.hpp"
#include "wpi/units/moment_of_inertia.hpp"

View File

@@ -2,6 +2,8 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/estimator/MecanumDrivePoseEstimator3d.hpp"
#include <limits>
#include <random>
#include <tuple>
@@ -9,7 +11,6 @@
#include <gtest/gtest.h>
#include "wpi/math/estimator/MecanumDrivePoseEstimator3d.hpp"
#include "wpi/math/geometry/Pose2d.hpp"
#include "wpi/math/kinematics/MecanumDriveKinematics.hpp"
#include "wpi/math/trajectory/TrajectoryGenerator.hpp"

View File

@@ -2,6 +2,8 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/estimator/MecanumDrivePoseEstimator.hpp"
#include <limits>
#include <numbers>
#include <random>
@@ -10,7 +12,6 @@
#include <gtest/gtest.h>
#include "wpi/math/estimator/MecanumDrivePoseEstimator.hpp"
#include "wpi/math/geometry/Pose2d.hpp"
#include "wpi/math/kinematics/MecanumDriveKinematics.hpp"
#include "wpi/math/trajectory/TrajectoryGenerator.hpp"

View File

@@ -2,10 +2,10 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include <gtest/gtest.h>
#include "wpi/math/estimator/MerweScaledSigmaPoints.hpp"
#include <gtest/gtest.h>
TEST(MerweScaledSigmaPointsTest, ZeroMean) {
wpi::math::MerweScaledSigmaPoints<2> sigmaPoints;
auto points = sigmaPoints.SquareRootSigmaPoints(

View File

@@ -2,6 +2,8 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/estimator/MerweUKF.hpp"
#include <algorithm>
#include <cmath>
#include <numbers>
@@ -11,7 +13,6 @@
#include <gtest/gtest.h>
#include "wpi/math/estimator/AngleStatistics.hpp"
#include "wpi/math/estimator/MerweUKF.hpp"
#include "wpi/math/linalg/EigenCore.hpp"
#include "wpi/math/system/Discretization.hpp"
#include "wpi/math/system/NumericalIntegration.hpp"

View File

@@ -2,10 +2,10 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include <gtest/gtest.h>
#include "wpi/math/estimator/S3SigmaPoints.hpp"
#include <gtest/gtest.h>
TEST(S3SigmaPointsTest, Simplex) {
constexpr double alpha = 1e-3;
constexpr double beta = 2;

View File

@@ -2,6 +2,8 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/estimator/S3UKF.hpp"
#include <algorithm>
#include <cmath>
#include <numbers>
@@ -11,7 +13,6 @@
#include <gtest/gtest.h>
#include "wpi/math/estimator/AngleStatistics.hpp"
#include "wpi/math/estimator/S3UKF.hpp"
#include "wpi/math/linalg/EigenCore.hpp"
#include "wpi/math/system/Discretization.hpp"
#include "wpi/math/system/NumericalIntegration.hpp"

View File

@@ -2,6 +2,8 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/estimator/SwerveDrivePoseEstimator3d.hpp"
#include <limits>
#include <random>
#include <tuple>
@@ -10,7 +12,6 @@
#include <fmt/format.h>
#include <gtest/gtest.h>
#include "wpi/math/estimator/SwerveDrivePoseEstimator3d.hpp"
#include "wpi/math/geometry/Pose2d.hpp"
#include "wpi/math/kinematics/SwerveDriveKinematics.hpp"
#include "wpi/math/trajectory/TrajectoryGenerator.hpp"

View File

@@ -2,6 +2,8 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/estimator/SwerveDrivePoseEstimator.hpp"
#include <limits>
#include <numbers>
#include <random>
@@ -11,7 +13,6 @@
#include <fmt/format.h>
#include <gtest/gtest.h>
#include "wpi/math/estimator/SwerveDrivePoseEstimator.hpp"
#include "wpi/math/geometry/Pose2d.hpp"
#include "wpi/math/kinematics/SwerveDriveKinematics.hpp"
#include "wpi/math/trajectory/TrajectoryGenerator.hpp"

View File

@@ -2,9 +2,10 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/filter/Debouncer.hpp"
#include <gtest/gtest.h>
#include "wpi/math/filter/Debouncer.hpp"
#include "wpi/units/time.hpp"
#include "wpi/util/timestamp.h"

View File

@@ -2,7 +2,9 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/filter/LinearFilter.hpp" // NOLINT(build/include_order)
// clang-format off
#include "wpi/math/filter/LinearFilter.hpp"
// clang-format on
#include <cmath>
#include <numbers>

View File

@@ -2,7 +2,9 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/filter/LinearFilter.hpp" // NOLINT(build/include_order)
// clang-format off
#include "wpi/math/filter/LinearFilter.hpp"
// clang-format on
#include <cmath>
#include <functional>

View File

@@ -2,10 +2,10 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include <gtest/gtest.h>
#include "wpi/math/filter/MedianFilter.hpp"
#include <gtest/gtest.h>
TEST(MedianFilterTest, MedianFilterNotFullTestEven) {
wpi::math::MedianFilter<double> filter{10};

View File

@@ -2,9 +2,10 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/filter/SlewRateLimiter.hpp"
#include <gtest/gtest.h>
#include "wpi/math/filter/SlewRateLimiter.hpp"
#include "wpi/units/length.hpp"
#include "wpi/units/time.hpp"
#include "wpi/units/velocity.hpp"

View File

@@ -2,9 +2,10 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/geometry/CoordinateSystem.hpp"
#include <gtest/gtest.h>
#include "wpi/math/geometry/CoordinateSystem.hpp"
#include "wpi/math/geometry/Pose3d.hpp"
#include "wpi/math/geometry/Transform3d.hpp"

View File

@@ -2,10 +2,10 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include <gtest/gtest.h>
#include "wpi/math/geometry/Ellipse2d.hpp"
#include <gtest/gtest.h>
TEST(Ellipse2dTest, FocalPoints) {
constexpr wpi::math::Pose2d center{1_m, 2_m, 0_deg};
constexpr wpi::math::Ellipse2d ellipse{center, 5_m, 4_m};

View File

@@ -2,13 +2,13 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/geometry/Pose2d.hpp"
#include <cmath>
#include <cstdlib>
#include <gtest/gtest.h>
#include "wpi/math/geometry/Pose2d.hpp"
using namespace wpi::math;
TEST(Pose2dTest, RotateBy) {

View File

@@ -2,11 +2,12 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/geometry/Pose3d.hpp"
#include <cmath>
#include <gtest/gtest.h>
#include "wpi/math/geometry/Pose3d.hpp"
#include "wpi/util/array.hpp"
using namespace wpi::math;

View File

@@ -2,11 +2,12 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/geometry/Quaternion.hpp"
#include <numbers>
#include <gtest/gtest.h>
#include "wpi/math/geometry/Quaternion.hpp"
#include "wpi/units/angle.hpp"
#include "wpi/units/math.hpp"

View File

@@ -2,10 +2,10 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include <gtest/gtest.h>
#include "wpi/math/geometry/Rectangle2d.hpp"
#include <gtest/gtest.h>
TEST(Rectangle2dTest, NewWithCorners) {
constexpr wpi::math::Translation2d cornerA{1_m, 2_m};
constexpr wpi::math::Translation2d cornerB{4_m, 6_m};

View File

@@ -2,13 +2,13 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/geometry/Rotation2d.hpp"
#include <cmath>
#include <numbers>
#include <gtest/gtest.h>
#include "wpi/math/geometry/Rotation2d.hpp"
using namespace wpi::math;
TEST(Rotation2dTest, RadiansToDegrees) {

View File

@@ -2,13 +2,14 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/geometry/Rotation3d.hpp"
#include <cmath>
#include <numbers>
#include <Eigen/Core>
#include <gtest/gtest.h>
#include "wpi/math/geometry/Rotation3d.hpp"
#include "wpi/util/MathExtras.hpp"
using namespace wpi::math;

View File

@@ -2,13 +2,14 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/geometry/Transform2d.hpp"
#include <cmath>
#include <gtest/gtest.h>
#include "wpi/math/geometry/Pose2d.hpp"
#include "wpi/math/geometry/Rotation2d.hpp"
#include "wpi/math/geometry/Transform2d.hpp"
#include "wpi/math/geometry/Translation2d.hpp"
using namespace wpi::math;

View File

@@ -2,13 +2,14 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/geometry/Transform3d.hpp"
#include <cmath>
#include <gtest/gtest.h>
#include "wpi/math/geometry/Pose3d.hpp"
#include "wpi/math/geometry/Rotation3d.hpp"
#include "wpi/math/geometry/Transform3d.hpp"
#include "wpi/math/geometry/Translation3d.hpp"
using namespace wpi::math;

View File

@@ -2,12 +2,12 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/geometry/Translation2d.hpp"
#include <cmath>
#include <gtest/gtest.h>
#include "wpi/math/geometry/Translation2d.hpp"
using namespace wpi::math;
TEST(Translation2dTest, Sum) {

View File

@@ -2,12 +2,12 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/geometry/Translation3d.hpp"
#include <cmath>
#include <gtest/gtest.h>
#include "wpi/math/geometry/Translation3d.hpp"
using namespace wpi::math;
static constexpr double kEpsilon = 1E-9;

View File

@@ -2,13 +2,14 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/interpolation/TimeInterpolatableBuffer.hpp"
#include <cmath>
#include <gtest/gtest.h>
#include "wpi/math/geometry/Pose2d.hpp"
#include "wpi/math/geometry/Rotation2d.hpp"
#include "wpi/math/interpolation/TimeInterpolatableBuffer.hpp"
#include "wpi/units/time.hpp"
TEST(TimeInterpolatableBufferTest, AddSample) {

View File

@@ -2,12 +2,12 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/kinematics/ChassisSpeeds.hpp"
#include <cmath>
#include <gtest/gtest.h>
#include "wpi/math/kinematics/ChassisSpeeds.hpp"
static constexpr double kEpsilon = 1E-9;
TEST(ChassisSpeedsTest, Discretize) {

View File

@@ -2,12 +2,13 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/kinematics/DifferentialDriveKinematics.hpp"
#include <numbers>
#include <gtest/gtest.h>
#include "wpi/math/kinematics/ChassisSpeeds.hpp"
#include "wpi/math/kinematics/DifferentialDriveKinematics.hpp"
#include "wpi/units/angular_velocity.hpp"
#include "wpi/units/length.hpp"
#include "wpi/units/velocity.hpp"

View File

@@ -2,12 +2,13 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/kinematics/DifferentialDriveOdometry3d.hpp"
#include <numbers>
#include <gtest/gtest.h>
#include "wpi/math/kinematics/DifferentialDriveKinematics.hpp"
#include "wpi/math/kinematics/DifferentialDriveOdometry3d.hpp"
static constexpr double kEpsilon = 1E-9;

View File

@@ -2,12 +2,13 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/kinematics/DifferentialDriveOdometry.hpp"
#include <numbers>
#include <gtest/gtest.h>
#include "wpi/math/kinematics/DifferentialDriveKinematics.hpp"
#include "wpi/math/kinematics/DifferentialDriveOdometry.hpp"
static constexpr double kEpsilon = 1E-9;

View File

@@ -2,10 +2,10 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include <gtest/gtest.h>
#include "wpi/math/kinematics/DifferentialDriveWheelSpeeds.hpp"
#include <gtest/gtest.h>
TEST(DifferentialDriveWheelSpeedsTest, Plus) {
const wpi::math::DifferentialDriveWheelSpeeds left{1.0_mps, 0.5_mps};
const wpi::math::DifferentialDriveWheelSpeeds right{2.0_mps, 1.5_mps};

View File

@@ -2,12 +2,13 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/kinematics/MecanumDriveKinematics.hpp"
#include <numbers>
#include <gtest/gtest.h>
#include "wpi/math/geometry/Translation2d.hpp"
#include "wpi/math/kinematics/MecanumDriveKinematics.hpp"
#include "wpi/units/angular_velocity.hpp"
using namespace wpi::math;

View File

@@ -2,12 +2,13 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/kinematics/MecanumDriveOdometry3d.hpp"
#include <limits>
#include <random>
#include <gtest/gtest.h>
#include "wpi/math/kinematics/MecanumDriveOdometry3d.hpp"
#include "wpi/math/trajectory/TrajectoryGenerator.hpp"
using namespace wpi::math;

View File

@@ -2,12 +2,13 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/kinematics/MecanumDriveOdometry.hpp"
#include <limits>
#include <random>
#include <gtest/gtest.h>
#include "wpi/math/kinematics/MecanumDriveOdometry.hpp"
#include "wpi/math/trajectory/TrajectoryGenerator.hpp"
using namespace wpi::math;

View File

@@ -2,10 +2,10 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include <gtest/gtest.h>
#include "wpi/math/kinematics/MecanumDriveWheelSpeeds.hpp"
#include <gtest/gtest.h>
TEST(MecanumDriveWheelSpeedsTest, Plus) {
const wpi::math::MecanumDriveWheelSpeeds left{1.0_mps, 0.5_mps, 2.0_mps,
1.5_mps};

View File

@@ -2,12 +2,13 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/kinematics/SwerveDriveKinematics.hpp"
#include <numbers>
#include <gtest/gtest.h>
#include "wpi/math/geometry/Translation2d.hpp"
#include "wpi/math/kinematics/SwerveDriveKinematics.hpp"
#include "wpi/units/angular_velocity.hpp"
using namespace wpi::math;

View File

@@ -2,13 +2,14 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/kinematics/SwerveDriveOdometry3d.hpp"
#include <limits>
#include <random>
#include <gtest/gtest.h>
#include "wpi/math/kinematics/SwerveDriveKinematics.hpp"
#include "wpi/math/kinematics/SwerveDriveOdometry3d.hpp"
#include "wpi/math/trajectory/Trajectory.hpp"
#include "wpi/math/trajectory/TrajectoryConfig.hpp"
#include "wpi/math/trajectory/TrajectoryGenerator.hpp"

View File

@@ -2,13 +2,14 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/kinematics/SwerveDriveOdometry.hpp"
#include <limits>
#include <random>
#include <gtest/gtest.h>
#include "wpi/math/kinematics/SwerveDriveKinematics.hpp"
#include "wpi/math/kinematics/SwerveDriveOdometry.hpp"
#include "wpi/math/trajectory/Trajectory.hpp"
#include "wpi/math/trajectory/TrajectoryConfig.hpp"
#include "wpi/math/trajectory/TrajectoryGenerator.hpp"

View File

@@ -2,10 +2,11 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/kinematics/SwerveModulePosition.hpp"
#include <gtest/gtest.h>
#include "wpi/math/geometry/Rotation2d.hpp"
#include "wpi/math/kinematics/SwerveModulePosition.hpp"
TEST(SwerveModulePositionTest, Equality) {
wpi::math::SwerveModulePosition position1{2_m, 90_deg};

View File

@@ -2,10 +2,11 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/kinematics/SwerveModuleState.hpp"
#include <gtest/gtest.h>
#include "wpi/math/geometry/Rotation2d.hpp"
#include "wpi/math/kinematics/SwerveModuleState.hpp"
static constexpr double kEpsilon = 1E-9;

View File

@@ -2,11 +2,12 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/kinematics/proto/SwerveDriveKinematicsProto.hpp"
#include <gtest/gtest.h>
#include "../../ProtoTestBase.hpp"
#include "wpi/math/kinematics/SwerveDriveKinematics.hpp"
#include "wpi/math/kinematics/proto/SwerveDriveKinematicsProto.hpp"
using namespace wpi::math;

View File

@@ -2,11 +2,12 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/kinematics/struct/SwerveDriveKinematicsStruct.hpp"
#include <gtest/gtest.h>
#include "../../StructTestBase.hpp"
#include "wpi/math/kinematics/SwerveDriveKinematics.hpp"
#include "wpi/math/kinematics/struct/SwerveDriveKinematicsStruct.hpp"
using namespace wpi::math;

View File

@@ -2,14 +2,14 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/optimization/SimulatedAnnealing.hpp"
#include <algorithm>
#include <cmath>
#include <random>
#include <gtest/gtest.h>
#include "wpi/math/optimization/SimulatedAnnealing.hpp"
TEST(SimulatedAnnealingTest, DoubleFunctionOptimizationHeartBeat) {
auto function = [](double x) {
return -(x + std::sin(x)) * std::exp(-x * x) + 1;

View File

@@ -2,6 +2,8 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/path/TravelingSalesman.hpp"
#include <cassert>
#include <span>
#include <vector>
@@ -11,7 +13,6 @@
#include "wpi/math/geometry/Pose2d.hpp"
#include "wpi/math/geometry/Rotation2d.hpp"
#include "wpi/math/linalg/EigenCore.hpp"
#include "wpi/math/path/TravelingSalesman.hpp"
#include "wpi/util/array.hpp"
#include "wpi/util/circular_buffer.hpp"

View File

@@ -2,11 +2,12 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/linalg/proto/MatrixProto.hpp"
#include <gtest/gtest.h>
#include "../ProtoTestBase.hpp"
#include "wpi/math/linalg/EigenCore.hpp"
#include "wpi/math/linalg/proto/MatrixProto.hpp"
using namespace wpi::math;

View File

@@ -2,11 +2,12 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/linalg/proto/VectorProto.hpp"
#include <gtest/gtest.h>
#include "../ProtoTestBase.hpp"
#include "wpi/math/linalg/EigenCore.hpp"
#include "wpi/math/linalg/proto/VectorProto.hpp"
using namespace wpi::math;

View File

@@ -2,13 +2,14 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/spline/QuinticHermiteSpline.hpp"
#include <chrono>
#include <gtest/gtest.h>
#include "wpi/math/geometry/Pose2d.hpp"
#include "wpi/math/geometry/Rotation2d.hpp"
#include "wpi/math/spline/QuinticHermiteSpline.hpp"
#include "wpi/math/spline/SplineHelper.hpp"
#include "wpi/math/spline/SplineParameterizer.hpp"
#include "wpi/units/angle.hpp"

View File

@@ -2,11 +2,12 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/linalg/struct/VectorStruct.hpp"
#include <gtest/gtest.h>
#include "../StructTestBase.hpp"
#include "wpi/math/linalg/EigenCore.hpp"
#include "wpi/math/linalg/struct/VectorStruct.hpp"
using namespace wpi::math;

View File

@@ -2,13 +2,14 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/system/Discretization.hpp"
#include <functional>
#include <Eigen/Eigenvalues>
#include <gtest/gtest.h>
#include "wpi/math/linalg/EigenCore.hpp"
#include "wpi/math/system/Discretization.hpp"
#include "wpi/math/system/NumericalIntegration.hpp"
// Check that for a simple second-order system that we can easily analyze

View File

@@ -2,11 +2,12 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/system/plant/LinearSystemId.hpp"
#include <gtest/gtest.h>
#include "wpi/math/system/LinearSystem.hpp"
#include "wpi/math/system/plant/DCMotor.hpp"
#include "wpi/math/system/plant/LinearSystemId.hpp"
#include "wpi/units/length.hpp"
#include "wpi/units/mass.hpp"

View File

@@ -2,12 +2,13 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/system/NumericalIntegration.hpp"
#include <cmath>
#include <gtest/gtest.h>
#include "wpi/math/linalg/EigenCore.hpp"
#include "wpi/math/system/NumericalIntegration.hpp"
// Test that integrating dx/dt = eˣ works
TEST(NumericalIntegrationTest, Exponential) {

View File

@@ -2,10 +2,10 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include <gtest/gtest.h>
#include "wpi/math/system/NumericalJacobian.hpp"
#include <gtest/gtest.h>
wpi::math::Matrixd<4, 4> A{
{1, 2, 4, 1}, {5, 2, 3, 4}, {5, 1, 3, 2}, {1, 1, 3, 7}};
wpi::math::Matrixd<4, 2> B{{1, 1}, {2, 1}, {3, 2}, {3, 7}};

View File

@@ -2,11 +2,12 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/system/proto/LinearSystemProto.hpp"
#include <gtest/gtest.h>
#include "../../ProtoTestBase.hpp"
#include "wpi/math/system/LinearSystem.hpp"
#include "wpi/math/system/proto/LinearSystemProto.hpp"
using namespace wpi::math;

View File

@@ -2,11 +2,12 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/system/struct/LinearSystemStruct.hpp"
#include <gtest/gtest.h>
#include "../../StructTestBase.hpp"
#include "wpi/math/system/LinearSystem.hpp"
#include "wpi/math/system/struct/LinearSystemStruct.hpp"
using namespace wpi::math;

View File

@@ -2,13 +2,14 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/trajectory/constraint/CentripetalAccelerationConstraint.hpp"
#include <memory>
#include <vector>
#include <gtest/gtest.h>
#include "wpi/math/trajectory/TestTrajectory.hpp"
#include "wpi/math/trajectory/constraint/CentripetalAccelerationConstraint.hpp"
#include "wpi/math/trajectory/constraint/TrajectoryConstraint.hpp"
#include "wpi/units/acceleration.hpp"
#include "wpi/units/angle.hpp"

View File

@@ -2,12 +2,13 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/kinematics/DifferentialDriveKinematics.hpp"
#include <memory>
#include <vector>
#include <gtest/gtest.h>
#include "wpi/math/kinematics/DifferentialDriveKinematics.hpp"
#include "wpi/math/trajectory/TestTrajectory.hpp"
#include "wpi/math/trajectory/constraint/DifferentialDriveKinematicsConstraint.hpp"
#include "wpi/units/time.hpp"

View File

@@ -2,10 +2,11 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/trajectory/constraint/EllipticalRegionConstraint.hpp"
#include <gtest/gtest.h>
#include "wpi/math/trajectory/TestTrajectory.hpp"
#include "wpi/math/trajectory/constraint/EllipticalRegionConstraint.hpp"
#include "wpi/math/trajectory/constraint/MaxVelocityConstraint.hpp"
#include "wpi/units/acceleration.hpp"
#include "wpi/units/angle.hpp"

View File

@@ -2,7 +2,7 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/trajectory/ExponentialProfile.hpp" // NOLINT(build/include_order)
#include "wpi/math/trajectory/ExponentialProfile.hpp"
#include <chrono>
#include <cmath>

View File

@@ -2,11 +2,12 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/trajectory/constraint/RectangularRegionConstraint.hpp"
#include <gtest/gtest.h>
#include "wpi/math/trajectory/TestTrajectory.hpp"
#include "wpi/math/trajectory/constraint/MaxVelocityConstraint.hpp"
#include "wpi/math/trajectory/constraint/RectangularRegionConstraint.hpp"
#include "wpi/units/acceleration.hpp"
#include "wpi/units/length.hpp"
#include "wpi/units/math.hpp"

View File

@@ -2,13 +2,14 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/trajectory/TrajectoryGenerator.hpp"
#include <vector>
#include <gtest/gtest.h>
#include "wpi/math/trajectory/TestTrajectory.hpp"
#include "wpi/math/trajectory/Trajectory.hpp"
#include "wpi/math/trajectory/TrajectoryGenerator.hpp"
#include "wpi/math/trajectory/constraint/CentripetalAccelerationConstraint.hpp"
#include "wpi/math/trajectory/constraint/TrajectoryConstraint.hpp"
#include "wpi/units/math.hpp"

View File

@@ -2,7 +2,7 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/math/trajectory/TrapezoidProfile.hpp" // NOLINT(build/include_order)
#include "wpi/math/trajectory/TrapezoidProfile.hpp"
#include <chrono>
#include <cmath>