[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

@@ -166,6 +166,9 @@ class ControlAffinePlantInversionFeedforward {
InputVector Calculate(const StateVector& r, const StateVector& nextR) {
StateVector rDot = (nextR - r) / m_dt.value();
// ṙ = f(r) + Bu
// Bu = ṙ f(r)
// u = B⁺(ṙ f(r))
m_uff = m_B.householderQr().solve(rDot - m_f(r, InputVector::Zero()));
m_r = nextR;

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;