季后赛重构:补完 Superstructure 状态机与射击门控
- Superstructure 增加 INDEXING/HOLDING_NOTE 状态,实现完整状态流转: DEPLOYING_INTAKE -> INTAKING -> INDEXING -> HOLDING_NOTE -> SPINNING_UP -> AIMING -> READY_TO_SHOOT -> SHOOTING -> CLEANUP - canShoot 门控补全:atSpeed && isAimed && rotaterAtGoal && hasNote && 底盘近静止 (hasNote/静止门控均可在 Constants 中旁路) - 无传感器持球跟踪:INDEXING 完成置位、射击/EJECT 后清空, 未归零被拦下的 intake 不会误置持球 - DriveControls 在既有 hub 方位角计算处同步 setTargetHeading, 使 isAimed 门控与 AutoAimming 实际瞄准同源;自动阶段经 pushDistanceData 保持更新 - 移除 Superstructure 基于 limelight tx 的瞄准更新(符号错误且无目标时滞留旧值) - 背板回零命令下沉到 ShooterSubsystem,OperatorControls 不再直接操作电机 - ShooterSubsystem 清理旧别名与闭环遗留接口,背板独立控制请求 - 射表改为 InterpolatingDoubleTreeMap(Constants.Shooter.flywheelRpsByDistance) - IntakeRotater:未归零时 atGoal 一律 false,新增 blockedByNotZeroed 遥测; atGoal 容差改为非零占位值 - 修复 gradlew 缺少可执行权限 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YTEBmjtkz1ouCmn5yytFti
This commit is contained in:
@@ -84,9 +84,19 @@ public class IntakeRotaterSubsystem extends SubsystemBase {
|
||||
}
|
||||
|
||||
public boolean atGoal() {
|
||||
// 未归零时编码器读数没有意义,一律视为未到位,
|
||||
// 让上层射击门控和状态流转不会被假读数放行。
|
||||
if (!zeroed) {
|
||||
return false;
|
||||
}
|
||||
return Math.abs(getPosition() - goal.rotations) <= Constants.Intaker.positionToleranceRotations;
|
||||
}
|
||||
|
||||
public boolean isBlockedByNotZeroed() {
|
||||
// 归零前收到了 SAFE 以外的位置请求:机构被安全逻辑拦下,需要先归零。
|
||||
return !zeroed && goal != IntakePosition.SAFE;
|
||||
}
|
||||
|
||||
public void zeroPosition() {
|
||||
// 只有 intake 物理上处于已知零点姿态时才调用此方法。
|
||||
leftIntakeRotater.setPosition(0.0);
|
||||
@@ -138,6 +148,7 @@ public class IntakeRotaterSubsystem extends SubsystemBase {
|
||||
public void periodic() {
|
||||
table.getEntry("goal").setString(goal.name());
|
||||
table.getEntry("zeroed").setBoolean(zeroed);
|
||||
table.getEntry("blockedByNotZeroed").setBoolean(isBlockedByNotZeroed());
|
||||
table.getEntry("position").setDouble(getPosition());
|
||||
table.getEntry("atGoal").setBoolean(atGoal());
|
||||
table.getEntry("manualVoltage").setDouble(manualVoltage);
|
||||
|
||||
Reference in New Issue
Block a user