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
376 changes: 300 additions & 76 deletions src/main/deploy/choreo/OppBargeToOppG.traj

Large diffs are not rendered by default.

323 changes: 263 additions & 60 deletions src/main/deploy/choreo/OppGToOppBarge.traj

Large diffs are not rendered by default.

308 changes: 156 additions & 152 deletions src/main/deploy/choreo/bargeToE.traj

Large diffs are not rendered by default.

112 changes: 112 additions & 0 deletions src/main/deploy/choreo/midStartPToESlow.traj

Large diffs are not rendered by default.

115 changes: 0 additions & 115 deletions src/main/deploy/choreo/midStartPtoESlow.traj

This file was deleted.

47 changes: 24 additions & 23 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -461,29 +461,30 @@ private void configureOperatorBindings() {

new Trigger(() -> xboxController.getPOV() != -1).onTrue(new EjectAlgaeCommand(algaeSubsystem));

// Move biscuit
new Trigger((() -> xboxController.getRightY() < -RobotConstants.kTestingDeadband))
.onTrue(
new JogBiscuitCommand(
biscuitSubsystem, Angle.ofBaseUnits(BiscuitConstants.kJogAmountUp, Rotations)))
.onFalse(new HoldBiscuitCommand(biscuitSubsystem));
new Trigger((() -> xboxController.getRightY() > RobotConstants.kTestingDeadband))
.onTrue(
new JogBiscuitCommand(
biscuitSubsystem, Angle.ofBaseUnits(BiscuitConstants.kJogAmountDown, Rotations)))
.onFalse(new HoldBiscuitCommand(biscuitSubsystem));

// Move elevator
new Trigger((() -> xboxController.getLeftY() < -RobotConstants.kTestingDeadband))
.onTrue(
new JogElevatorCommand(
elevatorSubsystem, Angle.ofBaseUnits(ElevatorConstants.kJogAmountUp, Rotations)))
.onFalse(new HoldElevatorCommand(elevatorSubsystem));
new Trigger((() -> xboxController.getLeftY() > RobotConstants.kTestingDeadband))
.onTrue(
new JogElevatorCommand(
elevatorSubsystem, Angle.ofBaseUnits(ElevatorConstants.kJogAmountDown, Rotations)))
.onFalse(new HoldElevatorCommand(elevatorSubsystem));
// // Move biscuit
// new Trigger((() -> xboxController.getRightY() < -RobotConstants.kTestingDeadband))
// .onTrue(
// new JogBiscuitCommand(
// biscuitSubsystem, Angle.ofBaseUnits(BiscuitConstants.kJogAmountUp, Rotations)))
// .onFalse(new HoldBiscuitCommand(biscuitSubsystem));
// new Trigger((() -> xboxController.getRightY() > RobotConstants.kTestingDeadband))
// .onTrue(
// new JogBiscuitCommand(
// biscuitSubsystem, Angle.ofBaseUnits(BiscuitConstants.kJogAmountDown, Rotations)))
// .onFalse(new HoldBiscuitCommand(biscuitSubsystem));

// // Move elevator
// new Trigger((() -> xboxController.getLeftY() < -RobotConstants.kTestingDeadband))
// .onTrue(
// new JogElevatorCommand(
// elevatorSubsystem, Angle.ofBaseUnits(ElevatorConstants.kJogAmountUp, Rotations)))
// .onFalse(new HoldElevatorCommand(elevatorSubsystem));
// new Trigger((() -> xboxController.getLeftY() > RobotConstants.kTestingDeadband))
// .onTrue(
// new JogElevatorCommand(
// elevatorSubsystem, Angle.ofBaseUnits(ElevatorConstants.kJogAmountDown,
// Rotations)))
// .onFalse(new HoldElevatorCommand(elevatorSubsystem));
}

private void configureTestOperatorBindings() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
import choreo.trajectory.SwerveSample;
import choreo.trajectory.Trajectory;
import edu.wpi.first.math.geometry.Pose2d;
import edu.wpi.first.wpilibj.DriverStation.Alliance;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.commands.drive.DriveAutonCommand;
import frc.robot.constants.AutonConstants;
import frc.robot.constants.DriveConstants;
import frc.robot.constants.PathHandlerConstants;
import frc.robot.subsystems.biscuit.BiscuitSubsystem;
import frc.robot.subsystems.drive.DriveSubsystem;
Expand Down Expand Up @@ -155,7 +157,13 @@ public void execute() {
desiredState = trajectory.sampleAt(timer.get(), mirrorTrajectory).get();
driveSubsystem.calculateController(desiredState);

if (shouldTransitionToServoing()) {
double currX = driveSubsystem.getPoseMeters().getX();

if (shouldTransitionToServoing()
&& (currX > DriveConstants.kCenterLineX
&& robotStateSubsystem.getAllianceColor() == Alliance.Blue
|| robotStateSubsystem.getAllianceColor() == Alliance.Red
&& currX < DriveConstants.kCenterLineX)) {
isServoing = true;

visionSubsystem.setIsAuto(true);
Expand Down
136 changes: 136 additions & 0 deletions src/main/java/frc/robot/commands/auton/NonProcessorSlowMicCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
package frc.robot.commands.auton;

import edu.wpi.first.math.geometry.Pose2d;
import edu.wpi.first.math.geometry.Rotation2d;
import edu.wpi.first.wpilibj2.command.ParallelCommandGroup;
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
import frc.robot.commands.drive.PrepOdomForAutoCommand;
import frc.robot.commands.elevator.ZeroElevatorCommand;
import frc.robot.commands.pathHandler.StartPathHandlerCommand;
import frc.robot.constants.PathHandlerConstants;
import frc.robot.subsystems.algae.AlgaeSubsystem;
import frc.robot.subsystems.biscuit.BiscuitSubsystem;
import frc.robot.subsystems.coral.CoralSubsystem;
import frc.robot.subsystems.drive.DriveSubsystem;
import frc.robot.subsystems.elevator.ElevatorSubsystem;
import frc.robot.subsystems.pathHandler.PathHandler;
import frc.robot.subsystems.robotState.RobotStateSubsystem;
import frc.robot.subsystems.robotState.RobotStateSubsystem.ScoreSide;
import frc.robot.subsystems.robotState.RobotStateSubsystem.ScoringLevel;
import frc.robot.subsystems.tagAlign.TagAlignSubsystem;
import frc.robot.subsystems.vision.VisionSubsystem;
import java.util.ArrayList;
import java.util.List;

public class NonProcessorSlowMicCommand extends SequentialCommandGroup
implements AutoCommandInterface {
private PathHandler pathHandler;
private DriveSubsystem driveSubsystem;
private DriveAutonServoCommand startPath;
private CoralSubsystem coralSubsystem;
private RobotStateSubsystem robotStateSubsystem;
private VisionSubsystem visionSubsystem;
private List<Character> NodeNames;
private List<ScoringLevel> NodeLevels;
private List<Double> lightDistances = new ArrayList<>();
private List<Double> postOffsets = new ArrayList<>();
private char startNode;

public NonProcessorSlowMicCommand(
DriveSubsystem driveSubsystem,
PathHandler pathHandler,
RobotStateSubsystem robotStateSubsystem,
AlgaeSubsystem algaeSubsystem,
BiscuitSubsystem biscuitSubsystem,
CoralSubsystem coralSubsystem,
ElevatorSubsystem elevatorSubsystem,
TagAlignSubsystem tagAlignSubsystem,
VisionSubsystem visionSubsystem,
String startPathName,
List<Character> NodeNames,
List<ScoringLevel> NodeLevels,
List<Double> lightDistances,
List<Double> postOffsets,
char startNode,
Boolean startScoreLeft,
Pose2d startPose) {
addRequirements(
driveSubsystem, algaeSubsystem, biscuitSubsystem, coralSubsystem, elevatorSubsystem);
this.pathHandler = pathHandler;
this.driveSubsystem = driveSubsystem;
this.coralSubsystem = coralSubsystem;
this.robotStateSubsystem = robotStateSubsystem;
this.visionSubsystem = visionSubsystem;

this.NodeNames = NodeNames;
this.NodeLevels = NodeLevels;
this.startNode = startNode;
this.lightDistances = lightDistances;
this.postOffsets = postOffsets;

startPath =
new DriveAutonServoCommand(
driveSubsystem,
tagAlignSubsystem,
elevatorSubsystem,
biscuitSubsystem,
robotStateSubsystem,
startPathName,
true,
true,
false,
startScoreLeft,
postOffsets.get(0));
postOffsets.remove(0);

addCommands(
new SequentialCommandGroup(
new ParallelCommandGroup(
new PrepOdomForAutoCommand(
robotStateSubsystem, driveSubsystem, Rotation2d.fromDegrees(180.0), startPose),
new ZeroElevatorCommand(elevatorSubsystem)),
// new SetGyroOffsetCommand(driveSubsystem, Rotation2d.fromDegrees(180)),
startPath,
new PlaceCoralAutonCommand(robotStateSubsystem, coralSubsystem),

// new ParallelCommandGroup(
// new ZeroElevatorCommand(elevatorSubsystem),
// new ResetOdometryCommand(
// driveSubsystem, new Pose2d(7.1008875, 5.0756788, new Rotation2d(180))),
// new SequentialCommandGroup(
// new SetGyroOffsetCommand(driveSubsystem, Rotation2d.fromDegrees(180)),
// new ResetOdometryCommand(driveSubsystem, AutonConstants.kNonProcessorShallow))),
// new ParallelCommandGroup(
// // new WaitCommand(0.03), new SetVisionUpdatesCommand(visionSubsystem, true)),
// startPath,
// new WaitForButtonPressCommand(button),
new StartPathHandlerCommand(
pathHandler,
PathHandlerConstants.kSlowShallowPathNames,
NodeNames,
NodeLevels,
startNode,
false)));
}

@Override
public void reassignAlliance() {
startPath.reassignAlliance();
driveSubsystem.teleResetGyro();
coralSubsystem.setAutoPreload();
robotStateSubsystem.setIsAutoPlacing(false);
robotStateSubsystem.setScoringLevel(ScoringLevel.L4);
robotStateSubsystem.setGetAlgaeOnCycle(false);
// robotStateSubsystem.setIsAuto(true);
robotStateSubsystem.setScoreSide(ScoreSide.RIGHT);
visionSubsystem.setVisionUpdating(true);
pathHandler.setPathNames(PathHandlerConstants.kSlowShallowPathNames);
pathHandler.setNodeNames(NodeNames);
pathHandler.setNodeLevels(NodeLevels);
pathHandler.setStartNode(startNode);
pathHandler.setGetAlgaeLast(false);
pathHandler.setLightDistances(lightDistances);
pathHandler.setPostOffsets(postOffsets);
// pathHandler.reassignAlliance();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public StealOneAlgeaNoSuperCycleAutonCommand(
robotStateSubsystem, driveSubsystem, Rotation2d.fromDegrees(180.0), startPose),
// new SetGyroOffsetCommand(driveSubsystem, Rotation2d.fromDegrees(180)),
firstPath,
new PlaceCoralAutonCommand(robotStateSubsystem, coralSubsystem),
new WaitForElevBelowBarge(elevatorSubsystem),
secondPath,
thirdPath,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
package frc.robot.commands.auton;

import edu.wpi.first.math.geometry.Pose2d;
import edu.wpi.first.math.geometry.Rotation2d;
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
import frc.robot.commands.drive.PrepOdomForAutoCommand;
import frc.robot.commands.robotState.AutoScoreAlgaeCommand;
import frc.robot.subsystems.algae.AlgaeSubsystem;
import frc.robot.subsystems.biscuit.BiscuitSubsystem;
import frc.robot.subsystems.coral.CoralSubsystem;
import frc.robot.subsystems.drive.DriveSubsystem;
import frc.robot.subsystems.elevator.ElevatorSubsystem;
import frc.robot.subsystems.robotState.RobotStateSubsystem;
import frc.robot.subsystems.robotState.RobotStateSubsystem.ScoreSide;
import frc.robot.subsystems.robotState.RobotStateSubsystem.ScoringLevel;
import frc.robot.subsystems.tagAlign.TagAlignSubsystem;
import frc.robot.subsystems.vision.VisionSubsystem;

public class StealTwoAlgeaNoSuperCycleAutonCommand extends SequentialCommandGroup
implements AutoCommandInterface {

private DriveSubsystem driveSubsystem;
private DriveAutonServoCommand firstPath;
private DriveAlgaeWaitAutonServoCommand secondPath;
private DriveBargeAutonCommand thirdPath;
private DriveAlgaeWaitAutonServoCommand fourthPath;
private DriveBargeAutonCommand fifthPath;
private CoralSubsystem coralSubsystem;
private RobotStateSubsystem robotStateSubsystem;
private VisionSubsystem visionSubsystem;

public StealTwoAlgeaNoSuperCycleAutonCommand(
DriveSubsystem driveSubsystem,
RobotStateSubsystem robotStateSubsystem,
AlgaeSubsystem algaeSubsystem,
BiscuitSubsystem biscuitSubsystem,
CoralSubsystem coralSubsystem,
ElevatorSubsystem elevatorSubsystem,
TagAlignSubsystem tagAlignSubsystem,
VisionSubsystem visionSubsystem,
String firstPathName,
String secondPathName,
String thirdPathName,
String fourthPathName,
String fifthPathName,
ScoringLevel OppAlgeaHeight1,
ScoringLevel OppAlgeaHeight2,
Pose2d startPose) {
addRequirements(
driveSubsystem, algaeSubsystem, biscuitSubsystem, coralSubsystem, elevatorSubsystem);
this.driveSubsystem = driveSubsystem;
this.coralSubsystem = coralSubsystem;
this.robotStateSubsystem = robotStateSubsystem;
this.visionSubsystem = visionSubsystem;

firstPath =
new DriveAutonServoCommand(
driveSubsystem,
tagAlignSubsystem,
elevatorSubsystem,
biscuitSubsystem,
robotStateSubsystem,
firstPathName,
true,
true,
false,
false,
0.0);

secondPath =
new DriveAlgaeWaitAutonServoCommand(
driveSubsystem,
tagAlignSubsystem,
elevatorSubsystem,
biscuitSubsystem,
robotStateSubsystem,
visionSubsystem,
secondPathName,
false,
true,
false,
0.0,
OppAlgeaHeight1,
1.5);

thirdPath =
new DriveBargeAutonCommand(
driveSubsystem,
tagAlignSubsystem,
elevatorSubsystem,
biscuitSubsystem,
robotStateSubsystem,
visionSubsystem,
thirdPathName,
true,
false);

fourthPath =
new DriveAlgaeWaitAutonServoCommand(
driveSubsystem,
tagAlignSubsystem,
elevatorSubsystem,
biscuitSubsystem,
robotStateSubsystem,
visionSubsystem,
fourthPathName,
false,
true,
false,
0.0,
OppAlgeaHeight2,
0.0);

fifthPath =
new DriveBargeAutonCommand(
driveSubsystem,
tagAlignSubsystem,
elevatorSubsystem,
biscuitSubsystem,
robotStateSubsystem,
visionSubsystem,
fifthPathName,
true,
false);

addCommands(
new SequentialCommandGroup(
new PrepOdomForAutoCommand(
robotStateSubsystem, driveSubsystem, Rotation2d.fromDegrees(180.0), startPose),
// new SetGyroOffsetCommand(driveSubsystem, Rotation2d.fromDegrees(180)),
firstPath,
new PlaceCoralAutonCommand(robotStateSubsystem, coralSubsystem),
new WaitForElevBelowBarge(elevatorSubsystem),
secondPath,
thirdPath,
new AutoScoreAlgaeCommand(
robotStateSubsystem, elevatorSubsystem, biscuitSubsystem, algaeSubsystem),
fourthPath,
fifthPath,
new AutoScoreAlgaeCommand(
robotStateSubsystem, elevatorSubsystem, biscuitSubsystem, algaeSubsystem)));
}

@Override
public void reassignAlliance() {
firstPath.reassignAlliance();
secondPath.reassignAlliance();
thirdPath.reassignAlliance();
fourthPath.reassignAlliance();
fifthPath.reassignAlliance();
driveSubsystem.teleResetGyro();
coralSubsystem.setAutoPreload();
robotStateSubsystem.setIsAutoPlacing(false);
robotStateSubsystem.setScoringLevel(ScoringLevel.L4);
robotStateSubsystem.setGetAlgaeOnCycle(false);
// robotStateSubsystem.setIsAuto(true);
robotStateSubsystem.setScoreSide(ScoreSide.RIGHT);
visionSubsystem.setVisionUpdating(true);
// pathHandler.reassignAlliance();
}
}
Loading