Changed code for robot

This commit is contained in:
Mehooliu
2026-03-02 16:25:15 -05:00
parent 69279812f3
commit 1b84701184
10 changed files with 407 additions and 271 deletions

View File

@@ -36,11 +36,12 @@ public class IntakeSubsystem extends SubsystemBase {
.i(Constants.IntakeConstants.IntakeRotatorPID.INTAKE_ROTATOR_I)
.d(Constants.IntakeConstants.IntakeRotatorPID.INTAKE_ROTATOR_D)
.p(.06, ClosedLoopSlot.kSlot1)
.p(.13, ClosedLoopSlot.kSlot1)
.i(0, ClosedLoopSlot.kSlot1)
.d(0, ClosedLoopSlot.kSlot1);
intakeRotatorMotor.configure(intakeRotatorConfig, com.revrobotics.ResetMode.kNoResetSafeParameters,
com.revrobotics.PersistMode.kNoPersistParameters);
intakeRotatorConfig.smartCurrentLimit(40);
intakeRotatorPIDController = intakeRotatorMotor.getClosedLoopController();
intakeWheelsMotorConfig.closedLoop.pid(Constants.IntakeConstants.INTAKE_MOTOR_P,
@@ -51,6 +52,11 @@ public class IntakeSubsystem extends SubsystemBase {
intakeWheelsMotorPIDController = intakeWheelsMotor.getClosedLoopController();
}
public static void resetIntakeRotationEncoder()
{
intakeRotatorMotor.getEncoder().setPosition(Constants.IntakeConstants.INTAKE_RETRACT_ENCODER_VALUE);
}
public void startIntakeMotor() {
intakeWheelsMotorPIDController.setSetpoint(Constants.IntakeConstants.INTAKE_WHEELS_MOTOR_RPM, ControlType.kVelocity);
}
@@ -93,12 +99,12 @@ public class IntakeSubsystem extends SubsystemBase {
public void assistFuelIntake() {
intakeRotatorPIDController.setSetpoint(Constants.IntakeConstants.INTAKE_MIDDLE_ENCODER_VALUE,
ControlType.kPosition);
ControlType.kPosition, ClosedLoopSlot.kSlot1);
}
public Command assistFuelIntakeCommand() {
return runOnce(() -> assistFuelIntake()).andThen(new WaitCommand(2)).andThen(deployintakeCommand())
.andThen(new WaitCommand(2));
return runOnce(() -> assistFuelIntake()).andThen(new WaitCommand(1.5)).andThen(deployintakeCommand())
.andThen(new WaitCommand(1.5));
}
@Override