Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
fb435a0
importing into 2025
WispySparks Nov 30, 2024
3feb9ba
Don't use ramsete because it's deprecated and LTV is better
WispySparks Nov 30, 2024
88fafb8
star import
WispySparks Nov 30, 2024
2bdc37d
Add a custom logger for TalonFX
WispySparks Nov 30, 2024
e0c56ee
cross reference with other branch, logged firmware version
WispySparks Nov 30, 2024
fbf3e8b
spotless
WispySparks Nov 30, 2024
fb5d73a
remove exception
WispySparks Nov 30, 2024
1a552c3
Remove NTLogger
WispySparks Dec 1, 2024
c588a02
Update Phoenix, remove mergeMaps, add todos
WispySparks Dec 14, 2024
3bc184c
Update to beta 3, implement log helpers
WispySparks Dec 21, 2024
3847b06
Update to kickoff release
WispySparks Jan 3, 2025
2d52fd5
Create a signal construct so we can refresh all the signals for a tal…
WispySparks Jan 3, 2025
6441b14
Move TalonFXLogger
WispySparks Jan 3, 2025
3ad3404
Add method to create runnable to refresh all talonfxs, conditionally …
WispySparks Jan 3, 2025
eaeb0d8
Revert "Move TalonFXLogger"
WispySparks Jan 3, 2025
d96d95f
dumb test
WispySparks Jan 3, 2025
9b22d79
Merge branch 'master' into 2025
WispySparks Jan 3, 2025
3c2c256
Update phoenix
WispySparks Jan 4, 2025
f63ef95
Move this function to TalonFXLogger
WispySparks Jan 4, 2025
aa6cb7e
Simplify logger a bit
WispySparks Jan 4, 2025
1552140
Fix class cast exceptions, working on better list
WispySparks Jan 4, 2025
6b545f2
remove garbage test
WispySparks Jan 4, 2025
aea2569
Update WPILib
WispySparks Jan 12, 2025
746b4a6
notes
WispySparks Jan 14, 2025
e21a4db
Do the add periodic in the library
WispySparks Jan 15, 2025
e810330
use a class instead of a record and cache the allSignals
WispySparks Jan 15, 2025
8360558
don't have a self refresh
WispySparks Jan 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
*.java text eol=lf
*.gradle text eol=lf
* text=auto eol=lf
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -161,5 +161,30 @@ gradle-app.setting
.settings/
bin/

# IntelliJ
*.iml
*.ipr
*.iws
.idea/
out/

# Fleet
.fleet

# Simulation GUI and other tools window save file
networktables.json
simgui.json
*-window.json

# Simulation data log directory
logs/

# Folder that has CTRE Phoenix Sim device config storage
ctre_sim/

# clangd
/.cache
compile_commands.json

# Eclipse generated file for annotation processors
.factorypath
4 changes: 2 additions & 2 deletions .wpilib/wpilib_preferences.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"currentLanguage": "java",
"enableCppIntellisense": false,
"projectYear": "2024",
"currentLanguage": "java",
"projectYear": "2025",
"teamNumber": 2508
}
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) [2024] [Armada 2508]
Copyright (c) [2024-2025] [Armada 2508]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
9 changes: 8 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id "java"
id "edu.wpi.first.GradleRIO" version "2024.3.2"
id "edu.wpi.first.GradleRIO" version "2025.2.1"
id 'com.diffplug.spotless' version '6.25.0'
}

Expand All @@ -14,6 +14,7 @@ repositories {
}

dependencies {
annotationProcessor wpi.java.deps.wpilibAnnotations()
implementation wpi.java.deps.wpilib()
implementation wpi.java.vendor.java()

Expand All @@ -23,6 +24,7 @@ dependencies {

test {
useJUnitPlatform()
systemProperty 'junit.jupiter.extensions.autodetection.enabled', 'true'
ignoreFailures = true // Don't fail builds or deploys because of failing tests
}

Expand Down Expand Up @@ -53,3 +55,8 @@ spotless {
endWithNewline()
}
}

// Configure string concat to always inline compile
tasks.withType(JavaCompile) {
options.compilerArgs.add '-XDstringConcat=inline'
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=permwrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
7 changes: 5 additions & 2 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 12 additions & 10 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

82 changes: 39 additions & 43 deletions src/main/java/frc/robot/lib/logging/LogUtil.java
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
package frc.robot.lib.logging;

import java.lang.reflect.Field;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;

import edu.wpi.first.networktables.BooleanSubscriber;
import edu.wpi.first.networktables.BooleanTopic;
import edu.wpi.first.networktables.DoubleSubscriber;
import edu.wpi.first.networktables.DoubleTopic;
import edu.wpi.first.networktables.NetworkTableInstance;
import edu.wpi.first.util.datalog.DataLog;
import edu.wpi.first.util.datalog.StringLogEntry;
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.TimedRobot;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.CommandScheduler;
import edu.wpi.first.wpilibj2.command.Commands;
import edu.wpi.first.wpilibj2.command.ParallelCommandGroup;
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
import edu.wpi.first.wpilibj2.command.WrapperCommand;

public class LogUtil {

Expand Down Expand Up @@ -84,44 +81,43 @@ public static BooleanSubscriber getTunableBoolean(String name, boolean defaultVa
return topic.subscribe(defaultValue);
}

static Command getSequentialCommandCurrentCommand(SequentialCommandGroup command) {
try {
final Field fieldIndex = SequentialCommandGroup.class.getDeclaredField("m_currentCommandIndex");
fieldIndex.setAccessible(true);
final Field fieldCommands = SequentialCommandGroup.class.getDeclaredField("m_commands");
fieldCommands.setAccessible(true);
@SuppressWarnings("unchecked")
List<Command> list = (List<Command>) fieldCommands.get(command);
return list.get(fieldIndex.getInt(command));
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
return Commands.none();
}
}

static List<Command> getParallelCommandCurrentCommands(ParallelCommandGroup command) {
try {
List<Command> list = new ArrayList<>();
final Field fieldCommands = ParallelCommandGroup.class.getDeclaredField("m_commands");
fieldCommands.setAccessible(true);
@SuppressWarnings("unchecked")
Map<Command, Boolean> map = (Map<Command, Boolean>) fieldCommands.get(command);
map.forEach((cmd, running) -> {
if (running) list.add(cmd);
});
return list;
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
return List.of(Commands.none());
}
/**
* Logs Driver Station data to NetworkTables. Adds a periodic callback to the given robot.
* @param robot The robot to add the callback to
* Should try to get some of these into DriverStation's FMSInfo or DS datalog
*/
public static void logDriverStation(TimedRobot robot) {
robot.addPeriodic(() -> {
String mode = "Unknown";
if (DriverStation.isTeleop()) {
mode = "Teleop";
}
else if (DriverStation.isAutonomous()) {
mode = "Autonomous";
}
else if (DriverStation.isTest()) {
mode = "Test";
}
var table = NetworkTableInstance.getDefault().getTable("Driver Station");
table.getEntry("DS Mode").setString(mode);
table.getEntry("Robot Enabled").setBoolean(DriverStation.isEnabled());
table.getEntry("Match Time").setDouble(DriverStation.getMatchTime());
table.getEntry("is FMS Attached").setBoolean(DriverStation.isFMSAttached());
}, TimedRobot.kDefaultPeriod);
}

static Command getWrapperCommandInner(WrapperCommand command) {
try {
final Field cmd = WrapperCommand.class.getDeclaredField("m_command");
cmd.setAccessible(true);
return (Command) cmd.get(command);
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
return Commands.none();
}
/**
* Logs command interrupts to NetworkTables and DataLog. Does not have to be called periodically.
*/
public static void logCommandInterrupts(DataLog log) {
CommandScheduler.getInstance().onCommandInterrupt((interruptedCommand, interrupter) -> {
Command interruptingCommand = interrupter.orElseGet(Commands::none);
var commandInterrupt = new StringLogEntry(log, "/Command Scheduler");
var table = NetworkTableInstance.getDefault().getTable("Command Scheduler");
commandInterrupt.append("Command: " + interruptedCommand.getName() + " was interrupted by " + interruptingCommand.getName() + ".");
table.getEntry("Last Interrupted Command").setString(interruptedCommand.getName());
table.getEntry("Last Interrupting Command").setString(interruptingCommand.getName());
});
}

}
9 changes: 0 additions & 9 deletions src/main/java/frc/robot/lib/logging/Loggable.java

This file was deleted.

Loading
Loading