mirror of
https://github.com/Team4388/2024AcrossTheRidgebotiverse.git
synced 2026-06-09 08:48:03 -06:00
it not shooting properly (im tweakin)
This commit is contained in:
@@ -32,6 +32,10 @@ public class Intake extends SubsystemBase {
|
||||
|
||||
private Shooter shooter;
|
||||
|
||||
private BooleanSupplier sup = () -> true;
|
||||
private BooleanSupplier dup = () -> false;
|
||||
|
||||
|
||||
|
||||
|
||||
/** Creates a new Intake. */
|
||||
@@ -111,14 +115,11 @@ public class Intake extends SubsystemBase {
|
||||
pidIn();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void handoff() {
|
||||
intakeMotor.set(-IntakeConstants.INTAKE_OUT_SPEED);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void stopIntakeMotors() {
|
||||
intakeMotor.set(0);
|
||||
}
|
||||
@@ -130,6 +131,19 @@ public class Intake extends SubsystemBase {
|
||||
public RelativeEncoder getEncoder() {
|
||||
return pivot.getEncoder();
|
||||
}
|
||||
|
||||
public boolean getForwardLimitSwitchState() {
|
||||
return forwardLimit.isPressed();
|
||||
}
|
||||
|
||||
public boolean getReverseLimitSwitchState() {
|
||||
return reverseLimit.isPressed();
|
||||
}
|
||||
|
||||
public boolean getIntakeLimitSwtichState() {
|
||||
return intakeforwardLimit.isPressed();
|
||||
}
|
||||
|
||||
public void setVoltage(double voltage) {
|
||||
pivot.setVoltage(voltage);
|
||||
}
|
||||
@@ -143,7 +157,7 @@ public class Intake extends SubsystemBase {
|
||||
}
|
||||
|
||||
public void resetPosition1() {
|
||||
if(forwardLimit.isPressed() == true) {
|
||||
if(forwardLimit.isPressed()) {
|
||||
resetPostion();
|
||||
}
|
||||
}
|
||||
@@ -157,7 +171,11 @@ public class Intake extends SubsystemBase {
|
||||
}
|
||||
|
||||
public BooleanSupplier getArmFowardLimitState() {
|
||||
return forwardLimit::isPressed;
|
||||
if(forwardLimit.isPressed()) {
|
||||
return sup;
|
||||
} else {
|
||||
return dup;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
package frc4388.robot.subsystems;
|
||||
|
||||
import edu.wpi.first.wpilibj.AddressableLED;
|
||||
import edu.wpi.first.wpilibj.AddressableLEDBuffer;
|
||||
import edu.wpi.first.wpilibj.motorcontrol.Spark;
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
|
||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||
@@ -20,44 +22,69 @@ import frc4388.utility.LEDPatterns;
|
||||
*/
|
||||
public class LED extends SubsystemBase {
|
||||
|
||||
private LEDPatterns m_currentPattern;
|
||||
private Spark m_LEDController;
|
||||
|
||||
static AddressableLED m_led;
|
||||
static AddressableLEDBuffer m_ledBuffer;
|
||||
static LED m_self;
|
||||
/**
|
||||
* Add your docs here.
|
||||
*/
|
||||
public LED(Spark LEDController){
|
||||
m_LEDController = LEDController;
|
||||
setPattern(LEDConstants.DEFAULT_PATTERN);
|
||||
updateLED();
|
||||
|
||||
public LED(){
|
||||
if(m_self != null)
|
||||
return;
|
||||
m_led = new AddressableLED(9);
|
||||
m_ledBuffer = new AddressableLEDBuffer(130);
|
||||
m_led.setLength(m_ledBuffer.getLength());
|
||||
m_led.setData(m_ledBuffer);
|
||||
m_led.start();
|
||||
System.err.println("In the Beginning, there was Joe.\nAnd he said, 'Let there be LEDs.'\nAnd it was good.");
|
||||
}
|
||||
|
||||
public static LED getInstance() {
|
||||
if(m_self == null)
|
||||
m_self = new LED();
|
||||
return m_self;
|
||||
}
|
||||
@Override
|
||||
public void periodic(){
|
||||
SmartDashboard.putNumber("LED", m_currentPattern.getValue());
|
||||
//gamermode();
|
||||
//SmartDashboard.putNumber("LED", m_currentPattern.getValue());
|
||||
return;
|
||||
}
|
||||
static int firstcolor = 0;
|
||||
static void gamermode() {
|
||||
for(int i = 0; i < m_ledBuffer.getLength(); i++) {
|
||||
final int hue = (firstcolor + (i * 180 / m_ledBuffer.getLength())) % 180;
|
||||
setLEDHSV(i, hue, 255, 128);
|
||||
}
|
||||
firstcolor +=3;
|
||||
firstcolor %= 180;
|
||||
}
|
||||
/**
|
||||
* Add your docs here.
|
||||
*/
|
||||
public static void updateLED (){
|
||||
gamermode();
|
||||
// m_LEDController.set(m_currentPattern.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Add your docs here.
|
||||
*/
|
||||
public void updateLED(){
|
||||
m_LEDController.set(m_currentPattern.getValue());
|
||||
public static void setLEDRGB(int lednum, int r, int g, int b){
|
||||
m_ledBuffer.setRGB(lednum, r, g, b);
|
||||
//m_currentPattern = pattern;
|
||||
// m_LEDController.set(m_currentPattern.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Add your docs here.
|
||||
*/
|
||||
public void setPattern(LEDPatterns pattern){
|
||||
m_currentPattern = pattern;
|
||||
m_LEDController.set(m_currentPattern.getValue());
|
||||
public static void setLEDHSV(int lednum, int hue, int sat, int val){
|
||||
m_ledBuffer.setRGB(lednum, hue, sat, val);
|
||||
//m_currentPattern = pattern;
|
||||
// m_LEDController.set(m_currentPattern.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Add your docs here.
|
||||
* @return
|
||||
*/
|
||||
public LEDPatterns getPattern() {
|
||||
return m_currentPattern;
|
||||
public AddressableLEDBuffer getBuffer() {
|
||||
return m_ledBuffer;
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
package frc4388.robot.subsystems;
|
||||
|
||||
import edu.wpi.first.wpilibj.Encoder;
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
|
||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||
import frc4388.robot.Constants.ShooterConstants;
|
||||
|
||||
@@ -23,8 +25,8 @@ public class Shooter extends SubsystemBase {
|
||||
leftShooter = leftTalonFX;
|
||||
rightShooter = rightTalonFX;
|
||||
|
||||
leftShooter.setNeutralMode(NeutralModeValue.Coast);
|
||||
rightShooter.setNeutralMode(NeutralModeValue.Coast);
|
||||
leftShooter.setNeutralMode(NeutralModeValue.Brake);
|
||||
rightShooter.setNeutralMode(NeutralModeValue.Brake);
|
||||
}
|
||||
|
||||
public void spin() {
|
||||
@@ -40,9 +42,15 @@ public class Shooter extends SubsystemBase {
|
||||
spin(0.d);
|
||||
}
|
||||
|
||||
public void idle() {
|
||||
spin(ShooterConstants.SHOOTER_IDLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void periodic() {
|
||||
// This method will be called once per scheduler run
|
||||
SmartDashboard.putNumber("Left Shooter RPM", leftShooter.getRotorVelocity().getValue());
|
||||
SmartDashboard.putNumber("Right Shooter RPM", rightShooter.getRotorVelocity().getValue());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user