strongback / strongback-java

A library for FIRST Robotics Competition robots that makes it easier to write and test your robot code.
MIT License
41 stars 38 forks source link

Fixed SoftwarePIDController checkTolerance and initTable #106

Closed rothso closed 7 years ago

rothso commented 7 years ago

Hey again! My co-lead and I came across what we believe are two separate bugs in the SoftwarePIDController. Seeing as they're each relatively small to review, I hope you don't mind that I've combined them both into one PR.

  1. The checkTolerance method is inaccurate. It checks to see if the input is less than the setpoint minus the tolerance, which means basically any input less than the setpoint is considered in tolerance. This had the ugly effect of causing our controller commands to prematurely finish. I've thrown in a regression test that verifies the method now works as intended.

  2. The gains don't appear on the SmartDashboard. It looks like this.table = table is the culprit :) I compared this line to the corresponding line in the WPILib PIDController and I believe it should have been set to subtable.

rhauch commented 7 years ago

@rothso Thanks for the fixes!