diff options
Diffstat (limited to 'src/main/java/frc/robot/subsystems/Intake.java')
-rw-r--r-- | src/main/java/frc/robot/subsystems/Intake.java | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/main/java/frc/robot/subsystems/Intake.java b/src/main/java/frc/robot/subsystems/Intake.java index 85cbbf8..41620bb 100644 --- a/src/main/java/frc/robot/subsystems/Intake.java +++ b/src/main/java/frc/robot/subsystems/Intake.java @@ -1,17 +1,25 @@ package frc.robot.subsystems; import org.littletonrobotics.junction.Logger; + +import com.revrobotics.CANSparkLowLevel.MotorType; import com.revrobotics.CANSparkMax; +import com.revrobotics.RelativeEncoder; import edu.wpi.first.wpilibj2.command.SubsystemBase; import frc.robot.Constants; public class Intake extends SubsystemBase { - private final CANSparkMax m_intakeT = Constants.intakeT; - private final CANSparkMax m_intakeD = Constants.intakeD; + public static final CANSparkMax m_intakeT = new CANSparkMax(Constants.intakeT_ID, MotorType.kBrushless); + public static final CANSparkMax m_intakeD = new CANSparkMax(Constants.intakeD_ID, MotorType.kBrushless); + private final RelativeEncoder m_intakeD_encoder = m_intakeD.getEncoder(); - public Intake() { } + public Intake() + { + m_intakeT.setInverted(true); + m_intakeD.setInverted(true); + } public void atPercentage(double perc) { @@ -23,12 +31,18 @@ public class Intake extends SubsystemBase m_intakeT.set(upPerc); m_intakeD.set(downPerc); } + public void shoot() + { + if (m_intakeD_encoder.getVelocity() > 2000) { + m_intakeT.set(1); + } + m_intakeD.set(1); + } @Override public void periodic() { Logger.recordOutput(getName() + "/speedT", m_intakeT.getEncoder().getVelocity()); Logger.recordOutput(getName() + "/speedD", m_intakeD.getEncoder().getVelocity()); - } } |