季后赛重构:补完 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:
@@ -129,7 +129,11 @@ public class DriveControls {
|
||||
autoControlNetworkTable.getEntry("angleDifferenceToHub").setDouble(distanceAndRotation[1]);
|
||||
autoControlNetworkTable.getEntry("distanceToPassball").setDouble(calculateDistanceAndRotationToPassBall()[0]);
|
||||
autoControlNetworkTable.getEntry("angleDifferenceToPassball").setDouble(calculateDistanceAndRotationToPassBall()[1]);
|
||||
|
||||
// 把朝向 hub 的目标角同步给底盘,供 Superstructure 读取 isAimed() 做射击门控;
|
||||
// 数据来源与 AutoAimming 自动旋转完全相同,保证门控和实际瞄准一致。
|
||||
drivetrain.setTargetHeading(
|
||||
drivetrain.getRotation().plus(Rotation2d.fromDegrees(distanceAndRotation[1])));
|
||||
|
||||
switch (robotStatusManager.getStatus()) {
|
||||
case Stopped:
|
||||
vx = 0;
|
||||
@@ -472,6 +476,10 @@ public class DriveControls {
|
||||
// 将距离值写入 NetworkTable
|
||||
autoControlNetworkTable.getEntry("distanceToHub").setDouble(distanceAndRotation[0]);
|
||||
autoControlNetworkTable.getEntry("angleDifferenceToHub").setDouble(distanceAndRotation[1]);
|
||||
// 自动阶段默认驾驶命令不运行,这里同样保持目标朝向最新,
|
||||
// 让自动程序里的射击门控 isAimed() 有效。
|
||||
drivetrain.setTargetHeading(
|
||||
drivetrain.getRotation().plus(Rotation2d.fromDegrees(distanceAndRotation[1])));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user