-
Notifications
You must be signed in to change notification settings - Fork 60
/
GearThenHopperShootModeRed.java
executable file
·60 lines (55 loc) · 2.58 KB
/
GearThenHopperShootModeRed.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
54
55
56
57
58
59
60
package com.team254.frc2017.auto.modes;
import edu.wpi.first.wpilibj.Timer;
import com.team254.frc2017.auto.AutoModeBase;
import com.team254.frc2017.auto.AutoModeEndedException;
import com.team254.frc2017.auto.actions.Action;
import com.team254.frc2017.auto.actions.ActuateHopperAction;
import com.team254.frc2017.auto.actions.BeginShootingAction;
import com.team254.frc2017.auto.actions.CorrectPoseAction;
import com.team254.frc2017.auto.actions.DeployIntakeAction;
import com.team254.frc2017.auto.actions.DrivePathAction;
import com.team254.frc2017.auto.actions.ParallelAction;
import com.team254.frc2017.auto.actions.ResetPoseFromPathAction;
import com.team254.frc2017.auto.actions.ScoreGearAction;
import com.team254.frc2017.auto.actions.SeriesAction;
import com.team254.frc2017.auto.actions.SetFlywheelRPMAction;
import com.team254.frc2017.auto.actions.WaitAction;
import com.team254.frc2017.paths.BoilerGearToHopperRed;
import com.team254.frc2017.paths.PathContainer;
import com.team254.frc2017.paths.StartToBoilerGearRed;
import com.team254.frc2017.paths.profiles.PathAdapter;
import com.team254.lib.util.math.RigidTransform2d;
import java.util.Arrays;
/**
* Scores the preload gear onto the boiler-side peg then deploys the hopper and shoots all 60 balls (10 preload + 50
* hopper).
*
* This was the primary autonomous mode used at SVR, St. Louis Champs, and FOC.
*
* @see AutoModeBase
*/
public class GearThenHopperShootModeRed extends AutoModeBase {
@Override
protected void routine() throws AutoModeEndedException {
PathContainer gearPath = new StartToBoilerGearRed();
double start = Timer.getFPGATimestamp();
runAction(new ResetPoseFromPathAction(gearPath));
runAction(new ParallelAction(Arrays.asList(new Action[] {
new DrivePathAction(gearPath),
new ActuateHopperAction(true),
new SeriesAction(Arrays.asList(new Action[] {
new WaitAction(1), new DeployIntakeAction(true)
}))
})));
runAction(
new ParallelAction(Arrays.asList(new Action[] {
new SetFlywheelRPMAction(2900.0), // spin up flywheel to save time
new ScoreGearAction()
})));
runAction(new CorrectPoseAction(RigidTransform2d.fromTranslation(PathAdapter.getRedGearCorrection())));
runAction(new DrivePathAction(new BoilerGearToHopperRed()));
System.out.println("Shoot Time: " + (Timer.getFPGATimestamp() - start));
runAction(new BeginShootingAction());
runAction(new WaitAction(15));
}
}