ts changes

This commit is contained in:
Aditya Pulipaka
2025-11-22 13:29:00 -06:00
parent f1fea28d73
commit 71092ec86f
9 changed files with 61 additions and 69 deletions

View File

@@ -45,11 +45,16 @@ void PseudoSensorController::control() {
Back.mmVal + Right.mmVal - avg}; // BR
for (uint8_t i = 0; i < 4; i++) {
float eCurr = Refs[i] - pseudos[i]; // Above reference is positive error.
float eCurr = Refs[i] - pseudos[i];
errors[i].eDiff = (eCurr - errors[i].e);
// Only integrate when not out of range
if (!oor) {
errors[i].eInt += eCurr;
errors[i].eInt = constrain(errors[i].eInt, -MAX_INTEGRAL_TERM, MAX_INTEGRAL_TERM);
}
errors[i].eDiff = (eCurr - errors[i].e); // rise over run
errors[i].eInt += eCurr;
errors[i].eInt = constrain(errors[i].eInt, -MAX_INTEGRAL_TERM, MAX_INTEGRAL_TERM);
errors[i].e = eCurr;
PWMs[i] = pwmFunc(Consts, errors[i]);