We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ba673dd commit 37e3dbfCopy full SHA for 37e3dbf
1 file changed
Robot2019/src/main/java/frc/robot/lib/Limelight.java
@@ -23,15 +23,18 @@ public Limelight() {
23
24
// Adjusts the distance between a vision target and the robot. Uses basic PID with the ty value from the network table.
25
public double distanceAssist() {
26
+ tv = table.getEntry("tv").getDouble(0.0);
27
ty = table.getEntry("ty").getDouble(0.0);
28
SmartDashboard.putNumber("Crosshair Vertical Offset", ty);
29
ta = table.getEntry("ta").getDouble(0.0);
30
double adjustment = 0.0;
31
double area_threshold = 0.5; // TODO: Set the desired area.
32
double Kp = 0.2; // TODO: Set PID K value.
33
- if (ta < area_threshold) {
34
- adjustment += Kp * ty;
+ if (tv == 1.0) {
35
+ if (ta < area_threshold) {
36
+ adjustment += Kp * ty;
37
+ }
38
}
39
return adjustment;
40
0 commit comments