[wpimath] Add math docs to plant inversion feedforward internals (NFC) (#5618)

This commit is contained in:
Tyler Veness
2023-09-08 20:14:24 -07:00
committed by GitHub
parent 3a33ce918b
commit 8e05983a4a
4 changed files with 12 additions and 0 deletions

View File

@@ -138,6 +138,9 @@ class LinearPlantInversionFeedforward {
* @return The calculated feedforward.
*/
InputVector Calculate(const StateVector& r, const StateVector& nextR) {
// rₖ₊₁ = Arₖ + Buₖ
// Buₖ = rₖ₊₁ Arₖ
// uₖ = B⁺(rₖ₊₁ Arₖ)
m_uff = m_B.householderQr().solve(nextR - (m_A * r));
m_r = nextR;
return m_uff;