This commit is contained in:
OnDYCLaptop
2026-07-04 21:08:04 +08:00
11 changed files with 277 additions and 160 deletions
@@ -12,7 +12,8 @@ import frc.robot.Constants;
/**
* 主 conveyor 的开环控制封装。
*
* 本赛季没有球检测传感器,因此这里仅报告电机状态;
* 本赛季没有球检测传感器,持球状态由 Superstructure 按状态流程推断后
* 写入这里(INDEXING 完成置位,射击/EJECT 后清空);
* 所有动作顺序判断都放在 Superstructure。
*/
public class ConveyorSubsystem extends SubsystemBase {
@@ -20,6 +21,8 @@ public class ConveyorSubsystem extends SubsystemBase {
private final VoltageOut voltageRequest = new VoltageOut(0);
private final NetworkTable table = NetworkTableInstance.getDefault().getTable("Conveyor");
private double voltage = 0.0;
public ConveyorSubsystem() {
mainConveyor = new TalonFX(Constants.Conveyor.mainConveyorID);
}
@@ -35,9 +38,10 @@ public class ConveyorSubsystem extends SubsystemBase {
public void setVoltage(double volts) {
mainConveyor.setControl(voltageRequest.withOutput(volts));
}
@Override
public void periodic() {
table.getEntry("velocity").setDouble(mainConveyor.getVelocity().getValueAsDouble());
table.getEntry("hasNote").setBoolean(notePresent);
}
}