Skip to content

Commit 5663c92

Browse files
committed
Merge remote-tracking branch 'origin/main' into week-2-merge-260307-3
2 parents 7188ecd + 7227e4c commit 5663c92

File tree

2 files changed

+19
-23
lines changed

2 files changed

+19
-23
lines changed

src/main/java/frc/robot/constants/FieldConstants.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,15 @@ public static FieldZone getZone(Translation2d drivepose) {
161161
|| x > FIELD_LENGTH/2 + Units.inchesToMeters(120.0) && x < RED_ALLIANCE_LINE) {
162162
return FieldZone.TRENCH_BUMP;
163163
}
164-
if(((y < FIELD_WIDTH - (48.75 / 2) && y > FIELD_WIDTH - (48.75 / 2))) && (x < 47.0 || x > FIELD_LENGTH - 47.0)) {
164+
if(((y < (FIELD_WIDTH / 2) + 0.158750) && y > (FIELD_WIDTH / 2) - 0.736600) && (x < Units.inchesToMeters(47.0) || x > FIELD_LENGTH - Units.inchesToMeters(47.0)) && Robot.getAlliance() == Alliance.Blue) {
165165
return FieldZone.UNDER_LADDER;
166166
}
167-
if(((y < FIELD_WIDTH - (46.75 / 2) && y > FIELD_WIDTH - (46.75 / 2))) && ((x > 207.42375 && x < 207.42375 + 36.0) || (x < FIELD_LENGTH - 207.42375 && x > FIELD_LENGTH - 207.42375 - 36.0))) {
167+
if(((y < (FIELD_WIDTH / 2) - 0.158750) && y > (FIELD_WIDTH / 2) + 0.736600) && (x < Units.inchesToMeters(47.0) || x > FIELD_LENGTH - Units.inchesToMeters(47.0)) && Robot.getAlliance() == Alliance.Red) {
168168
return FieldZone.UNDER_LADDER;
169169
}
170+
// if(((y < FIELD_WIDTH - (46.75 / 2) && y > FIELD_WIDTH - (46.75 / 2))) && ((x > 207.42375 && x < 207.42375 + 36.0) || (x < FIELD_LENGTH - 207.42375 && x > FIELD_LENGTH - 207.42375 - 36.0))) {
171+
// return FieldZone.UNDER_LADDER;
172+
// }
170173
if(x > FieldConstants.RED_ALLIANCE_LINE) { // inside red
171174
if (Robot.getAlliance() == Alliance.Red) {
172175
return FieldZone.ALLIANCE;
Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,18 @@
11
package frc.robot.util;
22

3-
public class Zone {
4-
public double x_center;
5-
public double y_center;
6-
public double width;
7-
public double length;
3+
public record Zone(
4+
double x_center,
5+
double y_center,
6+
double width,
7+
double length) {
88

9-
public Zone(double x_center, double y_center, double width, double length) {
10-
this.x_center = x_center;
11-
this.y_center = y_center;
12-
this.width = width;
13-
this.length = length;
14-
}
15-
16-
public boolean isInside(double x, double y) {
17-
if (x > x_center + (length / 2) || x < x_center - (length / 2)) {
18-
return false;
19-
}
20-
if (y > y_center + (width / 2) || y < y_center - (width / 2)) {
21-
return false;
22-
}
23-
return true;
24-
}
9+
public boolean isInside(double x, double y) {
10+
if (x > x_center + (length / 2) || x < x_center - (length / 2)) {
11+
return false;
12+
}
13+
if (y > y_center + (width / 2) || y < y_center - (width / 2)) {
14+
return false;
15+
}
16+
return true;
17+
}
2518
}

0 commit comments

Comments
 (0)