Skip to content

Commit 1c86b0e

Browse files
committed
added connected java code
1 parent df930a8 commit 1c86b0e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

RobotSideCode/wallEYE/src/main/java/WallEye/WallEyeCam.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import edu.wpi.first.math.geometry.Rotation3d;
99
import edu.wpi.first.math.geometry.Transform3d;
1010
import edu.wpi.first.math.geometry.Translation3d;
11+
import edu.wpi.first.networktables.BooleanSubscriber;
1112
import edu.wpi.first.networktables.DoubleArraySubscriber;
1213
import edu.wpi.first.networktables.IntegerSubscriber;
1314
import edu.wpi.first.networktables.NetworkTable;
@@ -21,6 +22,7 @@
2122
*/
2223
public class WallEyeCam {
2324
private DoubleArraySubscriber dsub;
25+
private BooleanSubscriber connectSub;
2426
private int curUpdateNum = 0;
2527
private IntegerSubscriber updateSub;
2628
private Transform3d camToCenter;
@@ -61,6 +63,7 @@ public WallEyeCam(String tableName, int camIndex, int dioPort)
6163
double[] def = {2767.0, 2767.0, 2767.0, 2767.0, 2767.0, 2767.0, 2767.0};
6264
dsub = table.getDoubleArrayTopic("Result" + camIndex).subscribe(def);
6365
updateSub = table.getIntegerTopic("Update" + camIndex).subscribe(0);
66+
connectSub = table.getBooleanTopic("Connected" + camIndex).subscribe(false);
6467
}
6568

6669
/**
@@ -78,6 +81,16 @@ private void grabGyro() {
7881

7982
}
8083

84+
/**
85+
* TESTME TESTME
86+
* Check if the camera is still supplying images
87+
* TESTME TESTME
88+
*
89+
* @return Returns a boolean (True : if and only if the Pi's supplied images are new)
90+
*/
91+
public boolean isCameraConnected() {
92+
return connectSub.get();
93+
}
8194

8295
/**
8396
* Getter for the number of Cameras

0 commit comments

Comments
 (0)