Skip to content

Commit

Permalink
fixed intake
Browse files Browse the repository at this point in the history
  • Loading branch information
txrnqt committed Jan 14, 2025
1 parent c386e83 commit ec3612a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 19 deletions.
35 changes: 20 additions & 15 deletions src/main/java/frc/robot/subsystems/intake/IntakeIOFalcon.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
import com.ctre.phoenix6.hardware.TalonFX;
import com.ctre.phoenix6.signals.InvertedValue;
import com.ctre.phoenix6.signals.NeutralModeValue;
import com.revrobotics.spark.config.SparkBaseConfig.IdleMode;
import com.revrobotics.spark.config.SparkMaxConfig;
import com.revrobotics.RelativeEncoder;
import com.revrobotics.spark.SparkBase.PersistMode;
import com.revrobotics.spark.SparkBase.ResetMode;
import com.revrobotics.spark.SparkLowLevel.MotorType;
import com.revrobotics.spark.SparkMax;
import com.revrobotics.RelativeEncoder;
import com.revrobotics.spark.config.SparkBaseConfig.IdleMode;
import com.revrobotics.spark.config.SparkMaxConfig;
import edu.wpi.first.wpilibj.DigitalInput;
import frc.robot.Constants;

Expand All @@ -20,18 +20,19 @@
*/
public class IntakeIOFalcon implements IntakeIO {

private final SparkMax intakeMotorLeft = new SparkMax(Constants.Motors.Intake.INTAKE_MOTOR_ID_LEFT,
MotorType.kBrushless);
private final SparkMax intakeMotorRight = new SparkMax(Constants.Motors.Intake.INTAKE_MOTOR_ID_RIGHT,
MotorType.kBrushless);
private final SparkMax intakeMotorLeft =
new SparkMax(Constants.Motors.Intake.INTAKE_MOTOR_ID_LEFT, MotorType.kBrushless);
private final SparkMax intakeMotorRight =
new SparkMax(Constants.Motors.Intake.INTAKE_MOTOR_ID_RIGHT, MotorType.kBrushless);
public final RelativeEncoder intakeRelativeEnc = intakeMotorLeft.getEncoder();
private final TalonFX indexerMotor = new TalonFX(Constants.Motors.Intake.INDEXER_MOTOR_ID);

private final DutyCycleOut indexerDutyCycleOut = new DutyCycleOut(0);
private final TalonFXConfiguration indexerConfig = new TalonFXConfiguration();
private final DigitalInput indexerBeamBrake = new DigitalInput(
Constants.IntakeConstants.INDEXER_BEAM_BRAKE_DIO_PORT);
private final DigitalInput intakeBeamBrake = new DigitalInput(Constants.IntakeConstants.INTAKE_BEAM_BRAKE_DIO_PORT);
private final DigitalInput indexerBeamBrake =
new DigitalInput(Constants.IntakeConstants.INDEXER_BEAM_BRAKE_DIO_PORT);
private final DigitalInput intakeBeamBrake =
new DigitalInput(Constants.IntakeConstants.INTAKE_BEAM_BRAKE_DIO_PORT);
SparkMaxConfig LeftConfig = new SparkMaxConfig();

Check warning on line 36 in src/main/java/frc/robot/subsystems/intake/IntakeIOFalcon.java

View workflow job for this annotation

GitHub Actions / Linting

[checkstyle] reported by reviewdog 🐶 Member name 'LeftConfig' must match pattern '^[_a-z][_a-zA-Z0-9]*$'. Raw Output: /github/workspace/./src/main/java/frc/robot/subsystems/intake/IntakeIOFalcon.java:36:20: warning: Member name 'LeftConfig' must match pattern '^[_a-z][_a-zA-Z0-9]*$'. (com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck)
SparkMaxConfig RightConfig = new SparkMaxConfig();

Expand All @@ -41,11 +42,15 @@ public class IntakeIOFalcon implements IntakeIO {
public IntakeIOFalcon() {
// SparkMaxConfig config = new SparkMaxConfig();
// config.signals.primaryEncoderPositionPeriodMs(5);
LeftConfig.inverted(Constants.IntakeConstants.INTAKE_MOTOR_INVERTED).idleMode(IdleMode.kCoast) // HERE IT IS
.smartCurrentLimit(40);
RightConfig.inverted(false).idleMode(IdleMode.kCoast).smartCurrentLimit(40);
intakeMotorLeft.configure(LeftConfig, ResetMode.kResetSafeParameters, PersistMode.kPersistParameters);
intakeMotorRight.configure(RightConfig, ResetMode.kResetSafeParameters, PersistMode.kPersistParameters);
LeftConfig.inverted(Constants.IntakeConstants.INTAKE_MOTOR_INVERTED)
.idleMode(IdleMode.kCoast) // HERE IT IS
.smartCurrentLimit(40).voltageCompensation(12);
RightConfig.inverted(false).idleMode(IdleMode.kCoast).smartCurrentLimit(40)
.voltageCompensation(12);
intakeMotorLeft.configure(LeftConfig, ResetMode.kResetSafeParameters,
PersistMode.kPersistParameters);
intakeMotorRight.configure(RightConfig, ResetMode.kResetSafeParameters,
PersistMode.kPersistParameters);
indexerConfig.MotorOutput.NeutralMode = NeutralModeValue.Brake;
indexerConfig.MotorOutput.Inverted = InvertedValue.Clockwise_Positive;
indexerMotor.getConfigurator().apply(indexerConfig);
Expand Down
12 changes: 8 additions & 4 deletions src/main/java/frc/robot/subsystems/shooter/ShooterVortex.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ public class ShooterVortex implements ShooterIO {
public ShooterVortex() {
SparkBaseConfig TopConfig = new SparkFlexConfig();

Check warning on line 28 in src/main/java/frc/robot/subsystems/shooter/ShooterVortex.java

View workflow job for this annotation

GitHub Actions / Linting

[checkstyle] reported by reviewdog 🐶 Local variable name 'TopConfig' must match pattern '^[_a-z]([_a-zA-Z0-9]*)?$'. Raw Output: /github/workspace/./src/main/java/frc/robot/subsystems/shooter/ShooterVortex.java:28:25: warning: Local variable name 'TopConfig' must match pattern '^[_a-z]([_a-zA-Z0-9]*)?$'. (com.puppycrawl.tools.checkstyle.checks.naming.LocalVariableNameCheck)
SparkBaseConfig BottomConfig = new SparkFlexConfig();

Check warning on line 29 in src/main/java/frc/robot/subsystems/shooter/ShooterVortex.java

View workflow job for this annotation

GitHub Actions / Linting

[checkstyle] reported by reviewdog 🐶 Local variable name 'BottomConfig' must match pattern '^[_a-z]([_a-zA-Z0-9]*)?$'. Raw Output: /github/workspace/./src/main/java/frc/robot/subsystems/shooter/ShooterVortex.java:29:25: warning: Local variable name 'BottomConfig' must match pattern '^[_a-z]([_a-zA-Z0-9]*)?$'. (com.puppycrawl.tools.checkstyle.checks.naming.LocalVariableNameCheck)
BottomConfig.inverted(true).idleMode(IdleMode.kCoast).voltageCompensation(12);
TopConfig.inverted(false).idleMode(IdleMode.kCoast).voltageCompensation(12);
BottomConfig.inverted(true).idleMode(IdleMode.kCoast).voltageCompensation(12)
.voltageCompensation(12).smartCurrentLimit(20);
TopConfig.inverted(false).idleMode(IdleMode.kCoast).voltageCompensation(12)
.voltageCompensation(12).smartCurrentLimit(20);


TopConfig.encoder.positionConversionFactor(Constants.ShooterConstants.GEAR_RATIO);
Expand All @@ -43,9 +45,11 @@ public ShooterVortex() {

// topShooterMotor.setSmartCurrentLimit(20);
// bottomShooterMotor.setSmartCurrentLimit(20);
// topShooterMotor.enableVoltageCompensation(12);
// bottomShooterMotor.enableVoltageCompensation(12);

// topShooterMotor.voltageCompensation(12);
// bottomShooterMotor.voltageCompensation(12);
// gear ratio 31:16

// bottomShooterMotor.burnFlash();
// topShooterMotor.burnFlash();

Expand Down

0 comments on commit ec3612a

Please sign in to comment.