2022-01-12 06:00:44 +05:30
|
|
|
// 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;
|
|
|
|
|
|
2022-02-03 19:51:12 -07:00
|
|
|
//Imported Limit switch ONLY
|
|
|
|
|
import com.revrobotics.SparkMaxLimitSwitch;
|
|
|
|
|
|
2022-01-21 17:09:57 -07:00
|
|
|
import com.ctre.phoenix.motorcontrol.NeutralMode;
|
2022-01-13 18:06:38 -07:00
|
|
|
import com.ctre.phoenix.motorcontrol.can.WPI_TalonFX;
|
|
|
|
|
|
2022-03-12 11:36:10 -07:00
|
|
|
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
|
2022-01-12 06:00:44 +05:30
|
|
|
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
2022-01-21 17:09:57 -07:00
|
|
|
import com.revrobotics.CANSparkMax;
|
2022-01-12 06:00:44 +05:30
|
|
|
|
|
|
|
|
public class Intake extends SubsystemBase {
|
|
|
|
|
|
2022-01-13 18:06:38 -07:00
|
|
|
private WPI_TalonFX m_intakeMotor;
|
2022-03-05 22:57:55 -07:00
|
|
|
private Serializer m_serializer;
|
2022-01-12 06:00:44 +05:30
|
|
|
|
2022-01-13 18:06:38 -07:00
|
|
|
/** Creates a new Intake. */
|
2022-03-12 15:05:32 -07:00
|
|
|
public Intake(WPI_TalonFX intakeMotor, Serializer serializer) {
|
2022-01-20 18:08:31 -07:00
|
|
|
m_intakeMotor = intakeMotor;
|
2022-03-05 22:57:55 -07:00
|
|
|
m_serializer = serializer;
|
2022-01-12 06:00:44 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void periodic() {
|
|
|
|
|
// This method will be called once per scheduler run
|
|
|
|
|
}
|
2022-03-05 11:04:40 -07:00
|
|
|
/**
|
2022-03-12 14:59:21 -07:00
|
|
|
* Runs The Intake With Triggers as input
|
|
|
|
|
* @param leftTrigger Left Trigger to Run Inward
|
|
|
|
|
* @param rightTrigger Right Trigger to Run Outward
|
2022-03-05 11:04:40 -07:00
|
|
|
*/
|
2022-01-13 05:41:53 +05:30
|
|
|
public void runWithTriggers(double leftTrigger, double rightTrigger) {
|
2022-03-12 22:19:42 -07:00
|
|
|
m_intakeMotor.set((rightTrigger - leftTrigger) * 0.4);
|
2022-03-12 11:36:10 -07:00
|
|
|
SmartDashboard.putNumber("Intake Current Supply", m_intakeMotor.getSupplyCurrent());
|
|
|
|
|
SmartDashboard.putNumber("Intake Current Stator", m_intakeMotor.getStatorCurrent());
|
2022-01-12 06:34:13 +05:30
|
|
|
}
|
2022-03-12 15:05:32 -07:00
|
|
|
|
|
|
|
|
public double getCurrent() {
|
|
|
|
|
return m_intakeMotor.getSupplyCurrent();
|
2022-03-12 11:36:10 -07:00
|
|
|
}
|
2022-01-21 17:09:57 -07:00
|
|
|
}
|