Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions src/main/java/frc/robot/commands/intake/StartOutake.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package frc.robot.commands.intake;

import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.constants.Constants;
import frc.robot.subsystems.IntakeSubsystem;

public class StartOutake extends Command {
private final IntakeSubsystem intakeSubsystem;
private final Timer timer = new Timer();
private final int motorRunTime;

public StartOutake(IntakeSubsystem intakeSubsystem, int motorRunTime) {
addRequirements(intakeSubsystem);
this.intakeSubsystem = intakeSubsystem;
this.motorRunTime = motorRunTime;
}

@Override
public void initialize() {
timer.reset();
timer.start();
}

@Override
public void execute() {
intakeSubsystem.setMotorSpeed(-Constants.INTAKE_MOTOR_1_SPEED, -Constants.INTAKE_MOTOR_2_SPEED);
}

@Override
public void end(boolean interrupted) {
intakeSubsystem.stopMotors();
}

@Override
public boolean isFinished() {
return timer.hasElapsed(motorRunTime);
}
}