Skip to content

Commit

Permalink
Merge branch 'algaeintake'
Browse files Browse the repository at this point in the history
  • Loading branch information
therbun committed Mar 1, 2025
2 parents d9ab030 + c90c88b commit 669443d
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 7 deletions.
15 changes: 15 additions & 0 deletions src/main/java/frc/robot/commands/IntakeSetPivotCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package frc.robot.commands;

import frc.robot.subsystems.AlgaeIntakeSubsystem.AlgaeIntakeSubsystem;

public class IntakeSetPivotCommand {
private final AlgaeIntakeSubsystem intakeSubsystem;

public IntakeSetPivotCommand(AlgaeIntakeSubsystem subsystem) {
this.intakeSubsystem = subsystem;
}

public void initialize() { intakeSubsystem.setPivotToVoltage(); }

public boolean isFinished() { return true; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.subsystems.AlgaeIntakeSubsystem.AlgaeIntakeSubsystem;

public class IntakePickupCommand extends Command {
public class IntakeSetRollersCommand extends Command {
private final AlgaeIntakeSubsystem intakeSubsystem;

public IntakePickupCommand(AlgaeIntakeSubsystem intakeSubsystem) {
public IntakeSetRollersCommand(AlgaeIntakeSubsystem intakeSubsystem) {
this.intakeSubsystem = intakeSubsystem;
addRequirements(intakeSubsystem);
}

public void initialize() {
intakeSubsystem.pickup();
intakeSubsystem.setRollersToVoltage();
}

public boolean isFinished() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
package frc.robot.subsystems.AlgaeIntakeSubsystem;

import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.robot.constants.IntakeConstants;

public class AlgaeIntakeSubsystem extends SubsystemBase {
private final IntakeIO intake;

private final IntakeIO.IntakeInputsAutoLogged inputs = new IntakeIO.IntakeInputsAutoLogged();
public AlgaeIntakeSubsystem(IntakeIO intake){
this.intake = intake;
}

public void pickup() {
intake.pivotDown();
intake.pivotUp();
public void setPivotToVoltage() {
intake.setPivotVoltage(IntakeConstants.pivotVoltsTarget);
}

public void setRollersToVoltage() {
intake.setRollersVoltage(IntakeConstants.rollerVoltsTarget);
}

public void periodic() {
intake.updateInputs(inputs);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public class IntakeInputsAutoLogged {
public default void setRunning(boolean state) {}
public default void pivotDown() {}
public default void pivotUp() {}
public default void setPivotVoltage(double volts) {}
public default void setRollersVoltage(double volts) {}
public default boolean getIsRunning() { return false; }
public default boolean coralInside() { return false; }
public default void updateInputs(IntakeInputsAutoLogged inputs) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,16 @@ public void pivotUp() {
pivotWheel.setInputVoltage(IntakeConstants.pivotVoltsTarget);
}

@Override
public void setPivotVoltage(double volts) {
pivotWheel.setInputVoltage(volts);
}

@Override
public void setRollersVoltage(double volts) {
rollers.setInputVoltage(volts);
}

@Override
public boolean coralInside() {
return intakeSim.getGamePiecesAmount() != 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ public void pivotUp() {
setRunning(false);
}

@Override
public void setPivotVoltage(double volts) {
pivot.setVoltage(volts);
}

@Override
public void setRollersVoltage(double volts) {
rollers.setVoltage(volts);
}

@Override
public void updateInputs(IntakeInputsAutoLogged inputs) {
inputs.isRunning = isRunning;
Expand Down

0 comments on commit 669443d

Please sign in to comment.