|
1 | | -// package org.ghrobotics.frc2024.auto; |
| 1 | +package org.ghrobotics.frc2024.auto; |
2 | 2 |
|
3 | | -// import org.ghrobotics.frc2024.RobotState; |
4 | | -// import org.ghrobotics.frc2024.Superstructure; |
5 | | -// import org.ghrobotics.frc2024.subsystems.Arm; |
6 | | -// import org.ghrobotics.frc2024.subsystems.Drive; |
7 | | -// import org.ghrobotics.frc2024.subsystems.Feeder; |
8 | | -// import org.ghrobotics.frc2024.subsystems.Intake; |
9 | | -// import org.ghrobotics.frc2024.subsystems.Shooter; |
| 3 | +import org.ghrobotics.frc2024.RobotState; |
| 4 | +import org.ghrobotics.frc2024.Superstructure; |
| 5 | +import org.ghrobotics.frc2024.commands.ArmPID; |
| 6 | +import org.ghrobotics.frc2024.subsystems.Arm; |
| 7 | +import org.ghrobotics.frc2024.subsystems.Drive; |
| 8 | +import org.ghrobotics.frc2024.subsystems.Feeder; |
| 9 | +import org.ghrobotics.frc2024.subsystems.Intake; |
| 10 | +import org.ghrobotics.frc2024.subsystems.Shooter; |
10 | 11 |
|
11 | | -// import com.pathplanner.lib.path.PathPlannerPath; |
| 12 | +import com.pathplanner.lib.auto.AutoBuilder; |
| 13 | +import com.pathplanner.lib.path.PathPlannerPath; |
12 | 14 |
|
13 | | -// import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; |
| 15 | +import edu.wpi.first.wpilibj2.command.InstantCommand; |
| 16 | +import edu.wpi.first.wpilibj2.command.ParallelCommandGroup; |
| 17 | +import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; |
| 18 | +import edu.wpi.first.wpilibj2.command.WaitCommand; |
14 | 19 |
|
15 | | -// public class FourNoteAuto extends SequentialCommandGroup{ |
| 20 | +public class FourNoteAuto extends SequentialCommandGroup{ |
16 | 21 |
|
17 | | -// PathPlannerPath middle_middle_intake_path = PathPlannerPath.fromPathFile("middle_middle_intake"); |
18 | | -// PathPlannerPath middle_middle_shoot_path = PathPlannerPath.fromPathFile("middle_middle_shoot"); |
19 | | -// PathPlannerPath middle_right_intake_path = PathPlannerPath.fromPathFile("middle_right_intake"); |
20 | | -// PathPlannerPath middle_left_intake_path = PathPlannerPath.fromPathFile("middle_left_intake"); |
21 | | -// PathPlannerPath left_shoot_path = PathPlannerPath.fromPathFile("left_shoot"); |
| 22 | + PathPlannerPath middle_middle_intake_path = PathPlannerPath.fromPathFile("middle_middle_intake"); |
| 23 | + PathPlannerPath middle_middle_shoot_path = PathPlannerPath.fromPathFile("middle_middle_shoot"); |
| 24 | + PathPlannerPath middle_right_intake_path = PathPlannerPath.fromPathFile("middle_right_intake"); |
| 25 | + PathPlannerPath middle_left_intake_path = PathPlannerPath.fromPathFile("middle_left_intake"); |
| 26 | + PathPlannerPath left_shoot_path = PathPlannerPath.fromPathFile("left_shoot"); |
22 | 27 |
|
23 | | -// // Four Note Auto Path |
24 | | -// PathPlannerPath left_intake_path = PathPlannerPath.fromPathFile("left_intake"); |
25 | | -// PathPlannerPath middle_intake_path = PathPlannerPath.fromPathFile("middle_intake"); |
26 | | -// PathPlannerPath right_intake_path = PathPlannerPath.fromPathFile("right_intake"); |
| 28 | + // Four Note Auto Path |
| 29 | + PathPlannerPath left_intake_path = PathPlannerPath.fromPathFile("left_intake"); |
| 30 | + PathPlannerPath middle_intake_path = PathPlannerPath.fromPathFile("middle_intake"); |
| 31 | + PathPlannerPath right_intake_path = PathPlannerPath.fromPathFile("right_intake"); |
27 | 32 |
|
28 | | -// PathPlannerPath left_one_intake_path = PathPlannerPath.fromPathFile("left_one_intake"); |
| 33 | + PathPlannerPath left_one_intake_path = PathPlannerPath.fromPathFile("left_one_intake"); |
29 | 34 |
|
30 | | -// // Constructor |
31 | | -// public FourNoteAuto(Drive drive, RobotState robot_state, Superstructure superstructure, Arm arm, Intake intake, Shooter shooter, Feeder feeder){ |
32 | | -// addCommands( |
33 | | -// // Part 1 |
34 | | -// new ParallelCommandGroup( |
35 | | -// // Rev shooter, follow path to intake |
36 | | -// new InstantCommand(() -> shooter.setPercent(0.75)), |
37 | | -// AutoBuilder.followPath(left_intake_path), |
38 | | -// new SequentialCommandGroup( |
39 | | -// new ArmPID(arm, 25), |
40 | | -// new WaitCommand(0.5), |
41 | | -// new InstantCommand(() -> intake.setPercent(0.55)), |
42 | | -// new InstantCommand(() -> feeder.setPercent(0.5)), |
43 | | -// new WaitCommand(0.2), |
44 | | -// new ArmPID(arm, 2), |
45 | | -// new InstantCommand(() -> intake.setPercent(0.55)), |
46 | | -// new InstantCommand(() -> feeder.stopMotor()) |
47 | | -// ) |
48 | | -// ), |
49 | | -// // Part 2 |
50 | | -// new ParallelCommandGroup( |
51 | | -// // Rev shooter, follow path to shoot |
52 | | -// // new InstantCommand(() -> shooter_.setPercent(-0.75)), |
53 | | -// AutoBuilder.followPath(middle_intake_path), |
54 | | -// new SequentialCommandGroup( |
55 | | -// new ArmPID(arm_, 29), |
56 | | -// new WaitCommand(0.5), |
57 | | -// new InstantCommand(() -> intake_.setPercent(0.55)), |
58 | | -// new InstantCommand(() -> feeder_.setPercent(0.5)), |
59 | | -// new WaitCommand(0.5), |
60 | | -// new ArmPID(arm_, 2), |
61 | | -// new InstantCommand(() -> intake_.setPercent(0.55)), |
62 | | -// new InstantCommand(() -> feeder_.stopMotor()) |
63 | | -// ) |
64 | | -// ); |
65 | | - |
66 | | - |
67 | | -// ); |
68 | | - |
69 | | -// } |
70 | | -// } |
| 35 | + // Constructor |
| 36 | + public FourNoteAuto(Drive drive, RobotState robot_state, Superstructure superstructure, Arm arm, Intake intake, Shooter shooter, Feeder feeder) { |
| 37 | + addCommands( |
| 38 | + // Part 1 |
| 39 | + new ParallelCommandGroup( |
| 40 | + // Rev shooter, follow path to intake |
| 41 | + new InstantCommand(() -> shooter.setPercent(0.75)), |
| 42 | + AutoBuilder.followPath(left_intake_path), |
| 43 | + new SequentialCommandGroup( |
| 44 | + new ArmPID(arm, 25), |
| 45 | + new WaitCommand(0.5), |
| 46 | + new InstantCommand(() -> intake.setPercent(0.55)), |
| 47 | + new InstantCommand(() -> feeder.setPercent(0.5)), |
| 48 | + new WaitCommand(0.2), |
| 49 | + new ArmPID(arm, 2), |
| 50 | + new InstantCommand(() -> intake.setPercent(0.55)), |
| 51 | + new InstantCommand(() -> feeder.stopMotor()) |
| 52 | + ) |
| 53 | + ), |
| 54 | + // Part 2 |
| 55 | + new ParallelCommandGroup( |
| 56 | + // Rev shooter, follow path to shoot |
| 57 | + // new InstantCommand(() -> shooter_.setPercent(-0.75)), |
| 58 | + AutoBuilder.followPath(middle_intake_path), |
| 59 | + new SequentialCommandGroup( |
| 60 | + new ArmPID(arm, 29), |
| 61 | + new WaitCommand(0.5), |
| 62 | + new InstantCommand(() -> intake.setPercent(0.55)), |
| 63 | + new InstantCommand(() -> feeder.setPercent(0.5)), |
| 64 | + new WaitCommand(0.5), |
| 65 | + new ArmPID(arm, 2), |
| 66 | + new InstantCommand(() -> intake.setPercent(0.55)), |
| 67 | + new InstantCommand(() -> feeder.stopMotor()) |
| 68 | + ) |
| 69 | + ), |
| 70 | + // Part 3 |
| 71 | + new ParallelCommandGroup( |
| 72 | + AutoBuilder.followPath(right_intake_path), |
| 73 | + new SequentialCommandGroup( |
| 74 | + new ArmPID(arm, 29), |
| 75 | + new WaitCommand(0.5), |
| 76 | + new InstantCommand(() -> feeder.setPercent(0.5)), |
| 77 | + new InstantCommand(() -> intake.setPercent(0.55)), |
| 78 | + new WaitCommand(0.5), |
| 79 | + new ArmPID(arm, 2).withTimeout(1.5), |
| 80 | + new InstantCommand(() -> feeder.stopMotor()), |
| 81 | + new InstantCommand(() -> intake.setPercent(0.55)) |
| 82 | + |
| 83 | + ) |
| 84 | + ), |
| 85 | + // Part 4 |
| 86 | + new ArmPID(arm, 32.85), |
| 87 | + new WaitCommand(0.2), |
| 88 | + new InstantCommand(() -> feeder.setPercent(0.75)), |
| 89 | + new InstantCommand(() -> intake.setPercent(0.5)), |
| 90 | + new WaitCommand(1.0), |
| 91 | + new ArmPID(arm, 2) |
| 92 | + ); |
| 93 | + } |
| 94 | +} |
0 commit comments