Conversation
Hannahjjj97
left a comment
There was a problem hiding this comment.
請修正
- 不該出現在 Subsystem 的搖桿程式需刪除
- 多餘不會用到的 Vendor 檔也需刪除
- Phoenix 的 Vendor 要改成沒有 replay 的版本
| /** Creates a new IntakeSubsystem. */ | ||
| SparkMax intakeMotor = new SparkMax(10, MotorType.kBrushless); | ||
| SparkMaxConfig config = new SparkMaxConfig(); | ||
| Joystick driverJoystick = new Joystick(0); |
There was a problem hiding this comment.
Subsystem 裡面不該出現搖桿,如果不太懂的話,你什麼時候去實驗室啊?我可以找人教你
| if (driverJoystick.getRawButton(2)) { | ||
| rotateUp(); | ||
| } | ||
| else if (driverJoystick.getRawButton(3)) { | ||
| rotateDown(); | ||
| } | ||
| else { | ||
| stopRotate(); | ||
|
|
||
| // | ||
| if (driverJoystick.getRawButton(4)) { | ||
| intake(); | ||
| } | ||
| else if (driverJoystick.getRawButton(5)) { | ||
| reverseIntake(); | ||
| } | ||
| else { | ||
| stopIntake(); | ||
| } | ||
| } |
There was a problem hiding this comment.
這些東西也不該出現在 Subsystem 裡面,一樣如果沒懂的話,看你什麼時候去實驗室,我找人教你
|
Checks 沒通過要去看為什麼沒通過並修正喔 |
|
你如果改完需要再 review 一次的話要再 request review 一次喔 |
|
Merging is blocked |
Hannahjjj97
left a comment
There was a problem hiding this comment.
調仰角的地方有裝 encoder,可以補一下
Hannahjjj97
left a comment
There was a problem hiding this comment.
Encoder 要用 DutyCycleEncoder 這個類別喔,你可以自己新增 method,可以一次伸出來跟一次收進去的 method
| 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); | ||
| private final SparkMaxConfig config = new SparkMaxConfig(); |
There was a problem hiding this comment.
這個 config 只是用來設定 SparkMax,建議可以直接在 constructor 裡面定義就好。
|
AmLib-2026.0.1.json 這個 vendordrop 好像沒用到?我看前面也有提到 不會用到的話記得刪掉 |
Hannahjjj97
left a comment
There was a problem hiding this comment.
要把 vendor 刪掉然後從 main merge 進來喔
|
你什麼時候會去實驗室呀 |
|
你在 configure 的地方用的是已經 deprecated 的 method 喔 記得修掉 |
| SmartDashboard.putNumber("Pivot Absolute Pos", getPivotAbsolutePosition()); | ||
| SmartDashboard.putBoolean("Pivot Encoder Connected", pivotEncoder.isConnected()); |
|
|
||
| private void intake() { | ||
|
|
||
| intakeMotor.configure(config, SparkMax.ResetMode.kResetSafeParameters, SparkMax.PersistMode.kPersistParameters); |
|
|
||
| intakeMotor.configure(config, SparkMax.ResetMode.kResetSafeParameters, SparkMax.PersistMode.kPersistParameters); | ||
| pivotLeft.configure(config, SparkMax.ResetMode.kResetSafeParameters, SparkMax.PersistMode.kPersistParameters); | ||
| pivotRight.configure(config, SparkMax.ResetMode.kResetSafeParameters, SparkMax.PersistMode.kPersistParameters); |
There was a problem hiding this comment.
同 @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 configureBindings() { | ||
|
|
||
| // 按住A鍵吸球放開停止 | ||
| driverController.a().whileTrue( | ||
| new RunCommand(() -> intakeSubsystem.intake(), intakeSubsystem) | ||
| ).onFalse(new InstantCommand(() -> intakeSubsystem.stopIntake(), intakeSubsystem)); | ||
|
|
||
| // 按住B鍵反轉放開停止 | ||
| driverController.b().whileTrue( | ||
| new RunCommand(() -> intakeSubsystem.reverseIntake(), intakeSubsystem) | ||
| ).onFalse(new InstantCommand(() -> intakeSubsystem.stopIntake(), intakeSubsystem)); | ||
|
|
||
| // ------------------- Pivot 角度控制 ------------------- | ||
|
|
||
| // 按住 Y 鍵抬起放開停止 | ||
| driverController.y().whileTrue( | ||
| new RunCommand(() -> intakeSubsystem.rotateUp(), intakeSubsystem) | ||
| ).onFalse(new InstantCommand(() -> intakeSubsystem.stopRotate(), intakeSubsystem)); | ||
|
|
||
| // 按住 X鍵放下放開停止 | ||
| driverController.x().whileTrue( | ||
| new RunCommand(() -> intakeSubsystem.rotateDown(), intakeSubsystem) | ||
| ).onFalse(new InstantCommand(() -> intakeSubsystem.stopRotate(), intakeSubsystem)); | ||
| } |
There was a problem hiding this comment.
這是你自己寫的嗎?我們正式不會這樣寫喔,會使用簡易 command。然後請先處理尚未解決的問題
|
deprecated 的 method 記得修掉喔 |
kennhung
left a comment
There was a problem hiding this comment.
請修正有留言的問題,RobotContainer 不應該在這個分支被修改(現在多了一個空行)
| public class Constants { | ||
|
|
||
| public final class Constants { | ||
| public static final class IntakeConstants { |

pr測試