|
14 | 14 | import static org.wpilib.units.Units.*; |
15 | 15 |
|
16 | 16 | import choreo.trajectory.SwerveSample; |
| 17 | +import com.ctre.phoenix6.alerts.AlertableCollection; |
17 | 18 | import frc.lib.RobotMode; |
18 | 19 | import frc.robot.Constants; |
19 | 20 | import frc.robot.Constants.FeatureFlags; |
@@ -59,6 +60,8 @@ public class Drive extends SubsystemBase { |
59 | 60 | "Drive/gyroDisconnected", |
60 | 61 | "Disconnected gyro, using kinematics as fallback.", |
61 | 62 | Alert.Level.HIGH); |
| 63 | + // Phoenix reports these alerts on a robot controller and treats them as a no-op elsewhere |
| 64 | + private final AlertableCollection deviceAlerts = new AlertableCollection("Swerve"); |
62 | 65 |
|
63 | 66 | private final BooleanPublisher alignEncodersPub; |
64 | 67 |
|
@@ -112,6 +115,9 @@ public Drive( |
112 | 115 | modules[1] = new Module(frModuleIO, "FrontRight"); |
113 | 116 | modules[2] = new Module(blModuleIO, "BackLeft"); |
114 | 117 | modules[3] = new Module(brModuleIO, "BackRight"); |
| 118 | + for (var module : modules) { |
| 119 | + module.registerAlerts(deviceAlerts); |
| 120 | + } |
115 | 121 |
|
116 | 122 | // Usage reporting for swerve template |
117 | 123 | // TODO: update instance string to match the official 2027 AKit template when released. |
@@ -209,6 +215,7 @@ public void periodic() { |
209 | 215 | boolean gyroDisconnected = !gyroInputs.connected && Constants.currentMode != RobotMode.SIM; |
210 | 216 | gyroDisconnectedAlert.set(gyroDisconnected); |
211 | 217 | Logger.recordOutput("Faults/Drive/GyroDisconnected", gyroDisconnected); |
| 218 | + deviceAlerts.report(); |
212 | 219 |
|
213 | 220 | // Profiling output |
214 | 221 | if (FeatureFlags.PROFILING_ENABLED) { |
|
0 commit comments