-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFetchCoralFromStationCommand.java
More file actions
35 lines (30 loc) · 1.16 KB
/
FetchCoralFromStationCommand.java
File metadata and controls
35 lines (30 loc) · 1.16 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
package frc.robot.commands;
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
import edu.wpi.first.wpilibj2.command.InstantCommand;
import edu.wpi.first.wpilibj2.command.WaitUntilCommand;
import frc.robot.ElevatorLevel;
import frc.robot.subsystems.Elevator;
import frc.robot.subsystems.CoralClaw;
/**
* A command that moves the elevator to STATION level and then activates
* the coral claw intake to fetch a coral from the station.
*/
public class FetchCoralFromStationCommand extends SequentialCommandGroup {
/**
* Creates a new FetchCoralFromStationCommand.
*
* @param elevator The elevator subsystem
* @param coralClaw The coral claw subsystem
*/
public FetchCoralFromStationCommand(Elevator elevator, CoralClaw coralClaw) {
addRequirements(elevator, coralClaw);
addCommands(
// Move the elevator to STATION level
new InstantCommand(() -> elevator.setTarget(ElevatorLevel.STATION), elevator),
// Wait until the elevator reaches the target position
new WaitUntilCommand(elevator::isAtTarget),
// Activate coral claw intake
new InstantCommand(coralClaw::intake, coralClaw)
);
}
}