Skip to content

Commit

Permalink
fix more stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
quackitsquinn committed May 6, 2024
1 parent 4a307a5 commit e7bf22a
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 14 deletions.
6 changes: 6 additions & 0 deletions src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ public static class Auto {
/** Time in seconds that we delay our taxi in the delayed taxi auto. */
public static final double TAXI_DELAY_TIME = 10.0;

/** Time in seconds that we wait for FireNoteRoutine to end. */
public static final double DUMP_NOTE_WAIT_TIME = 4.0;

/** Time in seconds that we wait for PickupFromCenter to end. */
public static final double PICKUP_CENTER_WAIT_TIME = 5.0;

/** Constants for the DriveToAmpBlue auto */
public static class DriveToAmpBlue {
/** The time for the robot to drive left towards the amp. */
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
import frc.robot.subsystems.mailbox.MailboxBelts;
import frc.robot.subsystems.mailbox.MailboxPneumatics;
import java.util.Optional;
import org.jspecify.annotations.Nullable;

/** Singleton class that contains all the robot's subsystems, commands, and button bindings. */
@SuppressWarnings("unused")
Expand Down Expand Up @@ -397,12 +396,12 @@ public Command getAutonomousCommand() {
*
* @return the current alliance. Nullable.
*/
public static @Nullable Alliance getAlliance() {
public static boolean getAlliance() {
Optional<Alliance> alliance = DriverStation.getAlliance();
if (!alliance.isEmpty()) {
return alliance.get();
return alliance.get() == Alliance.Red;
} else {
return null;
return false;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

package frc.robot.commands;

import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.Constants;
import frc.robot.RobotContainer;
Expand Down Expand Up @@ -52,7 +51,7 @@ public void initialize() {
this.oldPipelineNumber = limelight.getLimelightPipeline();
limelight.setLimelightPipeline(seekingPipelineNumber);

if (RobotContainer.getAlliance() == DriverStation.Alliance.Red) {
if (RobotContainer.getAlliance()) {
this.rotationRadiansPerSecond = rotationRadiansPerSecond * -1;
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/frc/robot/commands/auto/DumpNote.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@

import edu.wpi.first.wpilibj2.command.ParallelDeadlineGroup;
import edu.wpi.first.wpilibj2.command.WaitCommand;
import frc.robot.Constants;
import frc.robot.commands.mailbox.FireNoteRoutine;

/** Auto that dumps the preloaded note in the robot after 4 seconds. */
public class DumpNote extends ParallelDeadlineGroup {
/** Creates a new DumpNote. */
public DumpNote() {
super(new WaitCommand(4), new FireNoteRoutine());
super(new WaitCommand(Constants.Auto.DUMP_NOTE_WAIT_TIME), new FireNoteRoutine());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

package frc.robot.commands.auto;

import edu.wpi.first.wpilibj.DriverStation.Alliance;
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
import frc.robot.RobotContainer;

Expand All @@ -23,7 +22,7 @@ public class OnePieceAutoButItWorksISwear extends SequentialCommandGroup {
/** Creates a new OnePieceAutoButItWorksISwear. */
public OnePieceAutoButItWorksISwear() {

if (RobotContainer.getAlliance() == Alliance.Red) {
if (RobotContainer.getAlliance()) {
addCommands(new DriveToAmpRed(), new DumpNote());
} else {
addCommands(new DriveToAmpBlue(), new DumpNote());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import edu.wpi.first.wpilibj2.command.ParallelCommandGroup;
import edu.wpi.first.wpilibj2.command.ParallelDeadlineGroup;
import edu.wpi.first.wpilibj2.command.WaitCommand;
import frc.robot.Constants;
import frc.robot.commands.RunIntake;
import frc.robot.commands.drive.DriveFieldOrientedHeadingSnapping;

Expand All @@ -25,7 +26,7 @@ public PickUpFromCenterAuto() {
addCommands(
new RunIntake(),
new ParallelDeadlineGroup(
new WaitCommand(5),
new WaitCommand(Constants.Auto.PICKUP_CENTER_WAIT_TIME),
new DriveFieldOrientedHeadingSnapping(
() -> 1.0,
() -> 0.0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

package frc.robot.commands.lightstrip;

import edu.wpi.first.wpilibj.DriverStation.Alliance;
import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.Constants;
import frc.robot.RobotContainer;
Expand All @@ -31,7 +30,7 @@ public EnabledLight() {
@Override
public void initialize() {

if (RobotContainer.getAlliance() == Alliance.Red) {
if (RobotContainer.getAlliance()) {
robotLights.setStripColor(Constants.LightStrips.Colors.ENABLE_COLOR_RED_ALLIANCE);
} else {
robotLights.setStripColor(Constants.LightStrips.Colors.ENABLE_COLOR_BLUE_ALLIANCE);
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/frc/robot/subsystems/Drive.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import edu.wpi.first.math.kinematics.ChassisSpeeds;
import edu.wpi.first.math.util.Units;
import edu.wpi.first.networktables.GenericEntry;
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.Filesystem;
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
Expand Down Expand Up @@ -80,7 +79,7 @@ public Drive() {
/* This will flip the path being followed to the red side of the field. */
/* THE ORIGIN WILL REMAIN ON THE BLUE SIDE */

return RobotContainer.getAlliance() == DriverStation.Alliance.Red;
return RobotContainer.getAlliance();
},
this /* Reference to this subsystem to set requirements */);
}
Expand Down

0 comments on commit e7bf22a

Please sign in to comment.