|
| 1 | +// Copyright (c) FIRST and other WPILib contributors. |
| 2 | +// Open Source Software; you can modify and/or share it under the terms of |
| 3 | +// the WPILib BSD license file in the root directory of this project. |
| 4 | + |
1 | 5 | package frc.robot.auto.groups;
|
2 | 6 |
|
3 |
| -public class NewFiveBallAuto { |
4 |
| - |
| 7 | +import edu.wpi.first.math.geometry.Pose2d; |
| 8 | +import edu.wpi.first.math.geometry.Rotation2d; |
| 9 | +import edu.wpi.first.math.geometry.Translation2d; |
| 10 | +import edu.wpi.first.wpilibj2.command.ParallelDeadlineGroup; |
| 11 | +import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; |
| 12 | +import edu.wpi.first.wpilibj2.command.WaitCommand; |
| 13 | +import frc.lib.HelixJoysticks; |
| 14 | +import frc.paths.NewAutoPartFour; |
| 15 | +import frc.paths.NewAutoPartOne; |
| 16 | +import frc.paths.NewAutoPartThree; |
| 17 | +import frc.paths.NewAutoPartTwo; |
| 18 | +import frc.robot.Robot; |
| 19 | +import frc.robot.drive.Drivetrain; |
| 20 | +import frc.robot.drive.commands.ResetOdometry; |
| 21 | +import frc.robot.drive.commands.TrajectoryFollower; |
| 22 | +import frc.robot.drive.commands.TurnToAngle; |
| 23 | +import frc.robot.intake.Intake; |
| 24 | +import frc.robot.intake.commands.FastIntake; |
| 25 | +import frc.robot.intake.commands.RetractIntake; |
| 26 | +import frc.robot.shooter.Shooter; |
| 27 | +import frc.robot.shooter.commands.FlywheelController; |
| 28 | +import frc.robot.shooter.commands.PullTrigger; |
| 29 | +import frc.robot.shooter.commands.ResetEncoder; |
| 30 | +import frc.robot.shooter.commands.StopShooter; |
| 31 | +import frc.robot.shooter.commands.StopTrigger; |
| 32 | +import frc.robot.status.actions.ImageAction; |
| 33 | +import frc.robot.status.commands.ActionCommand; |
| 34 | +import frc.robot.vision.Limelight; |
| 35 | + |
| 36 | +// NOTE: Consider using this command inline, rather than writing a subclass. For more |
| 37 | +// information, see: |
| 38 | +// https://docs.wpilib.org/en/stable/docs/software/commandbased/convenience-features.html |
| 39 | +public class NewFiveBallAuto extends SequentialCommandGroup { |
| 40 | + /** Creates a new NewAuto. */ |
| 41 | + public NewFiveBallAuto(Drivetrain drive, Shooter shooter, Intake intake, Limelight limelight, HelixJoysticks joysticks) { |
| 42 | + addCommands( |
| 43 | + new ResetOdometry(drive, new Pose2d(new Translation2d(0,0), new Rotation2d(-2.35))), |
| 44 | + new ResetEncoder(shooter), |
| 45 | + new ParallelDeadlineGroup( |
| 46 | + new WaitCommand(2.9), |
| 47 | + // new ActionCommand(new ImageAction(Robot.fiveBallAutoImage, 0.02, ImageAction.FOREVER).brightness(0.7).oscillate()), |
| 48 | + new TrajectoryFollower(drive, new NewAutoPartOne()), |
| 49 | + new FastIntake(intake), |
| 50 | + new SequentialCommandGroup( |
| 51 | + new WaitCommand(1.25), |
| 52 | + new PullTrigger(shooter) |
| 53 | + ), |
| 54 | + new FlywheelController(shooter, 1980, 72)), |
| 55 | + new ParallelDeadlineGroup( |
| 56 | + new TrajectoryFollower(drive, new NewAutoPartTwo()), |
| 57 | + new StopTrigger(shooter), |
| 58 | + new StopShooter(shooter) |
| 59 | + ), |
| 60 | + new WaitCommand(0.35), |
| 61 | + new ParallelDeadlineGroup( |
| 62 | + new WaitCommand(4.3), |
| 63 | + new SequentialCommandGroup( |
| 64 | + new WaitCommand(1.75), |
| 65 | + new FlywheelController(shooter, 1795, 76.0) |
| 66 | + ), |
| 67 | + new SequentialCommandGroup( |
| 68 | + new TrajectoryFollower(drive, new NewAutoPartThree()), |
| 69 | + new TurnToAngle(drive, limelight, joysticks) |
| 70 | + ), |
| 71 | + new SequentialCommandGroup( |
| 72 | + new WaitCommand(3.2), |
| 73 | + new PullTrigger(shooter) |
| 74 | + ), |
| 75 | + new SequentialCommandGroup( |
| 76 | + new WaitCommand(0.25), |
| 77 | + new RetractIntake(intake) |
| 78 | + ) |
| 79 | + ), |
| 80 | + new ParallelDeadlineGroup( |
| 81 | + new WaitCommand(3.0), |
| 82 | + new TrajectoryFollower(drive, new NewAutoPartFour()), |
| 83 | + new FlywheelController(shooter, 1785, 75.5), |
| 84 | + new SequentialCommandGroup( |
| 85 | + new StopTrigger(shooter), |
| 86 | + new WaitCommand(1.25), |
| 87 | + new PullTrigger(shooter) |
| 88 | + ), |
| 89 | + new FastIntake(intake) |
| 90 | + ), |
| 91 | + new ParallelDeadlineGroup( |
| 92 | + new WaitCommand(1.0), |
| 93 | + new StopTrigger(shooter), |
| 94 | + new StopShooter(shooter), |
| 95 | + new RetractIntake(intake)) |
| 96 | + ); |
| 97 | + } |
5 | 98 | }
|
0 commit comments