Skip to content

Commit fa04ff4

Browse files
committed
debug
1 parent 1c93f82 commit fa04ff4

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ public Point getCenter() {
2121
return new Point(centerX / 4.0, centerY / 4.0);
2222
}
2323

24-
public double getArea() {
24+
public double getAvgDiag() {
2525
// Assume rectangle
2626
double width1 = Math.abs(corners[0].x() - corners[2].x());
2727
double height1 = Math.abs(corners[0].y() - corners[2].y());
2828
double width2 = Math.abs(corners[1].x() - corners[3].x());
2929
double height2 = Math.abs(corners[1].y() - corners[3].y());
30-
return (width1 * height1 + width2 * height2) / 2.0;
30+
return (Math.hypot(width1, height1) + Math.hypot(width2, height2)) / 2.0;
3131
}
3232
}

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,14 @@ public void processUDP(String rawDataString, long recievedTime) {
149149
private void processPoseMode(JsonObject dataCam) {
150150
newUpdateNum = dataCam.get("Update").getAsInt();
151151
Pose3d pose1 = parsePose3d(dataCam.get("Pose1").getAsJsonObject());
152+
153+
if (pose1 == null) {
154+
System.err.println(
155+
"POSE IS NULL POSE IS NULL POSE IS NULL POSE IS NULL POSE IS NULL POSE IS NULL POSE IS NULL");
156+
System.err.println(dataCam.toString());
157+
return;
158+
}
159+
152160
Pose3d pose2 = parsePose3d(dataCam.get("Pose2").getAsJsonObject());
153161
double ambiguity = dataCam.get("Ambig").getAsDouble();
154162

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111
public class WallEyeTagResult extends WallEyeResult {
1212
private final List<Tag> tags;
13-
private final double[] tagAreas;
13+
private final double[] tagDiag;
1414
private final List<Point> centers;
1515

1616
/**
@@ -36,11 +36,11 @@ public WallEyeTagResult(
3636
if (tagCorners == null) {
3737
this.tags = Collections.emptyList();
3838
this.centers = Collections.emptyList();
39-
this.tagAreas = new double[0];
39+
this.tagDiag = new double[0];
4040
} else {
4141
this.tags = new ArrayList<>(tagCorners.size());
4242
this.centers = new ArrayList<>(tagCorners.size());
43-
this.tagAreas = new double[tagCorners.size()];
43+
this.tagDiag = new double[tagCorners.size()];
4444

4545
for (List<List<Double>> tagData : tagCorners) {
4646
Point[] corners = new Point[4];
@@ -53,7 +53,7 @@ public WallEyeTagResult(
5353
this.tags.add(tag);
5454

5555
this.centers.add(tag.getCenter());
56-
this.tagAreas[this.tags.size() - 1] = tag.getArea();
56+
this.tagDiag[this.tags.size() - 1] = tag.getAvgDiag();
5757
}
5858
}
5959
}
@@ -66,8 +66,8 @@ public List<Point> getTagCenters() {
6666
return centers;
6767
}
6868

69-
public double[] getTagAreas() {
70-
return tagAreas;
69+
public double[] getTagDiags() {
70+
return tagDiag;
7171
}
7272

7373
@Override

0 commit comments

Comments
 (0)