Skip to content

Commit d35b0e1

Browse files
Reverted a push to main
1 parent 355bb02 commit d35b0e1

File tree

4 files changed

+10
-35
lines changed

4 files changed

+10
-35
lines changed

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ public class BargeAlignConstants {
77

88
public static final double kBlueEjectAlgaeX = 7.67; // 7.72
99
public static final double kRedEjectAlgaeX = 9.86; // 9.81
10-
public static final double kBlueRaiseElevatorX = 7.22; // 7.22
11-
public static final double kRedRaiseElevatorX = 10.71; // 10.31
12-
public static final double kBlueUnsafeX = 7.02;
13-
public static final double kRedUnsafeX = 10.51;
10+
public static final double kBlueRaiseElevatorX = 7.02; // 7.22
11+
public static final double kRedRaiseElevatorX = 10.51; // 10.31
1412

1513
public static final Rotation2d kBlueDesiredYaw = Rotation2d.fromDegrees(0.0);
1614
public static final Rotation2d kRedDesiredYaw = Rotation2d.fromDegrees(180.0);

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ public class RobotStateConstants {
88
public static final double[] kNodeAngles = {0.0, 60.0, 120.0, 180.0, -120.0, -60.0};
99
public static final double kAlgaeRetreatDistance = 0;
1010

11-
// Use Barge align constants
12-
// public static final double kBlueBargeSafeX = 7; // 7.6
13-
// public static final double kRedBargeSafeX = DriveConstants.kFieldMaxX - kBlueBargeSafeX;
11+
public static final double kBlueBargeSafeX = 7; // 7.6
12+
public static final double kRedBargeSafeX = DriveConstants.kFieldMaxX - kBlueBargeSafeX;
1413

1514
public static final double kCoralEjectTimer = 0.25;
1615
public static final double kAlgaeEjectTimer = 0.5;

src/main/java/frc/robot/subsystems/robotState/RobotStateSubsystem.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import edu.wpi.first.units.measure.Angle;
1010
import edu.wpi.first.wpilibj.DriverStation.Alliance;
1111
import edu.wpi.first.wpilibj.Timer;
12-
import frc.robot.constants.BargeAlignConstants;
1312
import frc.robot.constants.DriveConstants;
1413
import frc.robot.constants.ElevatorConstants;
1514
import frc.robot.constants.RobotConstants;
@@ -673,8 +672,8 @@ public void toScoreAlgae() {
673672
}
674673
double poseX = driveSubsystem.getPoseMeters().getX();
675674
isBargeSafe =
676-
poseX > BargeAlignConstants.kRedRaiseElevatorX
677-
|| poseX < BargeAlignConstants.kBlueRaiseElevatorX;
675+
poseX > RobotStateConstants.kRedBargeSafeX
676+
|| poseX < RobotStateConstants.kBlueBargeSafeX;
678677
if (isBargeSafe) {
679678
driveSubsystem.setDriveMultiplier(DriveConstants.kBargeScoreStickMultiplier);
680679
if (isAutoPlacing) {

src/main/java/frc/robot/subsystems/tagAlign/BargeAlignSubsystem.java

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
import edu.wpi.first.wpilibj.DriverStation.Alliance;
66
import frc.robot.constants.BargeAlignConstants;
77
import frc.robot.constants.DriveConstants;
8+
import frc.robot.constants.RobotStateConstants;
89
import frc.robot.controllers.FlyskyJoystick;
910
import frc.robot.subsystems.drive.DriveSubsystem;
1011
import java.util.Set;
1112
import org.littletonrobotics.junction.Logger;
1213
import org.strykeforce.telemetry.measurable.MeasurableSubsystem;
1314
import org.strykeforce.telemetry.measurable.Measure;
14-
// TODO Make final drive faster. Reverse if we are too close to the barge.
1515

1616
public class BargeAlignSubsystem extends MeasurableSubsystem {
1717

@@ -76,24 +76,15 @@ private void setupBargeAlign() {
7676
private boolean isSafe() {
7777
double poseX = driveSubsystem.getPoseMeters().getX();
7878

79-
return poseX > BargeAlignConstants.kRedRaiseElevatorX
80-
|| poseX < BargeAlignConstants.kBlueRaiseElevatorX;
79+
return poseX > RobotStateConstants.kRedBargeSafeX
80+
|| poseX < RobotStateConstants.kBlueBargeSafeX;
8181
}
8282

8383
private boolean shouldRaiseElevator() {
8484
double poseX = driveSubsystem.getPoseMeters().getX();
8585
return isOnBlueSide
8686
? poseX > BargeAlignConstants.kBlueRaiseElevatorX
87-
&& poseX <= BargeAlignConstants.kBlueUnsafeX
88-
: poseX < BargeAlignConstants.kRedRaiseElevatorX
89-
&& poseX >= BargeAlignConstants.kRedUnsafeX;
90-
}
91-
92-
private boolean shouldDriveBackwards() {
93-
double poseX = driveSubsystem.getPoseMeters().getX();
94-
return isOnBlueSide
95-
? poseX > BargeAlignConstants.kBlueUnsafeX
96-
: poseX < BargeAlignConstants.kRedUnsafeX;
87+
: poseX < BargeAlignConstants.kRedRaiseElevatorX;
9788
}
9889

9990
private boolean shouldEjectAlgae() {
@@ -140,8 +131,6 @@ public void periodic() {
140131
Logger.recordOutput("BargeAlign/Vomega", vOmega);
141132
if (shouldRaiseElevator()) {
142133
setState(BargeAlignStates.RAISE_ELEV);
143-
} else if (shouldDriveBackwards()) {
144-
setState(BargeAlignStates.REVERSE);
145134
}
146135
}
147136
case RAISE_ELEV -> {
@@ -156,15 +145,6 @@ public void periodic() {
156145
terminate();
157146
}
158147
}
159-
case REVERSE -> {
160-
if (isOnBlueSide) {
161-
driveSubsystem.move(
162-
-vX, getYStickReading(), BargeAlignConstants.kBlueRaiseElevatorX, true);
163-
//TODO add should raise elevator
164-
} else {
165-
driveSubsystem.move(vX, getYStickReading(), BargeAlignConstants.kRedRaiseElevatorX, true);
166-
}
167-
}
168148
case FINISHED -> {}
169149
}
170150
}
@@ -178,7 +158,6 @@ public enum BargeAlignStates {
178158
// INIT,
179159
DRIVE,
180160
RAISE_ELEV,
181-
REVERSE,
182161
FINISHED
183162
}
184163
}

0 commit comments

Comments
 (0)