Skip to content

Commit

Permalink
Fix MonitoredSubsystem but its still broken
Browse files Browse the repository at this point in the history
  • Loading branch information
aidnem committed Oct 9, 2024
1 parent fccb2ed commit c65c310
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions wpi_interface/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def includeDesktopSupport = true
// Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries.
// Also defines JUnit 5.
dependencies {
implementation project(":monitors")
implementation 'edu.wpi.first.wpilibj:wpilibj-java:2024.3.2'
implementation 'edu.wpi.first.wpilibNewCommands:wpilibNewCommands-java:2024.3.2'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package coppercore.wpi_interface;

import coppercore.monitors.Monitor;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import java.util.ArrayList;
import java.util.List;
import org.littletonrobotics.junction.Logger;

public class MonitoredSubsystem extends SubsystemBase {
private List<Monitor> registeredMonitors = new ArrayList<Monitor>();
Expand Down Expand Up @@ -34,7 +36,13 @@ public void monitoredPeriodic() {}
private void runMonitors() {
registeredMonitors.forEach(
monitor -> {
monitor.periodic();
monitor.periodic(Timer.getFPGATimestamp());

// TODO: Move logging to MonitoredSubsystem under wpi interface
Logger.recordOutput(
"monitors/" + monitor.getName() + "/triggered", monitor.isTriggered());
Logger.recordOutput(
"monitors/" + monitor.getName() + "/faulted", monitor.isFaulted());
});
}
}

0 comments on commit c65c310

Please sign in to comment.