-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package frc.robot.commands; | ||
|
||
import edu.wpi.first.wpilibj2.command.Command; | ||
import edu.wpi.first.wpilibj2.command.InstantCommand; | ||
import edu.wpi.first.wpilibj2.command.button.CommandXboxController; | ||
import frc.robot.subsystems.Intake.Intake; | ||
|
||
public class IntakeCommand extends Command { | ||
private CommandXboxController controller; | ||
private Intake intake; | ||
|
||
public IntakeCommand(Intake intake, CommandXboxController controller) { | ||
this.controller = controller; | ||
this.intake = intake; | ||
addRequirements(intake); | ||
} | ||
|
||
@Override | ||
public void execute() { | ||
intake.setIntakeVoltage(1); | ||
controller.leftTrigger().whileTrue(new InstantCommand(() -> intake.setIntakeVoltage(-1))); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package frc.robot.commands; | ||
|
||
import edu.wpi.first.wpilibj2.command.Command; | ||
import edu.wpi.first.wpilibj2.command.InstantCommand; | ||
import edu.wpi.first.wpilibj2.command.button.CommandXboxController; | ||
import frc.robot.subsystems.Intake.Intake; | ||
|
||
public class OutTakeCommand extends Command { | ||
private CommandXboxController controller; | ||
private Intake intake; | ||
|
||
public OutTakeCommand(Intake intake, CommandXboxController controller) { | ||
this.controller = controller; | ||
this.intake = intake; | ||
addRequirements(intake); | ||
} | ||
|
||
@Override | ||
public void execute() { | ||
intake.setIntakeVoltage(-1); | ||
controller.rightTrigger().whileTrue(new InstantCommand(() -> intake.setIntakeVoltage(1))); | ||
controller.leftTrigger().whileTrue(new InstantCommand(() -> intake.setIntakeVoltage(-1))); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,22 @@ | ||
package frc.robot.subsystems.intake; | ||
package frc.robot.subsystems.Intake; | ||
Check warning on line 1 in src/main/java/frc/robot/subsystems/intake/intake.java GitHub Actions / Linting
|
||
|
||
public class intake { | ||
import edu.wpi.first.wpilibj2.command.SubsystemBase; | ||
|
||
public class Intake extends SubsystemBase { | ||
Check warning on line 5 in src/main/java/frc/robot/subsystems/intake/intake.java GitHub Actions / Linting
Check warning on line 5 in src/main/java/frc/robot/subsystems/intake/intake.java GitHub Actions / Linting
|
||
private IntakeIO io; | ||
private IntakeIOInputsAutoLogged inputs = new IntakeIOInputsAutoLogged(); | ||
|
||
public Intake(IntakeIO io) { | ||
this.io = io; | ||
} | ||
|
||
@Override | ||
public void periodic() { | ||
io.updateInputs(inputs); | ||
} | ||
|
||
public void setIntakeVoltage(int power) { | ||
io.setIntakeVoltage(power); | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
package frc.robot.subsystems.intake; | ||
package frc.robot.subsystems.Intake; | ||
Check warning on line 1 in src/main/java/frc/robot/subsystems/intake/intakeIO.java GitHub Actions / Linting
|
||
|
||
import org.littletonrobotics.junction.AutoLog; | ||
|
||
public interface intakeIO { | ||
public interface IntakeIO { | ||
Check warning on line 5 in src/main/java/frc/robot/subsystems/intake/intakeIO.java GitHub Actions / Linting
Check warning on line 5 in src/main/java/frc/robot/subsystems/intake/intakeIO.java GitHub Actions / Linting
|
||
|
||
@AutoLog | ||
Check warning on line 7 in src/main/java/frc/robot/subsystems/intake/intakeIO.java GitHub Actions / Linting
|
||
public static class intakeIOInputs { | ||
public static class IntakeIOInputs { | ||
public double rightMotor; | ||
public double leftMotor; | ||
} | ||
|
||
/** Updates the set of loggable inputs. */ | ||
public default void updateInputs(IntakeIOInputs inputs) {} | ||
|
||
public default void intakePower(double lvolts, double rvolts) {} | ||
public default void setIntakeVoltage(double power) {} | ||
|
||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
package frc.robot.subsystems.intake; | ||
package frc.robot.subsystems.Intake; | ||
Check warning on line 1 in src/main/java/frc/robot/subsystems/intake/intakeReal.java GitHub Actions / Linting
|
||
|
||
import edu.wpi.first.wpilibj.motorcontrol.VictorSP; | ||
|
||
public class intakeReal implements intakeIO { | ||
public class intakeReal implements IntakeIO { | ||
Check warning on line 5 in src/main/java/frc/robot/subsystems/intake/intakeReal.java GitHub Actions / Linting
Check warning on line 5 in src/main/java/frc/robot/subsystems/intake/intakeReal.java GitHub Actions / Linting
|
||
VictorSP leftIntake = new VictorSP(frc.robot.Constants.Motors.IntakeMotors.LMOTOR); | ||
VictorSP rightIntake = new VictorSP(frc.robot.Constants.Motors.IntakeMotors.RMOTOR); | ||
|
||
public intakeReal() { | ||
|
||
public void setIntakeVoltage(double volts) { | ||
rightIntake.setInverted(true); | ||
leftIntake.set(volts); | ||
rightIntake.set(volts); | ||
} | ||
|
||
|
||
public void intakeVoltage(double lvolts, double rvolts) { | ||
leftIntake.set(lvolts); | ||
rightIntake.set(rvolts); | ||
} | ||
@Override | ||
public void updateInputs(IntakeIOInputs inputs) {}; | ||
|
||
} | ||
|