From f37a378f4910973007c9b23cf74eddd378e82781 Mon Sep 17 00:00:00 2001 From: Varun Date: Tue, 10 Mar 2020 17:38:06 -0400 Subject: [PATCH 1/2] Created the Cyclone Auto Path --- .../java/frc/robot/commandgroups/Cyclone.java | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 src/main/java/frc/robot/commandgroups/Cyclone.java diff --git a/src/main/java/frc/robot/commandgroups/Cyclone.java b/src/main/java/frc/robot/commandgroups/Cyclone.java new file mode 100644 index 0000000..986d527 --- /dev/null +++ b/src/main/java/frc/robot/commandgroups/Cyclone.java @@ -0,0 +1,71 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) 2019 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.commandgroups; + +import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; +import frc.robot.commands.*; +import frc.robot.subsystems.Cellevator; +import frc.robot.subsystems.Drivetrain; +import frc.robot.subsystems.Hopper; +import frc.robot.subsystems.Intake; +import frc.robot.subsystems.Launcher; +import edu.wpi.first.wpilibj2.command.ConditionalCommand; + +// NOTE: Consider using this command inline, rather than writing a subclass. For more +// information, see: +// https://docs.wpilib.org/en/latest/docs/software/commandbased/convenience-features.html +public class Cyclone extends SequentialCommandGroup { + public final Drivetrain m_drivetrain; + public final Intake m_intake; + public final Cellevator m_cellevator; + public final Launcher m_launcher; + public final Hopper m_hopper; + + /** + * Creates a new Cyclone. + */ + public Cyclone(Drivetrain drivetrain, Launcher launcher, Intake intake, Hopper hopper, + Cellevator cellevator) { + // Add your commands in the super() call, e.g. + // super(new FooCommand(), new BarCommand()); + super( + new IntakeLower(intake), + new DriveShiftLow(drivetrain), + new VisionAlign(drivetrain).withTimeout(3), + new ConditionalCommand( + new LauncherMode(launcher, intake, hopper, cellevator).withTimeout(8), + new DoNothingAuto(), + () -> drivetrain.isTargetCentered() + ), + new DrivePointTurn(() -> 45, drivetrain).withTimeout(3), + new DriveDistance(192, drivetrain).withTimeout(3), + new IntakeToggle(intake).withTimeout(3), + new ConditionalCommand( + new LauncherMode(launcher, intake, hopper, cellevator).withTimeout(8), + new DoNothingAuto(), + () -> drivetrain.isTargetCentered() + ) + ); + + m_drivetrain = drivetrain; + m_launcher = launcher; + m_intake = intake; + m_hopper = hopper; + m_cellevator = cellevator; + + } + @Override + public void end(boolean interrupted) { + m_drivetrain.shiftHigh(); + m_launcher.stopLauncher(); + m_intake.stopIntake(); + m_hopper.stopHopper(); + m_cellevator.stopCellevator(); + m_cellevator.stopLoader(); + } +} From 27b52f1f425103d79ba8913ae217f777cd651de3 Mon Sep 17 00:00:00 2001 From: Varun Date: Tue, 10 Mar 2020 17:42:53 -0400 Subject: [PATCH 2/2] Fixed timeout --- src/main/java/frc/robot/commandgroups/Cyclone.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/frc/robot/commandgroups/Cyclone.java b/src/main/java/frc/robot/commandgroups/Cyclone.java index 986d527..c9cac53 100644 --- a/src/main/java/frc/robot/commandgroups/Cyclone.java +++ b/src/main/java/frc/robot/commandgroups/Cyclone.java @@ -38,7 +38,7 @@ public Cyclone(Drivetrain drivetrain, Launcher launcher, Intake intake, Hopper h new DriveShiftLow(drivetrain), new VisionAlign(drivetrain).withTimeout(3), new ConditionalCommand( - new LauncherMode(launcher, intake, hopper, cellevator).withTimeout(8), + new LauncherMode(launcher, intake, hopper, cellevator).withTimeout(3), new DoNothingAuto(), () -> drivetrain.isTargetCentered() ), @@ -46,7 +46,7 @@ public Cyclone(Drivetrain drivetrain, Launcher launcher, Intake intake, Hopper h new DriveDistance(192, drivetrain).withTimeout(3), new IntakeToggle(intake).withTimeout(3), new ConditionalCommand( - new LauncherMode(launcher, intake, hopper, cellevator).withTimeout(8), + new LauncherMode(launcher, intake, hopper, cellevator).withTimeout(3), new DoNothingAuto(), () -> drivetrain.isTargetCentered() )