From 64656b0d53d7167c21d85d9157701fb674fc83b0 Mon Sep 17 00:00:00 2001 From: Kavin Muralikrishnan <921563@lcps.org> Date: Tue, 12 Nov 2024 10:51:24 -0500 Subject: [PATCH] Update NumericalIntegration.h --- .../include/frc/system/NumericalIntegration.h | 35 +++++++++++-------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/wpimath/src/main/native/include/frc/system/NumericalIntegration.h b/wpimath/src/main/native/include/frc/system/NumericalIntegration.h index 0e7d62c0eb4..731ffa82cfe 100644 --- a/wpimath/src/main/native/include/frc/system/NumericalIntegration.h +++ b/wpimath/src/main/native/include/frc/system/NumericalIntegration.h @@ -265,11 +265,15 @@ T Tsit5(F&& f, T x, U u, units::second_t dt, double maxError = 1e-6) { { 0.09646076681806523, 0.01, 0.4798896504144996, 1.379008574103742, -3.290069515436081, 2.324710524099774}}; // clang-format on - constexpr std::array b1{ - 0.09646076681806523, 0.01, 0.4798896504144996, 1.379008574103742, -3.290069515436081, - 2.324710524099774, 0.0}; - constexpr std::array b2{0.001780011052226, 0.000816434459657, - -0.007880878010262, 0.144711007173263, + constexpr std::array b1{0.09646076681806523, + 0.01, + 0.4798896504144996, + 1.379008574103742, + -3.290069515436081, + 2.324710524099774, + 0.0}; + constexpr std::array b2{0.001780011052226, 0.000816434459657, + -0.007880878010262, 0.144711007173263, -0.582357165452555, 0.458082105929187, 1.0 / 66.0}; @@ -333,7 +337,7 @@ T Tsit5(F&& f, T x, U u, units::second_t dt, double maxError = 1e-6) { */ template T Tsit5(F&& f, units::second_t t, T y, units::second_t dt, - double maxError = 1e-6) { + double maxError = 1e-6) { // See http://users.uoa.gr/~tsitourasc/RK54_new_v2.pdf for the // Butcher tableau the following arrays came from. @@ -349,16 +353,20 @@ T Tsit5(F&& f, units::second_t t, T y, units::second_t dt, { 0.09646076681806523, 0.01, 0.4798896504144996, 1.379008574103742, -3.290069515436081, 2.324710524099774}}; // clang-format on - constexpr std::array b1{ - 0.09646076681806523, 0.01, 0.4798896504144996, 1.379008574103742, -3.290069515436081, - 2.324710524099774, 0.0}; - constexpr std::array b2{0.001780011052226, 0.000816434459657, - -0.007880878010262, 0.144711007173263, + constexpr std::array b1{0.09646076681806523, + 0.01, + 0.4798896504144996, + 1.379008574103742, + -3.290069515436081, + 2.324710524099774, + 0.0}; + constexpr std::array b2{0.001780011052226, 0.000816434459657, + -0.007880878010262, 0.144711007173263, -0.582357165452555, 0.458082105929187, 1.0 / 66.0}; - constexpr std::array c{0.161, 0.327, 0.9, - 0.9800255409045097, 1.0, 1.0}; + constexpr std::array c{ + 0.161, 0.327, 0.9, 0.9800255409045097, 1.0, 1.0}; T newY; double truncationError; @@ -404,4 +412,3 @@ T Tsit5(F&& f, units::second_t t, T y, units::second_t dt, } } // namespace frc -