[sysid] Fix adjusted R² calculation (#6101)

It hardcoded p to 2.
This commit is contained in:
Tyler Veness
2023-12-26 20:06:10 -08:00
committed by GitHub
parent 5659038443
commit f2c2bab7dc
9 changed files with 147 additions and 112 deletions

View File

@@ -518,9 +518,9 @@ AnalysisManager::FeedforwardGains AnalysisManager::CalculateFeedforward() {
const auto& ff = sysid::CalculateFeedforwardGains(GetFilteredData(), m_type);
FeedforwardGains ffGains = {ff, m_trackWidth};
const auto& Ks = std::get<0>(ff)[0];
const auto& Kv = std::get<0>(ff)[1];
const auto& Ka = std::get<0>(ff)[2];
const auto& Ks = ff.coeffs[0];
const auto& Kv = ff.coeffs[1];
const auto& Ka = ff.coeffs[2];
if (Ka <= 0 || Kv < 0) {
throw InvalidDataError(