Skip to content

Commit

Permalink
move registerCommands to RobotContainer
Browse files Browse the repository at this point in the history
  • Loading branch information
AvidCoder27 committed Aug 7, 2024
1 parent 3f3b978 commit 984474f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 40 deletions.
31 changes: 29 additions & 2 deletions src/main/java/frc/team5115/RobotContainer.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package frc.team5115;

import com.pathplanner.lib.auto.AutoBuilder;
import com.pathplanner.lib.auto.NamedCommands;

import edu.wpi.first.math.geometry.Pose2d;
import edu.wpi.first.math.geometry.Rotation2d;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.Command.InterruptionBehavior;
import edu.wpi.first.wpilibj2.command.Commands;
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
import frc.team5115.commands.AutoCommands;
import frc.team5115.commands.DriveCommands;
import frc.team5115.subsystems.amper.Amper;
import frc.team5115.subsystems.amper.AmperIO;
Expand Down Expand Up @@ -113,7 +114,7 @@ public RobotContainer() {

// Register auto commands for pathplanner
// PhotonVision is passed in here to prevent warnings, i.e. "unused variable: vision"
AutoCommands.registerCommands(drivetrain, vision, arm, amper, intake, feeder, shooter);
registerCommands(drivetrain, vision, arm, amper, intake, feeder, shooter);

// Set up auto routines
autoChooser = new LoggedDashboardChooser<>("Auto Choices", AutoBuilder.buildAutoChooser());
Expand Down Expand Up @@ -185,6 +186,32 @@ private void configureButtonBindings() {
.onFalse(DriveCommands.triggerAmp(arm, amper, intake, feeder));
}

/**
* Registers commands for pathplanner to use in autos
*
* @param shooter the shooter subsystem
* @param arm the arm subsystem
* @param drivetrain the drivetrain subsytem (not currently used)
* @param photonVision the photonvision subsystem (not currently used)
*/
public static void registerCommands(
Drivetrain drivetrain,
PhotonVision vision,
Arm arm,
Amper amper,
Intake intake,
Feeder feeder,
Shooter shooter) {
NamedCommands.registerCommand(
"InitialShoot",
DriveCommands.prepareShoot(arm, intake, feeder, shooter, 15, 5000)
.andThen(DriveCommands.feed(intake, feeder)));
NamedCommands.registerCommand("Intake", DriveCommands.intakeUntilNote(arm, intake, feeder));
NamedCommands.registerCommand("Shoot", DriveCommands.feed(intake, feeder));
NamedCommands.registerCommand(
"PrepareClose", DriveCommands.prepareShoot(arm, intake, feeder, shooter, 15, 5000));
}

/**
* Use this to pass the autonomous command to the main {@link Robot} class.
*
Expand Down
38 changes: 0 additions & 38 deletions src/main/java/frc/team5115/commands/AutoCommands.java

This file was deleted.

0 comments on commit 984474f

Please sign in to comment.