Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public boolean isFinished() {
return robotStateSubsystem.getState() == RobotStates.PROCESSOR_ALGAE
|| (robotStateSubsystem.getState() == RobotStates.BARGE_ALGAE
&& !robotStateSubsystem.getIsAutoPlacing())
|| !robotStateSubsystem.getIsBargeSafe();
/*|| !robotStateSubsystem.getIsBargeSafe() */ ;
}
}
}
4 changes: 4 additions & 0 deletions src/main/java/frc/robot/constants/BargeAlignConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@

public class BargeAlignConstants {
public static final double kXSpeed = 0.45;
public static final double kXRevSpeed = 2;

public static final double kBlueEjectAlgaeX = 7.67; // 7.72
public static final double kRedEjectAlgaeX = 9.86; // 9.81
public static final double kBlueRaiseElevatorX = 6.82; // 7.02
public static final double kRedRaiseElevatorX = 10.71; // 10.51

public static final double kBlueRevDoneX = kBlueRaiseElevatorX + 0.25;
public static final double kRedRevDoneX = kRedRaiseElevatorX - 0.25;

public static final double kBlueUnsafeX = 7.02;
public static final double kRedUnsafeX = 10.51;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -741,18 +741,18 @@ public void toScoreAlgae() {
isBargeSafe =
poseX > RobotStateConstants.kRedBargeSafeX
|| poseX < RobotStateConstants.kBlueBargeSafeX;
if (isBargeSafe) {
driveSubsystem.setDriveMultiplier(DriveConstants.kBargeScoreStickMultiplier);
if (isAutoPlacing) {
setAutoPlacingLed(true);
driveSubsystem.setIgnoreSticks(true);
bargeAlignSubsystem.startBargeAlign(allianceColor);
setState(RobotStates.BARGE_ALIGN);
} else {
elevatorSubsystem.setPosition(ElevatorConstants.kBargeSetpoint);
setState(RobotStates.TO_BARGE_ALGAE);
}
// if (isBargeSafe) {
driveSubsystem.setDriveMultiplier(DriveConstants.kBargeScoreStickMultiplier);
if (isAutoPlacing) {
setAutoPlacingLed(true);
driveSubsystem.setIgnoreSticks(true);
bargeAlignSubsystem.startBargeAlign(allianceColor);
setState(RobotStates.BARGE_ALIGN);
} else {
elevatorSubsystem.setPosition(ElevatorConstants.kBargeSetpoint);
setState(RobotStates.TO_BARGE_ALGAE);
}
// }
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ public BargeAlignSubsystem(FlyskyJoystick flysky, DriveSubsystem driveSubsystem)

public void startBargeAlign(Alliance alliance) {
this.alliance = alliance;
if (isSafe()) {
this.isOnBlueSide = isOnBlueSide();
setState(BargeAlignStates.DRIVE);
setupBargeAlign();
driveOmega.reset();
}
// if (isSafe()) {
this.isOnBlueSide = isOnBlueSide();
setState(BargeAlignStates.DRIVE);
setupBargeAlign();
driveOmega.reset();
// }
}

public void killBargeAlign() {
Expand Down Expand Up @@ -96,6 +96,13 @@ private boolean shouldDriveBackwards() {
: poseX < BargeAlignConstants.kRedUnsafeX;
}

private boolean shouldStopDrivingBackwards() {
double poseX = driveSubsystem.getPoseMeters().getX();
return isOnBlueSide
? poseX < BargeAlignConstants.kBlueRevDoneX
: poseX > BargeAlignConstants.kRedRevDoneX;
}

private boolean shouldEjectAlgae() {
double poseX = driveSubsystem.getPoseMeters().getX();
return isOnBlueSide
Expand Down Expand Up @@ -160,14 +167,14 @@ public void periodic() {
double vOmega =
driveOmega.calculate(
driveSubsystem.getPoseMeters().getRotation().getRadians(), targetYaw.getRadians());
double revX = BargeAlignConstants.kXRevSpeed * (isOnBlueSide ? -1 : 1);
driveSubsystem.move(revX, getYStickReading(), vOmega, true);

driveSubsystem.move(-vX, getYStickReading(), vOmega, true);

Logger.recordOutput("BargeAlign/Vx", vX);
Logger.recordOutput("BargeAlign/Vx", revX);
Logger.recordOutput("BargeAlign/OmegaErr", driveOmega.getError());
Logger.recordOutput("BargeAlign/Vomega", vOmega);

if (shouldRaiseElevator()) {
if (shouldStopDrivingBackwards()) {
setState(BargeAlignStates.RAISE_ELEV);
}
}
Expand Down