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
@@ -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);
}
// 停止所有电机