-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCargoCommand.java
53 lines (46 loc) · 1.54 KB
/
CargoCommand.java
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
43
44
45
46
47
48
49
50
51
52
53
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package frc.robot.commands;
import edu.wpi.first.wpilibj.command.TimedCommand;
import frc.robot.Robot;
/**
* The hatch mech outake command
*/
public class CargoCommand extends TimedCommand {
/**
* The hatch outake command which automatically opens and closes the piston
*/
public CargoCommand(double timeout) {
super(timeout);
// Use requires() here to declare subsystem dependencies
// eg. requires(chassis);
requires(Robot.CargoIntake);
}
// Called just before this Command runs the first time
@Override
protected void initialize() {
Robot.CargoIntake.enablePiston();
Robot.CargoIntake.outputTelemetry();
}
// Called repeatedly when this Command is scheduled to run
@Override
protected void execute() {
Robot.CargoIntake.outputTelemetry();
}
// Called once after timeout
@Override
protected void end() {
Robot.CargoIntake.disablePiston();
Robot.CargoIntake.outputTelemetry();
}
// Called when another command which requires one or more of the same
// subsystems is scheduled to run
@Override
protected void interrupted() {
end();
}
}