This commit is contained in:
OnDYCLaptop
2026-02-27 11:53:42 +08:00
parent 5e85e5430e
commit 4c0e254686
3 changed files with 5 additions and 4 deletions
+1 -1
View File
@@ -115,7 +115,7 @@ public final class Constants {
public static final boolean inverted = false;
public static final double climbUpTicks = 83; // TODO: 实测后调整
public static final double climbUpTicks = 94; // TODO: 实测后调整
public static final double climbDownTicks = 0; // TODO: 实测后调整
public static final double holdToleranceRot = 0.5;
@@ -24,9 +24,9 @@ public class ClimberControls {
return Commands.run(()->{
//climber.climbUp();
// 优先级:如果同时按,优先上升(你也可以反过来)
if (controller.x().getAsBoolean()) {
if (controller.y().getAsBoolean()) {
climber.climbUp();
} else if (controller.y().getAsBoolean()) {
} else if (controller.x().getAsBoolean()) {
climber.climbDown();
} else {
// 松开:记录当前位置 + 锁死
@@ -115,11 +115,12 @@ public class ShooterSubsystem extends SubsystemBase {
// 使用PID控制器来计算背板的运动速度
double pidOutput = backboardPID.calculate(getBackboardPosition());
pidOutput = Math.max(-Constants.Shooter.backboardSpeedMax, Math.min(Constants.Shooter.backboardSpeedMax, pidOutput)); // 限制输出范围
shooterNetworkTable.getEntry("backboardPIDOutput").setDouble(pidOutput);
if (Math.abs(pidOutput) < 0.8) {
pidOutput = 0.0;
}//防止抖动
// // 设置背板电机的速度,根据PID输出进行调整
shooterNetworkTable.getEntry("backboardPIDOutput").setDouble(pidOutput);
setBackboardSpeedByRPS(pidOutput);
}
// 停止所有电机