Commit | Line | Data |
---|---|---|
0a179caa KZ |
1 | package org.usfirst.frc.team3501.robot.commands.intakearm; |
2 | ||
3 | import org.usfirst.frc.team3501.robot.Constants; | |
4 | import org.usfirst.frc.team3501.robot.Robot; | |
5 | ||
6 | import edu.wpi.first.wpilibj.CANTalon; | |
7 | import edu.wpi.first.wpilibj.command.Command; | |
8 | ||
9 | /*** | |
10 | * This command runs the given motor (intended to be an intake arm motor) at the | |
11 | * given speed momentarily. | |
12 | * | |
13 | * @author harel, garima | |
14 | * | |
15 | */ | |
16 | ||
17 | public class RunIntakeMotor extends Command { | |
18 | CANTalon intakeMotor; | |
19 | double motorSpeed; | |
20 | ||
21 | /*** | |
22 | * @param intakeMotor | |
23 | * Motor to run. | |
24 | * @param motorSpeed | |
25 | * Speed at which to run motor. Range is [-1,1] | |
26 | */ | |
27 | public RunIntakeMotor(CANTalon intakeMotor, double motorSpeed) { | |
28 | requires(Robot.intakeArm); | |
29 | this.intakeMotor = intakeMotor; | |
30 | this.motorSpeed = motorSpeed; | |
31 | } | |
32 | ||
33 | @Override | |
34 | protected void initialize() { | |
35 | intakeMotor.set(motorSpeed); | |
36 | } | |
37 | ||
38 | @Override | |
39 | protected void execute() { | |
40 | ||
41 | } | |
42 | ||
43 | @Override | |
44 | protected boolean isFinished() { | |
45 | return true; | |
46 | } | |
47 | ||
48 | @Override | |
49 | protected void end() { | |
50 | intakeMotor.set(Constants.IntakeArm.STOP_INTAKE_ARM_SPEED); | |
51 | } | |
52 | ||
53 | @Override | |
54 | protected void interrupted() { | |
55 | end(); | |
56 | } | |
57 | } |