Skip to content

Commit

Permalink
make intake changes
Browse files Browse the repository at this point in the history
  • Loading branch information
KPatel008 committed Mar 27, 2024
1 parent 87e553c commit 1cb4870
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/arm/ArmIOTalonFX.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public ArmIOTalonFX() {
wristLeftMotorConfig.ClosedLoopGeneral.ContinuousWrap = true;
wristLeftMotorConfig.Feedback.SensorToMechanismRatio = ArmConstants.kWristReduction;
wristLeftMotorConfig.Slot0.GravityType = GravityTypeValue.Arm_Cosine;
wristLeftMotorConfig.Slot0.kP = 30.612;
wristLeftMotorConfig.Slot0.kP = 22.742;
wristLeftMotorConfig.Slot0.kD = 5.5071;
wristLeftMotorConfig.Slot0.kS = 0.57211;
wristLeftMotorConfig.Slot0.kV = 2.5239;
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/frc/robot/intake/Intake.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public void periodic() {
public Command idle() {
return this.run(
() -> {
m_io.setTopRollerVoltage(0.0);
m_io.setBottomRollerVoltage(0.0);
m_io.setFrontRollersVoltage(0.0);
m_io.setBackRollersVoltage(0.0);
m_io.setCenteringMotorsVoltage(0.0);
})
.withName("Idle (Intake)");
Expand All @@ -56,8 +56,8 @@ public Command stop() {
public Command spit() {
return this.run(
() -> {
m_io.setTopRollerVoltage(-9.6);
m_io.setBottomRollerVoltage(-9.6);
m_io.setFrontRollersVoltage(-9.6);
m_io.setBackRollersVoltage(-9.6);
m_io.setCenteringMotorsVoltage(-10.2);
})
.withName("Spit (Intake)");
Expand All @@ -66,8 +66,8 @@ public Command spit() {
public Command intake() {
return this.run(
() -> {
m_io.setTopRollerVoltage(9.6);
m_io.setBottomRollerVoltage(9.6);
m_io.setFrontRollersVoltage(9.6);
m_io.setBackRollersVoltage(9.6);
m_io.setCenteringMotorsVoltage(10.2);
})
.alongWith(
Expand Down Expand Up @@ -112,8 +112,8 @@ public void resetSimIntookPieces() {
public Command feed() {
return this.run(
() -> {
m_io.setTopRollerVoltage(4.8);
m_io.setBottomRollerVoltage(4.8);
m_io.setFrontRollersVoltage(4.8);
m_io.setBackRollersVoltage(4.8);
m_io.setCenteringMotorsVoltage(6.0);
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/frc/robot/intake/IntakeIO.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ public class IntakeIOInputs {

public default void updateInputs(IntakeIOInputs inputs) {}

public default void setTopRollerVoltage(double volts) {}
public default void setFrontRollersVoltage(double volts) {}

public default void setBottomRollerVoltage(double volts) {}
public default void setBackRollersVoltage(double volts) {}

public default void setCenteringMotorsVoltage(double volts) {}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/frc/robot/intake/IntakeIOSim.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ public void updateInputs(IntakeIOInputs inputs) {
}

@Override
public void setTopRollerVoltage(double voltage) {
public void setFrontRollersVoltage(double voltage) {
m_topRollerAppliedVolts = MathUtil.clamp(voltage, -12.0, 12.0);
}

@Override
public void setBottomRollerVoltage(double voltage) {
public void setBackRollersVoltage(double voltage) {
m_bottomRollerAppliedVolts = MathUtil.clamp(voltage, -12.0, 12.0);
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/frc/robot/intake/IntakeIOSparkMAX.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ public void updateInputs(IntakeIOInputs inputs) {
}

@Override
public void setTopRollerVoltage(double volts) {
public void setFrontRollersVoltage(double volts) {
topRollerMotor.setVoltage(volts);
}

@Override
public void setBottomRollerVoltage(double volts) {
public void setBackRollersVoltage(double volts) {
bottomRollerMotor.setVoltage(volts);
}

Expand Down
40 changes: 20 additions & 20 deletions src/main/java/frc/robot/intake/IntakeIOTalonFX.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

public class IntakeIOTalonFX implements IntakeIO {

private final TalonFX m_topRollerMotor, m_bottomRollerMotor;
private final TalonFX m_frontRollersMotor, m_backRollersMotor;
private final BaseTalon m_centeringMotors;

private final StatusSignal<Double> m_topRollerVelocitySignal,
Expand All @@ -24,28 +24,28 @@ public class IntakeIOTalonFX implements IntakeIO {
m_bottomRollerCurrentSignal;

public IntakeIOTalonFX() {
m_topRollerMotor = new TalonFX(22, Constants.kSuperstructureCanBus);
m_bottomRollerMotor = new TalonFX(23, Constants.kSuperstructureCanBus);
m_frontRollersMotor = new TalonFX(22, Constants.kSuperstructureCanBus);
m_backRollersMotor = new TalonFX(23, Constants.kSuperstructureCanBus);
m_centeringMotors = new BaseTalon(24, "Talon SRX", "rio");
m_topRollerMotor.getConfigurator().apply(new TalonFXConfiguration());
m_bottomRollerMotor.getConfigurator().apply(new TalonFXConfiguration());
m_frontRollersMotor.getConfigurator().apply(new TalonFXConfiguration());
m_backRollersMotor.getConfigurator().apply(new TalonFXConfiguration());
final CurrentLimitsConfigs currentLimits =
new CurrentLimitsConfigs().withSupplyCurrentLimit(40.0).withSupplyCurrentLimitEnable(true);
m_topRollerMotor.getConfigurator().apply(currentLimits);
m_bottomRollerMotor.getConfigurator().apply(currentLimits);
m_frontRollersMotor.getConfigurator().apply(currentLimits);
m_backRollersMotor.getConfigurator().apply(currentLimits);

m_centeringMotors.configSupplyCurrentLimit(
new SupplyCurrentLimitConfiguration(true, 40.0, 0.0, 1.0), 1000);
m_centeringMotors.configVoltageCompSaturation(12.0);
m_centeringMotors.enableVoltageCompensation(true);

m_topRollerVelocitySignal = m_topRollerMotor.getVelocity();
m_topRollerAppliedVoltageSignal = m_topRollerMotor.getMotorVoltage();
m_topRollerCurrentSignal = m_topRollerMotor.getSupplyCurrent();
m_topRollerVelocitySignal = m_frontRollersMotor.getVelocity();
m_topRollerAppliedVoltageSignal = m_frontRollersMotor.getMotorVoltage();
m_topRollerCurrentSignal = m_frontRollersMotor.getSupplyCurrent();

m_bottomRollerVelocitySignal = m_bottomRollerMotor.getVelocity();
m_bottomRollerAppliedVoltageSignal = m_bottomRollerMotor.getMotorVoltage();
m_bottomRollerCurrentSignal = m_bottomRollerMotor.getSupplyCurrent();
m_bottomRollerVelocitySignal = m_backRollersMotor.getVelocity();
m_bottomRollerAppliedVoltageSignal = m_backRollersMotor.getMotorVoltage();
m_bottomRollerCurrentSignal = m_backRollersMotor.getSupplyCurrent();

BaseStatusSignal.setUpdateFrequencyForAll(
50.0,
Expand All @@ -55,7 +55,7 @@ public IntakeIOTalonFX() {
m_bottomRollerVelocitySignal,
m_bottomRollerAppliedVoltageSignal,
m_bottomRollerCurrentSignal);
ParentDevice.optimizeBusUtilizationForAll(m_topRollerMotor, m_bottomRollerMotor);
ParentDevice.optimizeBusUtilizationForAll(m_frontRollersMotor, m_backRollersMotor);
}

@Override
Expand Down Expand Up @@ -83,13 +83,13 @@ public void updateInputs(IntakeIOInputs inputs) {
}

@Override
public void setTopRollerVoltage(double volts) {
m_topRollerMotor.setVoltage(volts);
public void setFrontRollersVoltage(double volts) {
m_frontRollersMotor.setVoltage(volts);
}

@Override
public void setBottomRollerVoltage(double volts) {
m_bottomRollerMotor.setVoltage(volts);
public void setBackRollersVoltage(double volts) {
m_backRollersMotor.setVoltage(volts);
}

@Override
Expand All @@ -99,8 +99,8 @@ public void setCenteringMotorsVoltage(double volts) {

@Override
public void stopRollers() {
m_topRollerMotor.stopMotor();
m_bottomRollerMotor.stopMotor();
m_frontRollersMotor.stopMotor();
m_backRollersMotor.stopMotor();
m_centeringMotors.set(ControlMode.PercentOutput, 0.0);
}
}
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/lights/Lights.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

public class Lights extends SubsystemBase {

private final int kLedCount = 8;
private final int kLedCount = Constants.kIsViper ? 8 : 32;
private final CANdle m_ledController;

public Lights() {
Expand Down

0 comments on commit 1cb4870

Please sign in to comment.