季后赛重构:补完 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:
@@ -12,7 +12,8 @@ import frc.robot.Constants;
|
||||
/**
|
||||
* 主 conveyor 的开环控制封装。
|
||||
*
|
||||
* 本赛季没有球检测传感器,因此这里仅报告电机状态;
|
||||
* 本赛季没有球检测传感器,持球状态由 Superstructure 按状态流程推断后
|
||||
* 写入这里(INDEXING 完成置位,射击/EJECT 后清空);
|
||||
* 所有动作顺序判断都放在 Superstructure。
|
||||
*/
|
||||
public class ConveyorSubsystem extends SubsystemBase {
|
||||
@@ -22,6 +23,7 @@ public class ConveyorSubsystem extends SubsystemBase {
|
||||
private final NetworkTable table = NetworkTableInstance.getDefault().getTable("Conveyor");
|
||||
|
||||
private double voltage = 0.0;
|
||||
private boolean notePresent = false;
|
||||
|
||||
public ConveyorSubsystem() {
|
||||
mainConveyor = new TalonFX(Constants.Conveyor.mainConveyorID);
|
||||
@@ -52,9 +54,18 @@ public class ConveyorSubsystem extends SubsystemBase {
|
||||
mainConveyor.setControl(voltageRequest.withOutput(voltage));
|
||||
}
|
||||
|
||||
public boolean hasNote() {
|
||||
return notePresent;
|
||||
}
|
||||
|
||||
public void setNotePresent(boolean present) {
|
||||
notePresent = present;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void periodic() {
|
||||
table.getEntry("voltage").setDouble(voltage);
|
||||
table.getEntry("velocity").setDouble(mainConveyor.getVelocity().getValueAsDouble());
|
||||
table.getEntry("hasNote").setBoolean(notePresent);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user