Skip to content

Commit 603a59f

Browse files
authored
[wpimath] Add typedefs for LQR and Kalman filters (#8340)
These are industry-standard initialisms. The original class names were left as is so they're more googleable, but I could be convinced otherwise.
1 parent 892666f commit 603a59f

File tree

5 files changed

+15
-0
lines changed

5 files changed

+15
-0
lines changed

wpimath/src/main/native/include/wpi/math/controller/LinearQuadraticRegulator.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,9 @@ class LinearQuadraticRegulator {
311311
Matrixd<Inputs, States> m_K;
312312
};
313313

314+
template <int States, int Inputs>
315+
using LQR = LinearQuadraticRegulator<States, Inputs>;
316+
314317
extern template class EXPORT_TEMPLATE_DECLARE(WPILIB_DLLEXPORT)
315318
LinearQuadraticRegulator<1, 1>;
316319
extern template class EXPORT_TEMPLATE_DECLARE(WPILIB_DLLEXPORT)

wpimath/src/main/native/include/wpi/math/estimator/ExtendedKalmanFilter.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,4 +428,7 @@ class ExtendedKalmanFilter {
428428
StateMatrix m_initP;
429429
};
430430

431+
template <int States, int Inputs, int Outputs>
432+
using EKF = ExtendedKalmanFilter<States, Inputs, Outputs>;
433+
431434
} // namespace wpi::math

wpimath/src/main/native/include/wpi/math/estimator/KalmanFilter.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,9 @@ class KalmanFilter {
262262
StateMatrix m_initP;
263263
};
264264

265+
template <int States, int Inputs, int Outputs>
266+
using KF = KalmanFilter<States, Inputs, Outputs>;
267+
265268
extern template class EXPORT_TEMPLATE_DECLARE(WPILIB_DLLEXPORT)
266269
KalmanFilter<1, 1, 1>;
267270
extern template class EXPORT_TEMPLATE_DECLARE(WPILIB_DLLEXPORT)

wpimath/src/main/native/include/wpi/math/estimator/SteadyStateKalmanFilter.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,9 @@ class SteadyStateKalmanFilter {
237237
StateVector m_xHat;
238238
};
239239

240+
template <int States, int Inputs, int Outputs>
241+
using SteadyStateKF = SteadyStateKalmanFilter<States, Inputs, Outputs>;
242+
240243
extern template class EXPORT_TEMPLATE_DECLARE(WPILIB_DLLEXPORT)
241244
SteadyStateKalmanFilter<1, 1, 1>;
242245
extern template class EXPORT_TEMPLATE_DECLARE(WPILIB_DLLEXPORT)

wpimath/src/main/native/include/wpi/math/estimator/UnscentedKalmanFilter.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,4 +496,7 @@ class UnscentedKalmanFilter {
496496
SigmaPoints m_pts;
497497
};
498498

499+
template <int States, int Inputs, int Outputs, SigmaPoints<States> SigmaPoints>
500+
using UKF = UnscentedKalmanFilter<States, Inputs, Outputs, SigmaPoints>;
501+
499502
} // namespace wpi::math

0 commit comments

Comments
 (0)