Files
2022NoWayHome/src/main/java/frc4388/robot/subsystems/Storage.java
T
Ryan Manley 78f3b47846 JavaDocs
2022-03-05 11:04:40 -07:00

62 lines
1.7 KiB
Java

// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package frc4388.robot.subsystems;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import com.revrobotics.CANSparkMax;
import com.revrobotics.CANSparkMaxLowLevel.MotorType;
import edu.wpi.first.wpilibj.DigitalInput;
import frc4388.robot.Constants.StorageConstants;
public class Storage extends SubsystemBase {
public CANSparkMax m_storageMotor = new CANSparkMax(StorageConstants.STORAGE_CAN_ID, MotorType.kBrushless);
private DigitalInput m_beamShooter = new DigitalInput(StorageConstants.BEAM_SENSOR_SHOOTER);
private DigitalInput m_beamIntake = new DigitalInput(StorageConstants.BEAM_SENSOR_INTAKE);
/** Creates a new Storage. */
public Storage() {
}
/**
* If The Beam Is Broken, Run Storage
* If Else, Stop Running Storage
*/
public void manageStorage() {
if (m_beamShooter.get()) {
runStorage(1.d);
} else { runStorage(0.d); }
}
/**
* Runs The Storage at a Specifyed Speed
* @param input The Specifyed Speed
*/
public void runStorage(double input) {
m_storageMotor.set(input);
}
/**
* Gets The Beam State On The Shooter
* @return The State Of The Beam on the Shooter
*/
public boolean getBeamShooter(){
return m_beamShooter.get();
}
/**
* Gets The Beam State Of The Intake
* @return The Beam State Of The Intake
*/
public boolean getBeamIntake(){
return m_beamIntake.get();
}
@Override
/**
* Every Robot Tick Manage The Storage
*/
public void periodic() {
manageStorage();
}
}