-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStartOutake.java
More file actions
39 lines (32 loc) · 1.03 KB
/
StartOutake.java
File metadata and controls
39 lines (32 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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);
}
}