mirror of
https://github.com/Team4388/RiseOfRidgebotics2020.git
synced 2026-06-09 00:38:00 -06:00
Added RunExtenderOutIn command and defined extender motor
This commit is contained in:
@@ -7,7 +7,10 @@
|
||||
|
||||
package frc4388.robot.subsystems;
|
||||
|
||||
import com.revrobotics.CANDigitalInput;
|
||||
import com.revrobotics.CANSparkMax;
|
||||
import com.revrobotics.CANDigitalInput.LimitSwitchPolarity;
|
||||
import com.revrobotics.CANSparkMax.IdleMode;
|
||||
import com.revrobotics.CANSparkMaxLowLevel.MotorType;
|
||||
|
||||
import edu.wpi.first.wpilibj.Spark;
|
||||
@@ -16,13 +19,26 @@ import frc4388.robot.Constants.IntakeConstants;
|
||||
|
||||
public class Intake extends SubsystemBase {
|
||||
CANSparkMax m_intakeMotor = new CANSparkMax(IntakeConstants.INTAKE_SPARK_ID, MotorType.kBrushless);
|
||||
|
||||
CANSparkMax m_extenderMotor = new CANSparkMax(IntakeConstants.EXTENDER_SPARK_ID, MotorType.kBrushless);
|
||||
CANDigitalInput m_extenderForwardLimit;
|
||||
CANDigitalInput m_extenderReverseLimit;
|
||||
|
||||
/**
|
||||
* Creates a new Intake.
|
||||
*/
|
||||
public Intake() {
|
||||
|
||||
m_intakeMotor.restoreFactoryDefaults();
|
||||
m_extenderMotor.restoreFactoryDefaults();
|
||||
|
||||
m_intakeMotor.setIdleMode(IdleMode.kCoast);
|
||||
m_extenderMotor.setIdleMode(IdleMode.kBrake);
|
||||
m_intakeMotor.setInverted(false);
|
||||
m_extenderMotor.setInverted(false);
|
||||
|
||||
m_extenderForwardLimit = m_extenderMotor.getForwardLimitSwitch(LimitSwitchPolarity.kNormallyClosed);
|
||||
m_extenderReverseLimit = m_extenderMotor.getReverseLimitSwitch(LimitSwitchPolarity.kNormallyClosed);
|
||||
m_extenderForwardLimit.enableLimitSwitch(false);
|
||||
m_extenderReverseLimit.enableLimitSwitch(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -37,4 +53,12 @@ public class Intake extends SubsystemBase {
|
||||
public void runIntake(double input) {
|
||||
m_intakeMotor.set(input);
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs extender motor
|
||||
* @param input the percent output to run motor at
|
||||
*/
|
||||
public void runExtender(double input) {
|
||||
m_extenderMotor.set(input);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user