Skip to content

Commit

Permalink
[#466] reformating (needs testing!)
Browse files Browse the repository at this point in the history
  • Loading branch information
Meh243 committed Mar 22, 2024
1 parent 45869da commit ba4f00e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 26 deletions.
3 changes: 2 additions & 1 deletion src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import frc.robot.Constants.PathFindingConstants;
import frc.robot.Constants.LEDsConstants.LED_STATES;
import frc.robot.Constants.TunerConstants;
import frc.robot.command.AutonSmartCollect;
import frc.robot.command.ChasePieces;
import frc.robot.command.Collect;
import frc.robot.command.CollectAndGo;
Expand Down Expand Up @@ -165,7 +166,7 @@ protected void initializeNamedCommands() {
NamedCommands.registerCommand("Chase-Pieces",
new ChasePieces(drivetrain, collector, indexer, pivot, flywheel, limelights));
NamedCommands.registerCommand("Smart-Collect",
new SmartCollect(() -> .5d, () -> .6d, collector, indexer, pivot, flywheel)
new AutonSmartCollect(() -> 0.5, () -> 0.6, collector, indexer, pivot)
.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));
Expand Down
31 changes: 6 additions & 25 deletions src/main/java/frc/robot/command/AutonSmartCollect.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import frc.robot.RobotContainer;
import frc.robot.Constants.IndexerConstants.PieceState;
import frc.robot.subsystems.Collector;
import frc.robot.subsystems.Flywheel;
import frc.robot.subsystems.Indexer;
import frc.robot.subsystems.Pivot;
import frc.thunder.command.TimedCommand;
Expand All @@ -19,7 +18,6 @@ public class AutonSmartCollect extends Command {
private Collector collector;
private Indexer indexer;
private Pivot pivot;
private Flywheel flywheel;

/* Used to prevent indexing if pivot angle is too high */
private boolean allowIndex;
Expand All @@ -38,22 +36,17 @@ public class AutonSmartCollect extends Command {
* @param collector subsystem
* @param indexer subsystem
* @param pivot subsystem (read only)
* @param flywheel subsystem
*/
public AutonSmartCollect(DoubleSupplier collectorPower, DoubleSupplier indexerPower, Collector collector,
Indexer indexer, Pivot pivot, Flywheel flywheel) {
Indexer indexer, Pivot pivot) {
this.collectorPower = collectorPower;
this.indexerPower = indexerPower;

this.collector = collector;
this.indexer = indexer;
this.pivot = pivot;
this.flywheel = flywheel;
this.collectorPower = collectorPower;
this.indexerPower = indexerPower;

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

@Override
Expand All @@ -73,9 +66,6 @@ public void execute() {
collector.setPower(collectorPower.getAsDouble());
if (allowIndex) {
indexer.setPower(indexerPower.getAsDouble());
if (!DriverStation.isAutonomous()) {
flywheel.setAllMotorsRPM(-200);
}
}
break;

Expand All @@ -84,9 +74,6 @@ public void execute() {
// Slow down collector to prevent jamming
collector.setPower(0.65 * collectorPower.getAsDouble());
indexer.setPower(indexerPower.getAsDouble());
if(!DriverStation.isAutonomous()){
flywheel.setAllMotorsRPM(-500);
}
} else {
// Stop collecting since pivot is not in right place
collector.stop();
Expand All @@ -100,9 +87,6 @@ public void execute() {
indexer.setPower(0.9 * indexerPower.getAsDouble());
} else if (reversedFromExit) {
indexer.stop();
if(!DriverStation.isAutonomous()){
flywheel.coast(true);
}
new TimedCommand(RobotContainer.hapticCopilotCommand(), 1d).schedule();
}
break;
Expand All @@ -119,11 +103,8 @@ public void execute() {
public void end(boolean interrupted) {
collector.stop();
indexer.stop();
if(!DriverStation.isAutonomous()){
flywheel.coast(true);
}

System.out.println("COLLECT - Smart Collect END");
System.out.println("COLLECT - Auton Smart Collect END");
}

@Override
Expand Down

0 comments on commit ba4f00e

Please sign in to comment.