@@ -41,6 +41,8 @@ public enum Mode {
4141 // Mounting angle is the angle of the limelight (angled up = +, angled down = -)
4242 private double mountingAngleDeg ;
4343
44+ private TurnDirection idleTurnDirection = TurnDirection .CW ;
45+
4446 private PIDController pidController ;
4547 private boolean newPIDLoop = false ;
4648 public Limelight (){
@@ -146,7 +148,7 @@ public double steeringAssist() {
146148 } else {
147149 newPIDLoop = false ;
148150 pidController .reset ();
149- adjustment = Math .copySign (config .steeringFactor , prev_txDeg );
151+ adjustment = Math .copySign (config .steeringFactor , idleTurnDirection . sign );
150152 }
151153
152154 adjustment = Math .copySign (Math .min (Math .abs (adjustment ), config .maxSteeringAdjustment ), txDeg );
@@ -172,6 +174,14 @@ public PIDController getPIDController() {
172174 public void putValue (String valueName , double value ){
173175 SmartDashboard .putNumber ("Limelight(" + config .ntName + "), (" + valueName + ")" , value );
174176 }
177+
178+ public TurnDirection getIdleTurnDirection () {
179+ return idleTurnDirection ;
180+ }
181+
182+ public void setIdleTurnDirection (TurnDirection direction ) {
183+ idleTurnDirection = direction ;
184+ }
175185
176186 public static class Config {
177187 /**
@@ -207,4 +217,14 @@ public static class Config {
207217 */
208218 public double kP = 0.225 ;
209219 }
220+
221+ public static enum TurnDirection {
222+ CW (-1 ), CCW (+1 );
223+
224+ public final int sign ;
225+
226+ private TurnDirection (int sign ) {
227+ this .sign = sign ;
228+ }
229+ }
210230}
0 commit comments