Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@
package frc.robot;

/** Add your docs here. */
public class Constants {

public final class Constants {
public static final class IntakeConstants {

Check warning on line 10 in src/main/java/frc/robot/Constants.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] reported by reviewdog 🐶 'class def modifier' has incorrect indentation level 4, expected level should be 2. Raw Output: /github/workspace/./src/main/java/frc/robot/Constants.java:10:5: warning: 'class def modifier' has incorrect indentation level 4, expected level should be 2. (com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

請修正這邊的縮排問題

public static final int intakeMotorId = 10;
public static final int pivotLeftId = 11;
public static final int pivotRightId = 12;
public static final int pivotEncoderId = 4;
// ---------------------------------- Intake Motor Speeds ----------------------------------
public static final double intakeSpeed = 0.5;
public static final double reverseIntakeSpeed = -0.5;
public static final double stopIntakeSpeed = 0.0;
public static final double pivotSpeed = 0.2;
public static final double reversePivotSpeed = -0.2;
public static final double stopPivotSpeed = 0.0;
}
}
1 change: 1 addition & 0 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import edu.wpi.first.wpilibj2.command.Commands;

public class RobotContainer {

public RobotContainer() {
configureBindings();
}
Expand Down
60 changes: 49 additions & 11 deletions src/main/java/frc/robot/subsystems/IntakeSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,77 @@

package frc.robot.subsystems;


import com.revrobotics.spark.SparkLowLevel.MotorType;
import com.revrobotics.spark.SparkMax;
import com.revrobotics.spark.config.SparkBaseConfig.IdleMode;
import com.revrobotics.spark.config.SparkMaxConfig;
import edu.wpi.first.wpilibj.DutyCycleEncoder;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.SubsystemBase;


public class IntakeSubsystem extends SubsystemBase {
/** Creates a new IntakeSubsystem. */
private final SparkMax intakeMotor = new SparkMax(10, MotorType.kBrushless);
private final SparkMax pivotLeft = new SparkMax(11, MotorType.kBrushless);
private final SparkMax pivotRight = new SparkMax(12, MotorType.kBrushless);
private final DutyCycleEncoder pivotEncoder = new DutyCycleEncoder(4);


public IntakeSubsystem() {
}
SparkMaxConfig config = new SparkMaxConfig();
config.inverted(false)
.smartCurrentLimit(30)
.idleMode(IdleMode.kBrake);

private void intake() {

intakeMotor.configure(config, SparkMax.ResetMode.kResetSafeParameters, SparkMax.PersistMode.kPersistParameters);

Check warning on line 31 in src/main/java/frc/robot/subsystems/IntakeSubsystem.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] reported by reviewdog 🐶 'ctor def' child has incorrect indentation level 3, expected level should be 4. Raw Output: /github/workspace/./src/main/java/frc/robot/subsystems/IntakeSubsystem.java:31:4: warning: 'ctor def' child has incorrect indentation level 3, expected level should be 4. (com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

這個縮排問題要記得修正喔

pivotLeft.configure(config, SparkMax.ResetMode.kResetSafeParameters, SparkMax.PersistMode.kPersistParameters);
pivotRight.configure(config, SparkMax.ResetMode.kResetSafeParameters, SparkMax.PersistMode.kPersistParameters);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BrianHu0925 說過的,configure 已經被標注為 depercated,代表這個 API 即將被刪除。(他的 warning 訊息中有說明)

The method configure(SparkBaseConfig, SparkBase.ResetMode, SparkBase.PersistMode) from the type SparkMax has been deprecated since version 2026 and marked for removal.

}

private void reverseIntake() {

public void intake() {
intakeMotor.set(0.5);
}

private void stopIntake() {
public void reverseIntake() {
intakeMotor.set(-0.5);
}

public void stopIntake() {
intakeMotor.set(0);
}

private void rotateUp() {
public void rotateUp() {
pivotLeft.set(0.2);
pivotRight.set(-0.2);
}

public void rotateDown() {
pivotLeft.set(-0.2);
pivotRight.set(0.2);
}

private void rotateDown() {
public void stopRotate() {
pivotLeft.set(0);
pivotRight.set(0);
}

public void deployIntake() {
rotateDown();
}

private void stopRotate() {
public void retractIntake() {
rotateUp();
}

public double getPivotAbsolutePosition() {
return pivotEncoder.get();
}

@Override
public void periodic() {
// This method will be called once per scheduler run
SmartDashboard.putNumber("Pivot Absolute Pos", getPivotAbsolutePosition());
SmartDashboard.putBoolean("Pivot Encoder Connected", pivotEncoder.isConnected());
Comment on lines +77 to +78

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DashBoard 的命名方式確定了記得更改一下喔

}
}
}
Loading
Loading