-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathShooterCommand.java
More file actions
42 lines (35 loc) · 1.32 KB
/
ShooterCommand.java
File metadata and controls
42 lines (35 loc) · 1.32 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
40
41
42
package frc.robot.commands;
import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.subsystems.ShooterSubsystem;
public class ShooterCommand extends Command {
private final ShooterSubsystem m_subsystem;
private final String m_commandType;
public ShooterCommand(ShooterSubsystem subsystem, String commandType) {
m_commandType = commandType;
m_subsystem = subsystem;
addRequirements(subsystem);
}
public ShooterCommand(ShooterSubsystem subsystem) {
m_commandType = "both";
m_subsystem = subsystem;
addRequirements(subsystem);
}
// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {
if (m_commandType.equals("both")) m_subsystem.runShooter();
else if (m_commandType.equals("front")) m_subsystem.runShooter(0.0);
// else if (m_commandType.equals("index")) m_subsystem.runIndex();
}
// Called once the command ends or is interrupted.
@Override
public void end(boolean interrupted) {
if (m_commandType.equals("both") || m_commandType.equals("front") || m_commandType.equals("all")) m_subsystem.stopShooter();
// if (m_commandType.equals("index") || m_commandType.equals("all")) m_subsystem.stopIndex();
}
// Returns true when the command should end.
@Override
public boolean isFinished() {
return false;
}
}