mirror of
https://github.com/Team4388/2023WayOfTheRobot.git
synced 2026-06-09 00:37:59 -06:00
Merge branch 'master' into auto-placement
This commit is contained in:
@@ -1,21 +1,46 @@
|
||||
package frc4388.robot.subsystems;
|
||||
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import com.revrobotics.CANSparkMax;
|
||||
|
||||
import edu.wpi.first.wpilibj.PWM;
|
||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||
|
||||
public class Claw extends SubsystemBase {
|
||||
private PWM m_clawMotor;
|
||||
private boolean m_open = false;
|
||||
|
||||
private final PWM m_leftMotor;
|
||||
private final PWM m_rightMotor;
|
||||
private final CANSparkMax m_spinnyspin;
|
||||
|
||||
private boolean m_open = false;
|
||||
|
||||
// Opens claw
|
||||
public Claw(PWM m_clawMotor) {
|
||||
this.m_clawMotor = m_clawMotor;
|
||||
setClaw(true);
|
||||
public Claw(PWM leftMotor, PWM rightMotor, CANSparkMax spinnyspin) {
|
||||
m_leftMotor = leftMotor;
|
||||
m_rightMotor = rightMotor;
|
||||
m_spinnyspin = spinnyspin;
|
||||
|
||||
setClaw(true);
|
||||
}
|
||||
|
||||
public void setClaw(boolean open) {
|
||||
// Open claw
|
||||
m_open = open;
|
||||
m_clawMotor.setRaw(m_open ? 1000 : 2000);
|
||||
m_leftMotor.setRaw(m_open ? 1000 : 2000);
|
||||
m_rightMotor.setRaw(m_open ? 2000 : 1000);
|
||||
|
||||
if (!m_open) {
|
||||
m_spinnyspin.set(-0.2);
|
||||
|
||||
new Timer().schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
nospinnyspin();
|
||||
}
|
||||
}, 750);
|
||||
}
|
||||
}
|
||||
|
||||
public void toggle() {
|
||||
@@ -26,4 +51,11 @@ public class Claw extends SubsystemBase {
|
||||
return m_open;
|
||||
}
|
||||
|
||||
public void yesspinnyspin() {
|
||||
m_spinnyspin.set(0.2);
|
||||
}
|
||||
|
||||
public void nospinnyspin() {
|
||||
m_spinnyspin.set(0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user