Skip to content

Commit

Permalink
fix for smartcollecttele
Browse files Browse the repository at this point in the history
  • Loading branch information
WindowsVistaisCool committed Aug 15, 2024
1 parent ac83779 commit 98af64d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ protected void initializeNamedCommands() {
new AutonSmartCollect(() -> 0.5, () -> 0.6, collector, indexer)
.deadlineWith(leds.enableState(LED_STATES.COLLECTING).withTimeout(1)));
NamedCommands.registerCommand("Smart-Collect-Tele",
new SmartCollect(() -> 0.5, () -> 0.6, collector, indexer, pivot, flywheel)
new SmartCollect(() -> 0.5, () -> 0.6, collector, indexer, pivot, flywheel, true)
.deadlineWith(leds.enableState(LED_STATES.COLLECTING).withTimeout(1)));
NamedCommands.registerCommand("Index-Up", new Index(() -> IndexerConstants.INDEXER_DEFAULT_POWER, indexer));
NamedCommands.registerCommand("PathFind", new PathToPose(PathFindingConstants.TEST_POSE, drivetrain));
Expand All @@ -195,7 +195,7 @@ protected void initializeNamedCommands() {
NamedCommands.registerCommand("End-Kama", new InstantCommand(() -> flywheel.endKama()));
NamedCommands.registerCommand("Start-Kama", new InstantCommand(() -> flywheel.startKama()));
NamedCommands.registerCommand("Note-Pass", new InstantCommand()); // Why is this here?? IDK but im gonna keep it here so we don't break things
// NamedCommands.registerCommand("Reverse-Cheese-Paste", new ReverseChasePieces(drivetrain, collector, indexer, limelights));
NamedCommands.registerCommand("Reverse-Cheese-Paste", new InstantCommand()); //new ReverseChasePieces(drivetrain, collector, indexer, limelights));

// make sure named commands are initialized before autobuilder!
autoChooser = AutoBuilder.buildAutoChooser();
Expand Down
11 changes: 9 additions & 2 deletions src/main/java/frc/robot/command/SmartCollect.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,30 @@ public class SmartCollect extends Command {
* @param indexer subsystem
* @param pivot subsystem (read only)
* @param flywheel subsystem
* @param isAutonomous whether or not this command is being used in autonomous
*/
public SmartCollect(DoubleSupplier collectorPower, DoubleSupplier indexerPower, Collector collector,
Indexer indexer, Pivot pivot, Flywheel flywheel) {
Indexer indexer, Pivot pivot, Flywheel flywheel, boolean isAutonomous) {
this.collector = collector;
this.indexer = indexer;
this.pivot = pivot;
this.flywheel = flywheel;
this.collectorPower = collectorPower;
this.indexerPower = indexerPower;

if (DriverStation.isAutonomous()) {
if (isAutonomous || DriverStation.isAutonomous()) {
addRequirements(collector, indexer);
} else {
addRequirements(collector, indexer, flywheel);
}
}

// Overloaded constructor for use in teleop
public SmartCollect(DoubleSupplier collectorPower, DoubleSupplier indexerPower, Collector collector,
Indexer indexer, Pivot pivot, Flywheel flywheel) {
this(collectorPower, indexerPower, collector, indexer, pivot, flywheel, false);
}

@Override
public void initialize() {
reversedFromExit = false;
Expand Down
15 changes: 9 additions & 6 deletions src/main/java/frc/robot/command/shoot/NotePass.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package frc.robot.command.shoot;

import java.sql.Driver;
import java.util.function.BooleanSupplier;
import edu.wpi.first.math.controller.PIDController;
import edu.wpi.first.math.controller.SimpleMotorFeedforward;
import edu.wpi.first.math.geometry.Pose2d;
Expand All @@ -18,7 +16,6 @@
import frc.robot.Constants.PassConstants;
import frc.robot.Constants.ShooterConstants;
import frc.robot.subsystems.Flywheel;
import frc.robot.subsystems.Indexer;
import frc.robot.subsystems.Pivot;
import frc.robot.subsystems.Swerve;
import frc.thunder.command.TimedCommand;
Expand Down Expand Up @@ -52,9 +49,9 @@ public class NotePass extends Command {
* Creates a new NotePass.
*
* @param drivetrain subsystem
* @param pivot subsystem
* @param flywheel subsystem
* @param driver the driver's controller, used for drive input
* @param pivot subsystem
* @param flywheel subsystem
* @param driver the driver's controller, used for drive input
*/
public NotePass(Swerve drivetrain, Flywheel flywheel, Pivot pivot, XboxControllerFilter driver) {
this.drivetrain = drivetrain;
Expand All @@ -67,6 +64,12 @@ public NotePass(Swerve drivetrain, Flywheel flywheel, Pivot pivot, XboxControlle

@Override
public void initialize() {
/*
* Because the flywheels are on one side, the note will spin slightly
* which is why we want to use the corner pose on blue and
* the speaker pose on red.
* I may be going crazy but whatever!!
*/
if (isBlueAlliance()) {
targetPose = DrivetrainConstants.BLUE_CORNER_POSE;
} else {
Expand Down

0 comments on commit 98af64d

Please sign in to comment.