From f4e184a2f842102a64c6ef2f5b3daa35a9835658 Mon Sep 17 00:00:00 2001 From: Aarav Shah Date: Wed, 11 Mar 2020 16:35:46 -0600 Subject: [PATCH] Added storage command Co-Authored-By: kyrarivera --- .../java/frc4388/robot/RobotContainer.java | 1 - .../robot/commands/intake/RunIntake.java | 46 +++++++++++++++++++ .../robot/commands/storage/RunStorage.java | 46 +++++++++++++++++++ 3 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 src/main/java/frc4388/robot/commands/intake/RunIntake.java create mode 100644 src/main/java/frc4388/robot/commands/storage/RunStorage.java diff --git a/src/main/java/frc4388/robot/RobotContainer.java b/src/main/java/frc4388/robot/RobotContainer.java index 3ff294f..d3c5d05 100644 --- a/src/main/java/frc4388/robot/RobotContainer.java +++ b/src/main/java/frc4388/robot/RobotContainer.java @@ -49,7 +49,6 @@ import frc4388.robot.commands.drive.DriveWithJoystick; import frc4388.robot.commands.drive.TurnDegrees; import frc4388.robot.commands.intake.RunIntakeWithTriggers; import frc4388.robot.commands.shooter.CalibrateShooter; -import frc4388.robot.commands.shooter.ShootFireGroup; import frc4388.robot.commands.shooter.TrackTarget; import frc4388.robot.commands.shooter.TrimShooter; import frc4388.robot.commands.shooter.ShootPrepGroup; diff --git a/src/main/java/frc4388/robot/commands/intake/RunIntake.java b/src/main/java/frc4388/robot/commands/intake/RunIntake.java new file mode 100644 index 0000000..c88b1f7 --- /dev/null +++ b/src/main/java/frc4388/robot/commands/intake/RunIntake.java @@ -0,0 +1,46 @@ +/*----------------------------------------------------------------------------*/ +/* 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 frc4388.robot.commands.intake; + +import edu.wpi.first.wpilibj2.command.CommandBase; +import frc4388.robot.Constants.IntakeConstants; +import frc4388.robot.subsystems.Intake; + +public class RunIntake extends CommandBase { + Intake m_intake; + /** + * Creates a new RunIntake. + */ + public RunIntake(Intake subsystem) { + // Use addRequirements() here to declare subsystem dependencies. + m_intake = subsystem; + addRequirements(m_intake); + } + + // Called when the command is initially scheduled. + @Override + public void initialize() { + } + + // Called every time the scheduler runs while the command is scheduled. + @Override + public void execute() { + m_intake.runIntake(IntakeConstants.INTAKE_SPEED); + } + + // Called once the command ends or is interrupted. + @Override + public void end(boolean interrupted) { + } + + // Returns true when the command should end. + @Override + public boolean isFinished() { + return false; + } +} diff --git a/src/main/java/frc4388/robot/commands/storage/RunStorage.java b/src/main/java/frc4388/robot/commands/storage/RunStorage.java new file mode 100644 index 0000000..3a259d1 --- /dev/null +++ b/src/main/java/frc4388/robot/commands/storage/RunStorage.java @@ -0,0 +1,46 @@ +/*----------------------------------------------------------------------------*/ +/* 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 frc4388.robot.commands.storage; + +import edu.wpi.first.wpilibj2.command.CommandBase; +import frc4388.robot.Constants.StorageConstants; +import frc4388.robot.subsystems.Storage; + +public class RunStorage extends CommandBase { + Storage m_storage; + /** + * Creates a new RunStorage. + */ + public RunStorage(Storage subsystem) { + // Use addRequirements() here to declare subsystem dependencies. + m_storage = subsystem; + addRequirements(m_storage); + } + + // Called when the command is initially scheduled. + @Override + public void initialize() { + } + + // Called every time the scheduler runs while the command is scheduled. + @Override + public void execute() { + m_storage.runStorage(StorageConstants.STORAGE_SPEED); + } + + // Called once the command ends or is interrupted. + @Override + public void end(boolean interrupted) { + } + + // Returns true when the command should end. + @Override + public boolean isFinished() { + return false; + } +}