end of pine tree 2

This commit is contained in:
2026-03-08 19:24:00 -04:00
parent 21c0421a88
commit 5e1eadf887
7 changed files with 167 additions and 11 deletions

View File

@@ -1,6 +1,7 @@
package frc.robot.constants;
import com.ctre.phoenix6.configs.AudioConfigs;
import com.ctre.phoenix6.configs.ClosedLoopRampsConfigs;
import com.ctre.phoenix6.configs.CurrentLimitsConfigs;
import com.ctre.phoenix6.configs.FeedbackConfigs;
import com.ctre.phoenix6.configs.MotorOutputConfigs;
@@ -51,10 +52,11 @@ public class ModuleConstants {
public static final double kDriveS = 0;
public static final double kDriveV = kDrivingVelocityFeedForward;
public static final double kDriveA = 0;
public static final double kClosedLoopRampRate = .01;
// TODO Hold over from 2025, adjust?
public static final int kDriveMotorStatorCurrentLimit = 100;
public static final int kDriveMotorSupplyCurrentLimit = 65;
public static final int kDriveMotorStatorCurrentLimit = 90;
public static final int kDriveMotorSupplyCurrentLimit = 55;
// TODO Hold over from 2025, adjust?
public static final InvertedValue kDriveInversionState = InvertedValue.Clockwise_Positive;
@@ -88,6 +90,7 @@ public class ModuleConstants {
public static final MotorOutputConfigs kDriveMotorConfig = new MotorOutputConfigs();
public static final AudioConfigs kAudioConfig = new AudioConfigs();
public static final Slot0Configs kDriveSlot0Config = new Slot0Configs();
public static final ClosedLoopRampsConfigs kDriveClosedLoopRampConfig = new ClosedLoopRampsConfigs();
static {
kDriveFeedConfig.SensorToMechanismRatio = kDrivingMotorReduction;
@@ -109,6 +112,8 @@ public class ModuleConstants {
kDriveSlot0Config.kV = kDriveV;
kDriveSlot0Config.kA = kDriveA;
kDriveClosedLoopRampConfig.withVoltageClosedLoopRampPeriod(kClosedLoopRampRate);
turningConfig
.idleMode(kTurnIdleMode)
.smartCurrentLimit(kTurnMotorCurrentLimit)

View File

@@ -26,10 +26,10 @@ public class Hood extends SubsystemBase {
private SparkClosedLoopController controller;
private Trigger resetTrigger;
private Trigger timerTrigger;
//private Trigger resetTrigger;
//private Trigger timerTrigger;
private Timer resetTimer;
//private Timer resetTimer;
private double currentTargetDegrees;
@@ -47,7 +47,7 @@ public class Hood extends SubsystemBase {
controller = motor.getClosedLoopController();
resetTimer = new Timer();
/*resetTimer = new Timer();
resetTimer.reset();
resetTrigger = new Trigger(() -> (motor.getOutputCurrent() > HoodConstants.kAmpsToTriggerPositionReset));
@@ -61,7 +61,7 @@ public class Hood extends SubsystemBase {
timerTrigger.onTrue(new InstantCommand(() -> {
encoder.setPosition(0);
resetTimer.reset();
}));
}));*/
currentTargetDegrees = HoodConstants.kStartupAngle;
}
@@ -96,7 +96,7 @@ public class Hood extends SubsystemBase {
*
* @return A complete Command structure that performs the specified action
*/
public Command automatedRezero() {
/*public Command automatedRezero() {
return manualSpeed(() -> -1)
.until(timerTrigger)
.andThen(
@@ -112,11 +112,11 @@ public class Hood extends SubsystemBase {
*
* @return A complete Command structure that performs the specified action
*/
public Command automatedRezeroNoTimer() {
/*public Command automatedRezeroNoTimer() {
return manualSpeed(() -> -1)
.until(() -> motor.getOutputCurrent() >= HoodConstants.kAmpsToTriggerPositionReset)
.andThen(new InstantCommand(() -> encoder.setPosition(0)));
}
}*/
public Command manualSpeed(DoubleSupplier speed) {
currentTargetDegrees = 0;

View File

@@ -109,6 +109,7 @@ public class SwerveModule {
drive.getConfigurator().apply(ModuleConstants.kDriveMotorConfig);
drive.getConfigurator().apply(ModuleConstants.kAudioConfig);
drive.getConfigurator().apply(ModuleConstants.kDriveSlot0Config);
drive.getConfigurator().apply(ModuleConstants.kDriveClosedLoopRampConfig);
turning.configure(
ModuleConstants.turningConfig,