Conversation
| public ClimberSubsystem() {} | ||
| private final SparkMax climberMotor = new SparkMax(5, MotorType.kBrushless); | ||
| private final SparkClosedLoopController closedLoopController = climberMotor.getClosedLoopController(); | ||
| private static final double L1_POSITION = 0.0; |
| public static final double minOutput = -1.0; | ||
| public static final double maxOutput = 1.0; | ||
| public static final int currentLimit = 40; | ||
| public static final double L1position = 25.0; |
There was a problem hiding this comment.
這個 L 大寫是可以的,我等下幫你跳過 checkstyle
There was a problem hiding this comment.
'member def modifier' has incorrect indentation level 8, expected level should be 4.
這行是什麼意思
我有好幾條程式碼都跳這個,讓我沒辦法推上去,checkstyle都說有錯
There was a problem hiding this comment.
然後再重新自動排版(Shift+Alt+F)一下,就會好了
| private static final double L1position = ClimberConstants.L1position; | ||
| private static final double L2position = ClimberConstants.L2position; | ||
| private static final double speed = ClimberConstants.speed; |
|
阿你如果改完了 要再 request review 一次喔 |
|
你什麼時候會去實驗室啊 |
|
啊你可以先寫簡易版 command 了 |
|
我應該禮拜日才會去 |
|
欸等等禮拜日要消毒,那我禮拜六應該會去,只不過就只能去早上,下午有補習 |
好 那我星期六早上去找你? |
|
排版修完之後,monday 可以先 done,然後剩下的部分星期六再來處理。 |
|
Type name 'climberCommand' must match pattern '^[A-Z][a-zA-Z0-9]*$'.是什麼意思? |
星期六我會跟你說程式要怎麼改,然後如果來得及改的話可以拿馬達測邏輯,就是他能不能在該停的地方停下來。 |
要大寫開頭 |
kennhung
left a comment
There was a problem hiding this comment.
ClimberCmd.java 這個檔案是 Command,好像不應該放這邊。
而且 Command 名稱通常要可以看得出這個 Command 是做什麼用的,直接叫做 ClimberCmd 沒辦法知道這個 Command 的用途。
|
|
||
| public class RobotContainer { | ||
| public RobotContainer() { | ||
|
|
|
Studica.json 是不是沒用到啊?沒用到的話記得刪掉 |
Hannahjjj97
left a comment
There was a problem hiding this comment.
你星期六在實驗室改的東西如果有空可以先整理整理然後 commit 喔
|
|
||
| package frc.robot.subsystems; | ||
|
|
||
| import com.revrobotics.RelativeEncoder; |
|
我今天有來實驗室,那我還要測馬達邏輯嗎? |
|
好像沒看到 merge main 的 commit? |
kennhung
left a comment
There was a problem hiding this comment.
除了有註解的部分之外,RobotContainer 不應該在這個分支被改到。
另外,每個 ClimberSybsystem 裡面每個 Command 的行為好像都有點不太合理。(runEnd 的 end 動作)
| SparkMaxConfig config = new SparkMaxConfig(); | ||
| config | ||
| .idleMode(com.revrobotics.spark.config.SparkBaseConfig.IdleMode.kBrake) | ||
| .smartCurrentLimit(ClimberConstants.currentLimit); |
There was a problem hiding this comment.
為什麼需要特別調整 SparkMax 預設的 CurrentLimit?
There was a problem hiding this comment.
因為原本有要測馬達邏輯,所以就先設小一點,然後clamp的數值也是
| public Command toLowRungCmd() { | ||
| Command cmd = this.runEnd(() -> toLowRung(), () -> climberMotor.set(0)); | ||
| cmd.setName("toLowRungCmd"); | ||
| return cmd; | ||
| } | ||
|
|
||
| private void climbDown() { | ||
| public Command toMidRungCmd() { | ||
| Command cmd = this.runEnd(() -> toMidRung(), () -> climberMotor.set(0)); | ||
| cmd.setName("toMidRungCmd"); | ||
| return cmd; | ||
| } | ||
|
|
||
| public Command climbUpCmd() { | ||
| Command cmd = this.runEnd(() -> climbUp(), () -> climberMotor.set(0)); | ||
| cmd.setName("climbUpCmd"); | ||
| return cmd; | ||
| } | ||
|
|
||
| private void stopClimb() { | ||
| public Command climbDownCmd() { | ||
| Command cmd = this.runEnd(() -> climbDown(), () -> climberMotor.set(0)); | ||
| cmd.setName("climbDownCmd"); | ||
| return cmd; | ||
| } |
There was a problem hiding this comment.
按著的時候就可以往上往下,然後放開就停在那個高度,toLowRung和toMidRung是按一下就可以到L1和L2的高度
| return Commands.print("No autonomous command configured"); | ||
| } | ||
| } | ||
| } No newline at end of file |
There was a problem hiding this comment.
啊,你這邊好像又不小心把一行刪掉了
你可以看 PR 的 Files changed 頁面確認一下跟原本的差在哪
| public void periodic() { | ||
| // This method will be called once per scheduler run | ||
|
|
||
| double measurement = MathUtil.clamp(climberEncoder.get(), -1.0, 1.0); |
There was a problem hiding this comment.
為什麼會需要把 encoder 讀到的值 clamp 在 -1 ~ 1 之間啊?
There was a problem hiding this comment.
看你想要做的是什麼事情?
clamp 在 motor.set 就會把馬達輸出限定在一個範圍內
同理,用在 encoder.get 就會把 encoder 輸出限定在一個範圍內
| public void resetEncoder() { | ||
| climberMotor.getEncoder().setPosition(0); | ||
| climberPID.reset(); | ||
| climberPID.setSetpoint(0); | ||
| } |
There was a problem hiding this comment.
感覺有點怪怪的 你爬升用的是 dutycycle encoder 可是這裡 reset 的是 sparkMax 的
kennhung
left a comment
There was a problem hiding this comment.
RobotContainer.java 還是跟 main 不同,有被改到
另外,有其中一個留言有問問題,請回覆一下,不要直接設為已解決
| } | ||
|
|
||
| @Override | ||
| public void periodic() { |
There was a problem hiding this comment.
希望可以在不同的東西之間加上空行,會比較方便其他人閱讀。(可以分成取得目前位置、控制馬達、把東西放上 Dashboard)
| SparkMaxConfig config = new SparkMaxConfig(); | ||
| config | ||
| .idleMode(com.revrobotics.spark.config.SparkBaseConfig.IdleMode.kBrake) | ||
| .smartCurrentLimit(ClimberConstants.currentLimit); |

No description provided.