hytech-racing / MCU

https://hytech-racing.github.io/MCU/index.html
GNU General Public License v3.0
1 stars 0 forks source link

Implausability restructure #74

Closed EricGalluzzi closed 6 months ago

EricGalluzzi commented 7 months ago

Focused on fixing torque request when negative sloped accel sensor is disconnected. The electrical low-pass filter stage of the accel reading filters out the sharp response when removing the accel2 jumper, causing it to request an implausible accel percentage. The fix involves using accel1 as the primary torque requesting sensor when an implausibility is triggered.

unit tests added as needed.

Also added functionality for accepting absolute electrical minimum and maximum's of any pedals sensors in case we need it. Currently being used to set accel percent to 0 when we've exceeded any of those ranges.

closes #72 closes #70

walkermburns commented 7 months ago

Logic looks good to me. This system still needs a ton of comments with direct references to the rules that they apply to, and better whitespace separating accel evaluations and brake evaluations for example. You can put a new member on this, and this does not prevent the merge although this needs to happen at some point.

EricGalluzzi commented 7 months ago

Kept the ternary operators since changing to if statements seemed to increase clutter, reducing readability. One if statement was erroring the system so It was best to keep functional, yet simple ternary operators.

I'll have a new member add comments.