Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auton delay #74

Closed
wants to merge 1 commit into from
Closed
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
3 changes: 3 additions & 0 deletions src/main/java/frc/robot/autons/Auton.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
import edu.wpi.first.wpilibj.DriverStation.Alliance;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
import edu.wpi.first.wpilibj2.command.WaitCommand;
import frc.robot.constants.AutoConstants;
import frc.robot.constants.DriveConstants;
import frc.robot.constants.FieldConstants;
import frc.robot.subsystems.Dashboard;
import frc.robot.subsystems.DriveTrain;

public abstract class Auton extends SequentialCommandGroup {
Expand All @@ -30,6 +32,7 @@ public Auton(Optional<Alliance> alliance) {
if (alliance.isPresent()) {
this.alliance = alliance.get();
}
this.addCommands(new WaitCommand(Dashboard.getInstance().getAutoDelay()));
}

protected void setInitialPose(PathPlannerTrajectory initialTrajectory) {
Expand Down
4 changes: 0 additions & 4 deletions src/main/java/frc/robot/autons/AutonSelector.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ public class AutonSelector {
public enum AutonChoices {
NoAuto,
AmpAuto,
AmpAutoWait,
AmpAutoAcquire,
TaxiPos1,
TaxiPos2,
Expand All @@ -38,7 +37,6 @@ private AutonSelector() {

this.autoChooser.setDefaultOption("No Auto", AutonChoices.NoAuto);
this.autoChooser.addOption("Score 2 In Amp Position 1", AutonChoices.AmpAuto);
this.autoChooser.addOption("Wait Score in amp position 1", AutonChoices.AmpAutoWait);
this.autoChooser.addOption("Score 2 in amp and acquire Pos 1", AutonChoices.AmpAutoAcquire);
this.autoChooser.addOption("Taxi Position 1", AutonChoices.TaxiPos1);
this.autoChooser.addOption("Taxi Position 2", AutonChoices.TaxiPos2);
Expand All @@ -50,8 +48,6 @@ public Auton chooseAuton() {
switch (this.autoChooser.getSelected()) {
case AmpAuto:
return new ScoreInAmp(alliance);
case AmpAutoWait:
return new ScoreInAmpWait(alliance);
case AmpAutoAcquire:
return new ScoreInAmpAcquire(alliance);
case TaxiPos1:
Expand Down
38 changes: 0 additions & 38 deletions src/main/java/frc/robot/autons/ScoreInAmpWait.java

This file was deleted.

14 changes: 14 additions & 0 deletions src/main/java/frc/robot/subsystems/Dashboard.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import edu.wpi.first.cscore.HttpCamera;
import edu.wpi.first.cscore.VideoSource.ConnectionStrategy;
import edu.wpi.first.math.MathUtil;
import edu.wpi.first.math.trajectory.Trajectory;
import edu.wpi.first.networktables.GenericEntry;
import edu.wpi.first.networktables.NetworkTableInstance;
Expand Down Expand Up @@ -51,6 +52,10 @@ public enum Cameras {
.getEntry();

// Drivers Tab Inputs
private GenericEntry autonDelay = driversTab.add("Auton Delay", 0)
.withPosition(0, 1)
.withSize(2, 1)
.getEntry();
private GenericEntry feedAmpSpeed = driversTab.add("Feed Amp Speed", ScoringConstants.feedAmpSpeed)
.withPosition(0, 2)
.getEntry();
Expand Down Expand Up @@ -178,4 +183,13 @@ public void clearTrajectory() {
public SendableChooser<AutonChoices> getAutoChooser() {
return autoChooser;
}

/**
* Gets the number of seconds to delay the start of auton
*
* @return delay in seconds clamped between 0 and 10 seconds
*/
public double getAutoDelay() {
return MathUtil.clamp(autonDelay.getDouble(0), 0, 10);
}
}
Loading