From afec09b08cecea78176b3a0ecfcf8a82461acdd5 Mon Sep 17 00:00:00 2001 From: ItsGetWreckt Date: Thu, 16 Jul 2026 23:09:50 -0700 Subject: [PATCH 1/3] FInished week 2 homework --- .../frc/robot/subsystems/ArmSubsystem.java | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/main/java/frc/robot/subsystems/ArmSubsystem.java b/src/main/java/frc/robot/subsystems/ArmSubsystem.java index bc42f7a..b2d3c0b 100644 --- a/src/main/java/frc/robot/subsystems/ArmSubsystem.java +++ b/src/main/java/frc/robot/subsystems/ArmSubsystem.java @@ -5,15 +5,26 @@ package frc.robot.subsystems; import edu.wpi.first.wpilibj2.command.SubsystemBase; +import frc.robot.Constants; + +import com.ctre.phoenix6.controls.DutyCycleOut; +import com.ctre.phoenix6.controls.TorqueCurrentFOC; +import com.ctre.phoenix6.controls.VoltageOut; import com.ctre.phoenix6.hardware.TalonFX; public class ArmSubsystem extends SubsystemBase { private TalonFX armMotor, rollerMotor; + private DutyCycleOut m_dutyCycleRequest; + private VoltageOut m_voltageRequest; + private TorqueCurrentFOC m_torqueRequest; public ArmSubsystem() { - + armMotor = new TalonFX(Constants.Arm.ARM_MOTOR_ID); + rollerMotor = new TalonFX(Constants.Arm.ROLLER_MOTOR_ID); + m_dutyCycleRequest = new DutyCycleOut(0.0); + m_voltageRequest = new VoltageOut(0.0); + m_torqueRequest = new TorqueCurrentFOC(0.0); } - @Override public void periodic() { @@ -24,4 +35,16 @@ public void periodic() { public void simulationPeriodic() { // This method will be called once per scheduler run during simulation } + + public void setRollerDutyCycle(double voltagePercent) { + rollerMotor.setControl(m_dutyCycleRequest.withOutput(voltagePercent)); + } + + public void setRollerVoltage(double voltageAmount) { + rollerMotor.setControl(m_voltageRequest.withOutput(voltageAmount)); + } + + public void setArmTorqueCurrent(double statorCurrent) { + armMotor.setControl(m_torqueRequest.withOutput(statorCurrent)); + } } \ No newline at end of file From d1ace7a6ac5c6a5f22d0a33a0e369dd21294114b Mon Sep 17 00:00:00 2001 From: ItsGetWreckt Date: Thu, 23 Jul 2026 09:32:17 -0700 Subject: [PATCH 2/3] Redo merge --- .../java/frc/robot/subsystems/ArmSubsystem.java | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/src/main/java/frc/robot/subsystems/ArmSubsystem.java b/src/main/java/frc/robot/subsystems/ArmSubsystem.java index e897329..4e8207e 100644 --- a/src/main/java/frc/robot/subsystems/ArmSubsystem.java +++ b/src/main/java/frc/robot/subsystems/ArmSubsystem.java @@ -27,10 +27,6 @@ public class ArmSubsystem extends SubsystemBase { private final TorqueCurrentFOC m_torqueRequest = new TorqueCurrentFOC(0.0); public ArmSubsystem() { - armMotor = new TalonFX(Constants.Arm.ARM_MOTOR_ID); - rollerMotor = new TalonFX(Constants.Arm.ROLLER_MOTOR_ID); - m_dutyCycleRequest = new DutyCycleOut(0.0); - m_voltageRequest = new VoltageOut(0.0); armMotor = new TalonFX(Constants.Arm.ROLLER_MOTOR_ID); rollerMotor = new TalonFX(Constants.Arm.ARM_MOTOR_ID); @@ -80,7 +76,6 @@ public void setRollerVoltage(double voltage) { public void setArmTorqueCurrent(double current) { armMotor.setControl(m_torqueRequest.withOutput(current)); - m_torqueRequest = new TorqueCurrentFOC(0.0); } @Override @@ -92,16 +87,4 @@ public void periodic() { public void simulationPeriodic() { // This method will be called once per scheduler run during simulation } - - public void setRollerDutyCycle(double voltagePercent) { - rollerMotor.setControl(m_dutyCycleRequest.withOutput(voltagePercent)); - } - - public void setRollerVoltage(double voltageAmount) { - rollerMotor.setControl(m_voltageRequest.withOutput(voltageAmount)); - } - - public void setArmTorqueCurrent(double statorCurrent) { - armMotor.setControl(m_torqueRequest.withOutput(statorCurrent)); - } } \ No newline at end of file From 426f84073bde1b4caf5a0a31eaac22553bbe9407 Mon Sep 17 00:00:00 2001 From: ItsGetWreckt Date: Thu, 23 Jul 2026 09:34:04 -0700 Subject: [PATCH 3/3] undo everything because i did it wrong --- .../frc/robot/subsystems/ArmSubsystem.java | 84 +++++-------------- 1 file changed, 22 insertions(+), 62 deletions(-) diff --git a/src/main/java/frc/robot/subsystems/ArmSubsystem.java b/src/main/java/frc/robot/subsystems/ArmSubsystem.java index 4e8207e..b2d3c0b 100644 --- a/src/main/java/frc/robot/subsystems/ArmSubsystem.java +++ b/src/main/java/frc/robot/subsystems/ArmSubsystem.java @@ -4,78 +4,26 @@ package frc.robot.subsystems; -import edu.wpi.first.units.measure.Current; import edu.wpi.first.wpilibj2.command.SubsystemBase; import frc.robot.Constants; -import com.ctre.phoenix6.hardware.TalonFX; -import com.ctre.phoenix6.signals.InvertedValue; -import com.ctre.phoenix6.signals.NeutralModeValue; -import com.ctre.phoenix6.configs.CurrentLimitsConfigs; -import com.ctre.phoenix6.configs.MotorOutputConfigs; -import com.ctre.phoenix6.configs.TalonFXConfiguration; -import com.ctre.phoenix6.configs.TalonFXConfigurator; import com.ctre.phoenix6.controls.DutyCycleOut; -import com.ctre.phoenix6.controls.VoltageOut; import com.ctre.phoenix6.controls.TorqueCurrentFOC; +import com.ctre.phoenix6.controls.VoltageOut; +import com.ctre.phoenix6.hardware.TalonFX; public class ArmSubsystem extends SubsystemBase { private TalonFX armMotor, rollerMotor; - - private final DutyCycleOut m_dutyCycleRequest = new DutyCycleOut(0.0); - private final VoltageOut m_voltageRequest = new VoltageOut(0.0); - private final TorqueCurrentFOC m_torqueRequest = new TorqueCurrentFOC(0.0); + private DutyCycleOut m_dutyCycleRequest; + private VoltageOut m_voltageRequest; + private TorqueCurrentFOC m_torqueRequest; public ArmSubsystem() { - armMotor = new TalonFX(Constants.Arm.ROLLER_MOTOR_ID); - rollerMotor = new TalonFX(Constants.Arm.ARM_MOTOR_ID); - - CurrentLimitsConfigs rollerClc = new CurrentLimitsConfigs() - .withStatorCurrentLimit(50) - .withStatorCurrentLimitEnable(false) - .withSupplyCurrentLimit(30) - .withSupplyCurrentLimitEnable(false); - - CurrentLimitsConfigs armClc = new CurrentLimitsConfigs() - .withStatorCurrentLimit(100) - .withStatorCurrentLimitEnable(true) - .withSupplyCurrentLimit(50) - .withSupplyCurrentLimitEnable(true); - - MotorOutputConfigs rollerMotorOutputConfigs = new MotorOutputConfigs() - .withInverted(InvertedValue.CounterClockwise_Positive) - .withNeutralMode(NeutralModeValue.Brake); - - MotorOutputConfigs armMotorOutputConfigs = new MotorOutputConfigs() - .withInverted(InvertedValue.CounterClockwise_Positive) - .withNeutralMode(NeutralModeValue.Brake); - - TalonFXConfiguration rollerConfig = new TalonFXConfiguration() - .withCurrentLimits(rollerClc) - .withMotorOutput(rollerMotorOutputConfigs); - - TalonFXConfiguration armConfig = new TalonFXConfiguration() - .withCurrentLimits(rollerClc) - .withMotorOutput(rollerMotorOutputConfigs); - - TalonFXConfigurator rollerConfigurator = rollerMotor.getConfigurator(); - TalonFXConfigurator armConfigurator = armMotor.getConfigurator(); - - rollerConfigurator.apply(rollerConfig); - armConfigurator.apply(armConfig); - - } - - public void setRollerDutyCycle(double voltage) { - rollerMotor.setControl(m_voltageRequest.withOutput(voltage)); - } - - public void setRollerVoltage(double voltage) { - rollerMotor.setControl(m_dutyCycleRequest.withOutput(voltage)); - } - - public void setArmTorqueCurrent(double current) { - armMotor.setControl(m_torqueRequest.withOutput(current)); + armMotor = new TalonFX(Constants.Arm.ARM_MOTOR_ID); + rollerMotor = new TalonFX(Constants.Arm.ROLLER_MOTOR_ID); + m_dutyCycleRequest = new DutyCycleOut(0.0); + m_voltageRequest = new VoltageOut(0.0); + m_torqueRequest = new TorqueCurrentFOC(0.0); } @Override @@ -87,4 +35,16 @@ public void periodic() { public void simulationPeriodic() { // This method will be called once per scheduler run during simulation } + + public void setRollerDutyCycle(double voltagePercent) { + rollerMotor.setControl(m_dutyCycleRequest.withOutput(voltagePercent)); + } + + public void setRollerVoltage(double voltageAmount) { + rollerMotor.setControl(m_voltageRequest.withOutput(voltageAmount)); + } + + public void setArmTorqueCurrent(double statorCurrent) { + armMotor.setControl(m_torqueRequest.withOutput(statorCurrent)); + } } \ No newline at end of file