2022-01-15 14:20:49 -07:00
|
|
|
package frc4388.robot.subsystems;
|
|
|
|
|
|
|
|
|
|
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
2022-03-05 22:57:55 -07:00
|
|
|
import frc4388.robot.Constants.SerializerConstants;
|
2022-01-15 15:21:46 -07:00
|
|
|
import edu.wpi.first.wpilibj.DigitalInput;
|
2022-01-25 17:17:07 -07:00
|
|
|
import com.revrobotics.CANSparkMax;
|
2022-01-15 14:20:49 -07:00
|
|
|
|
|
|
|
|
public class Serializer extends SubsystemBase{
|
2022-01-25 17:17:07 -07:00
|
|
|
private CANSparkMax m_serializerBelt;
|
2022-03-05 15:32:48 -07:00
|
|
|
// private CANSparkMax m_serializerShooterBelt;
|
2022-01-15 15:21:46 -07:00
|
|
|
private DigitalInput m_serializerBeam;
|
2022-01-15 14:20:49 -07:00
|
|
|
private boolean serializerState;
|
|
|
|
|
|
2022-03-05 15:32:48 -07:00
|
|
|
public Serializer(CANSparkMax serializerBelt, /*CANSparkMax serializerShooterBelt,*/ DigitalInput serializerBeam) {
|
2022-01-15 15:21:46 -07:00
|
|
|
m_serializerBelt = serializerBelt;
|
2022-02-26 15:41:54 -07:00
|
|
|
m_serializerBeam = serializerBeam;
|
2022-01-15 15:21:46 -07:00
|
|
|
|
2022-01-25 17:17:07 -07:00
|
|
|
m_serializerBelt.set(0);
|
2022-03-05 15:32:48 -07:00
|
|
|
// m_serializerShooterBelt.set(0);
|
2022-01-25 17:17:07 -07:00
|
|
|
|
2022-01-15 15:21:46 -07:00
|
|
|
}
|
2022-03-05 22:57:55 -07:00
|
|
|
|
|
|
|
|
public void setSerializer(double input){
|
|
|
|
|
m_serializerBelt.set(input);
|
|
|
|
|
}
|
2022-03-05 11:04:40 -07:00
|
|
|
/**
|
|
|
|
|
* Gets The State Of The Beam
|
|
|
|
|
* @return The State Of The Beam
|
|
|
|
|
*/
|
2022-01-15 15:21:46 -07:00
|
|
|
public boolean getBeam() {
|
2022-01-28 17:59:25 -07:00
|
|
|
return m_serializerBeam.get();
|
2022-01-15 15:21:46 -07:00
|
|
|
}
|
2022-03-05 22:57:55 -07:00
|
|
|
|
2022-03-05 11:04:40 -07:00
|
|
|
/**
|
|
|
|
|
* Sets The Serializer State With The Beam
|
|
|
|
|
* @param state Your State Of The Button
|
|
|
|
|
* @param beambroken The State of the Beam Senser
|
|
|
|
|
*/
|
2022-03-05 22:57:55 -07:00
|
|
|
public void setSerializerStateWithBeam() {
|
|
|
|
|
if (m_serializerBeam.get()) setSerializer(0.0);
|
|
|
|
|
else setSerializer(SerializerConstants.SERIALIZER_BELT_SPEED);
|
2022-01-18 18:04:58 -07:00
|
|
|
}
|
2022-01-15 15:21:46 -07:00
|
|
|
|
2022-03-05 11:04:40 -07:00
|
|
|
/**
|
|
|
|
|
* Gets the Serializer State
|
|
|
|
|
* @return The Serializer State
|
|
|
|
|
*/
|
2022-01-15 15:21:46 -07:00
|
|
|
public boolean getSerializerState() {
|
|
|
|
|
return serializerState;
|
|
|
|
|
}
|
2022-03-12 11:36:10 -07:00
|
|
|
public double getCurrent(){
|
|
|
|
|
return m_serializerBelt.getOutputCurrent();
|
|
|
|
|
}
|
2022-01-15 14:20:49 -07:00
|
|
|
}
|