Rename RungeKutta to RungeKuttaU
This could be done with lambda instead, but we'll leave it. I need a
variant where time gets passed in and this was using that call
signature. I'd rather rename this one.
Change-Id: Ic8e473db599528e17efc0dc30a734679237a5cca
diff --git a/frc971/control_loops/runge_kutta.h b/frc971/control_loops/runge_kutta.h
index 020a25d..c3d47ed 100644
--- a/frc971/control_loops/runge_kutta.h
+++ b/frc971/control_loops/runge_kutta.h
@@ -23,7 +23,7 @@
// integrate. It must take 1 argument of type T. The integration starts at an
// initial value X, and integrates for dt.
template <typename F, typename T, typename Tu>
-T RungeKutta(const F &fn, T X, Tu U, double dt) {
+T RungeKuttaU(const F &fn, T X, Tu U, double dt) {
const double half_dt = dt * 0.5;
T k1 = fn(X, U);
T k2 = fn(X + half_dt * k1, U);
diff --git a/frc971/control_loops/runge_kutta_test.cc b/frc971/control_loops/runge_kutta_test.cc
index aa64638..abd9466 100644
--- a/frc971/control_loops/runge_kutta_test.cc
+++ b/frc971/control_loops/runge_kutta_test.cc
@@ -26,7 +26,7 @@
::Eigen::Matrix<double, 1, 1> y0;
y0(0, 0) = 0.0;
- ::Eigen::Matrix<double, 1, 1> y1 = RungeKutta(
+ ::Eigen::Matrix<double, 1, 1> y1 = RungeKuttaU(
[](::Eigen::Matrix<double, 1, 1> x, ::Eigen::Matrix<double, 1, 1> u) {
::Eigen::Matrix<double, 1, 1> y;
y(0, 0) = ::std::exp(u(0, 0) * x(0, 0));
diff --git a/y2018/control_loops/superstructure/arm/dynamics.h b/y2018/control_loops/superstructure/arm/dynamics.h
index cdbd6fe..b1ebc97 100644
--- a/y2018/control_loops/superstructure/arm/dynamics.h
+++ b/y2018/control_loops/superstructure/arm/dynamics.h
@@ -169,15 +169,15 @@
static const ::Eigen::Matrix<double, 4, 1> UnboundedDiscreteDynamics(
const ::Eigen::Matrix<double, 4, 1> &X,
const ::Eigen::Matrix<double, 2, 1> &U, double dt) {
- return ::frc971::control_loops::RungeKutta(Dynamics::Acceleration, X, U,
- dt);
+ return ::frc971::control_loops::RungeKuttaU(Dynamics::Acceleration, X, U,
+ dt);
}
static const ::Eigen::Matrix<double, 6, 1> UnboundedEKFDiscreteDynamics(
const ::Eigen::Matrix<double, 6, 1> &X,
const ::Eigen::Matrix<double, 2, 1> &U, double dt) {
- return ::frc971::control_loops::RungeKutta(Dynamics::EKFAcceleration, X, U,
- dt);
+ return ::frc971::control_loops::RungeKuttaU(Dynamics::EKFAcceleration, X, U,
+ dt);
}
};