Skip to content

Commit

Permalink
Update NumericalIntegration.h
Browse files Browse the repository at this point in the history
  • Loading branch information
Advay17 committed Nov 12, 2024
1 parent 9834cf7 commit 64656b0
Showing 1 changed file with 21 additions and 14 deletions.
35 changes: 21 additions & 14 deletions wpimath/src/main/native/include/frc/system/NumericalIntegration.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<double, kDim> b1{
0.09646076681806523, 0.01, 0.4798896504144996, 1.379008574103742, -3.290069515436081,
2.324710524099774, 0.0};
constexpr std::array<double, kDim> b2{0.001780011052226, 0.000816434459657,
-0.007880878010262, 0.144711007173263,
constexpr std::array<double, kDim> b1{0.09646076681806523,
0.01,
0.4798896504144996,
1.379008574103742,
-3.290069515436081,
2.324710524099774,
0.0};
constexpr std::array<double, kDim> b2{0.001780011052226, 0.000816434459657,
-0.007880878010262, 0.144711007173263,
-0.582357165452555, 0.458082105929187,
1.0 / 66.0};

Expand Down Expand Up @@ -333,7 +337,7 @@ T Tsit5(F&& f, T x, U u, units::second_t dt, double maxError = 1e-6) {
*/
template <typename F, typename T>
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.

Expand All @@ -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<double, kDim> b1{
0.09646076681806523, 0.01, 0.4798896504144996, 1.379008574103742, -3.290069515436081,
2.324710524099774, 0.0};
constexpr std::array<double, kDim> b2{0.001780011052226, 0.000816434459657,
-0.007880878010262, 0.144711007173263,
constexpr std::array<double, kDim> b1{0.09646076681806523,
0.01,
0.4798896504144996,
1.379008574103742,
-3.290069515436081,
2.324710524099774,
0.0};
constexpr std::array<double, kDim> b2{0.001780011052226, 0.000816434459657,
-0.007880878010262, 0.144711007173263,
-0.582357165452555, 0.458082105929187,
1.0 / 66.0};

constexpr std::array<double, kDim - 1> c{0.161, 0.327, 0.9,
0.9800255409045097, 1.0, 1.0};
constexpr std::array<double, kDim - 1> c{
0.161, 0.327, 0.9, 0.9800255409045097, 1.0, 1.0};

T newY;
double truncationError;
Expand Down Expand Up @@ -404,4 +412,3 @@ T Tsit5(F&& f, units::second_t t, T y, units::second_t dt,
}

} // namespace frc

0 comments on commit 64656b0

Please sign in to comment.