Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 5 additions & 1 deletion .run/Build Robot.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="scriptParameters" value="--stacktrace" />
<option name="taskDescriptions">
<list />
</option>
Expand All @@ -17,6 +17,7 @@
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<ExternalSystemDebugDisabled>false</ExternalSystemDebugDisabled>
<EXTENSION ID="com.intellij.execution.ExternalSystemRunConfigurationJavaExtension">
<extension name="net.ashald.envfile">
<option name="IS_ENABLED" value="false" />
Expand All @@ -30,6 +31,9 @@
</extension>
</EXTENSION>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<GradleProfilingDisabled>false</GradleProfilingDisabled>
<GradleCoverageDisabled>false</GradleCoverageDisabled>
<method v="2" />
</configuration>
</component>
2 changes: 1 addition & 1 deletion .wpilib/wpilib_preferences.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"enableCppIntellisense": false,
"currentLanguage": "java",
"projectYear": "2025",
"projectYear": "2027",
"teamNumber": 467
}
148 changes: 78 additions & 70 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,79 +1,84 @@
plugins {
id "java"
id "edu.wpi.first.GradleRIO" version "2026.2.1"
id "org.wpilib.GradleRIO" version "2027.0.0-alpha-7"
id "com.peterabeles.gversion" version "1.10"
id "com.diffplug.spotless" version "6.25.0"
}

wpi.maven.useLocal = false
wpi.maven.useDevelopment = true

wpi.versions.wpilibVersion = providers.gradleProperty('wpilibVersion').orElse('2027.0.0-alpha-7').get()

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_25
targetCompatibility = JavaVersion.VERSION_25
}

def ROBOT_MAIN_CLASS = "frc.robot.Main"

// Define my targets (RoboRIO) and artifacts (deployable files)
// This is added by GradleRIO's backing project DeployUtils.
deploy {
targets {
roborio(getTargetTypeClass('RoboRIO')) {
// Team number is loaded either from the .wpilib/wpilib_preferences.json
// or from command line. If not found an exception will be thrown.
// You can use getTeamOrDefault(team) instead of getTeamNumber if you
// want to store a team number in this file.
team = project.frc.getTeamNumber()
debug = project.frc.getDebugOrDefault(false)

artifacts {
// First part is artifact name, 2nd is artifact type
// getTargetTypeClass is a shortcut to get the class type using a string

frcJava(getArtifactTypeClass('FRCJavaArtifact')) {
jvmArgs.add("-XX:+UnlockExperimentalVMOptions")
jvmArgs.add("-XX:GCTimeRatio=5")
jvmArgs.add("-XX:+UseSerialGC")
jvmArgs.add("-XX:MaxGCPauseMillis=50")

// Heap size is set dynamically in predeploy based on robot type
jvmArgs.add("-XX:+AlwaysPreTouch")

predeploy << { ctx ->
def robotTypeFile = "/home/lvuser/robot"
def result = ctx.execute("cat " + robotTypeFile)
def robotType = result.result.trim()
println "Detected robot type: " + robotType

def heapSize = 100
if (robotType == "ROBOT_BRIEFCASE") {
heapSize = 10
println "Using reduced heap size for ROBOT_BRIEFCASE: " + heapSize + "MB"
} else {
println "Using default heap size: " + heapSize + "MB"
def roborioTargetType = deploy.getTargetTypeClass('RoboRIO')
def deployArtifact = null
if (roborioTargetType != null) {
deploy {
targets {
roborio(roborioTargetType) {
// Team number is loaded either from the .wpilib/wpilib_preferences.json
// or from command line. If not found an exception will be thrown.
// You can use getTeamOrDefault(team) instead of getTeamNumber if you
// want to store a team number in this file.
team = project.frc.getTeamNumber()
debug = project.frc.getDebugOrDefault(false)

artifacts {
// First part is artifact name, 2nd is artifact type
// getTargetTypeClass is a shortcut to get the class type using a string

frcJava(getArtifactTypeClass('FRCJavaArtifact')) {
jvmArgs.add("-XX:+UnlockExperimentalVMOptions")
jvmArgs.add("-XX:GCTimeRatio=5")
jvmArgs.add("-XX:+UseSerialGC")
jvmArgs.add("-XX:MaxGCPauseMillis=50")

// Heap size is set dynamically in predeploy based on robot type
jvmArgs.add("-XX:+AlwaysPreTouch")

predeploy << { ctx ->
def robotTypeFile = "/home/lvuser/robot"
def result = ctx.execute("cat " + robotTypeFile)
def robotType = result.result.trim()
println "Detected robot type: " + robotType

def heapSize = 100
if (robotType == "ROBOT_BRIEFCASE") {
heapSize = 10
println "Using reduced heap size for ROBOT_BRIEFCASE: " + heapSize + "MB"
} else {
println "Using default heap size: " + heapSize + "MB"
}

jvmArgs.add("-Xmx" + heapSize + "M")
jvmArgs.add("-Xms" + heapSize + "M")
}

jvmArgs.add("-Xmx" + heapSize + "M")
jvmArgs.add("-Xms" + heapSize + "M")
}
}

// Static files artifact
frcStaticFileDeploy(getArtifactTypeClass('FileTreeArtifact')) {
files = project.fileTree('src/main/deploy')
directory = '/home/lvuser/deploy'
// Change to true to delete files on roboRIO that no
// longer exist in deploy directory on roboRIO
deleteOldFiles = false
// Static files artifact
frcStaticFileDeploy(getArtifactTypeClass('FileTreeArtifact')) {
files = project.fileTree('src/main/deploy')
directory = '/home/lvuser/deploy'
// Change to true to delete files on roboRIO that no
// longer exist in deploy directory on roboRIO
deleteOldFiles = false
}
}
}
}
deployArtifact = deploy.targets.roborio.artifacts.frcJava
}
}

def deployArtifact = deploy.targets.roborio.artifacts.frcJava

// Set to true to use debug for JNI.
wpi.java.debugJni = false

// Set this to true to enable desktop support.
def includeDesktopSupport = true

Expand All @@ -90,11 +95,13 @@ dependencies {
implementation wpi.java.deps.wpilib()
implementation wpi.java.vendor.java()

roborioDebug wpi.java.deps.wpilibJniDebug(wpi.platforms.roborio)
roborioDebug wpi.java.vendor.jniDebug(wpi.platforms.roborio)
if (roborioTargetType != null) {
roborioDebug wpi.java.deps.wpilibJniDebug(wpi.platforms.roborio)
roborioDebug wpi.java.vendor.jniDebug(wpi.platforms.roborio)

roborioRelease wpi.java.deps.wpilibJniRelease(wpi.platforms.roborio)
roborioRelease wpi.java.vendor.jniRelease(wpi.platforms.roborio)
roborioRelease wpi.java.deps.wpilibJniRelease(wpi.platforms.roborio)
roborioRelease wpi.java.vendor.jniRelease(wpi.platforms.roborio)
}

nativeDebug wpi.java.deps.wpilibJniDebug(wpi.platforms.desktop)
nativeDebug wpi.java.vendor.jniDebug(wpi.platforms.desktop)
Expand All @@ -104,15 +111,12 @@ dependencies {
nativeRelease wpi.java.vendor.jniRelease(wpi.platforms.desktop)
simulationRelease wpi.sim.enableRelease()

compileOnly 'org.projectlombok:lombok:1.18.30'
annotationProcessor 'org.projectlombok:lombok:1.18.30'
compileOnly 'org.projectlombok:lombok:1.18.44'
annotationProcessor 'org.projectlombok:lombok:1.18.44'

testImplementation 'org.junit.jupiter:junit-jupiter:5.10.1'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'

compileOnly 'org.projectlombok:lombok:1.18.30'
annotationProcessor 'org.projectlombok:lombok:1.18.30'

def akitJson = new groovy.json.JsonSlurper().parseText(new File(projectDir.getAbsolutePath() + "/vendordeps/AdvantageKit.json").text)
annotationProcessor "org.littletonrobotics.akit:akit-autolog:$akitJson.version"
}
Expand Down Expand Up @@ -141,14 +145,16 @@ jar {
}
}
from sourceSets.main.allSource
manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_MAIN_CLASS)
manifest org.wpilib.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_MAIN_CLASS)
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}

// Configure jar and deploy tasks
deployArtifact.jarTask = jar
wpi.java.configureExecutableTasks(jar)
wpi.java.configureTestTasks(test)
if (deployArtifact != null) {
deployArtifact.jarTask = jar
}
// IMPORTANT: wpi.java.configureExecutableTasks(jar)
// IMPORTANT: wpi.java.configureTestTasks(test)

// Configure string concat to always inline compile
tasks.withType(JavaCompile) {
Expand All @@ -160,7 +166,9 @@ task(checkRobot, dependsOn: "classes", type: JavaExec) {
mainClass = "frc.robot.Constants"
classpath = sourceSets.main.runtimeClasspath
}
deployroborio.dependsOn(checkRobot)
if (deployArtifact != null) {
deployroborio.dependsOn(checkRobot)
}

// Create version file
project.compileJava.dependsOn(createVersionFile)
Expand Down Expand Up @@ -206,8 +214,8 @@ task(eventDeploy) {
}
createVersionFile.dependsOn(eventDeploy)

// Spotless formatting
project.compileJava.dependsOn(spotlessApply)
// Spotless formatting (disabled for 2027 experimental)
// project.compileJava.dependsOn(spotlessApply)
spotless {
java {
target fileTree(".") {
Expand Down
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.10-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
17 changes: 17 additions & 0 deletions src/main/java/frc/lib/SubsystemBase.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package frc.lib;

import org.wpilib.command3.Coroutine;
import org.wpilib.command3.Mechanism;
import org.wpilib.command3.NeedsNameBuilderStage;
import org.wpilib.command3.StagedCommandBuilder;
import java.util.function.Consumer;

public abstract class SubsystemBase implements Mechanism {
public NeedsNameBuilderStage run(Consumer<Coroutine> commandBody) {
return new StagedCommandBuilder().requiring(this).executing(
commandBody.andThen(_ -> periodic())
);
}

public abstract void periodic();
}
8 changes: 4 additions & 4 deletions src/main/java/frc/lib/characterization/SysIdFactory.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package frc.lib.characterization;

import edu.wpi.first.units.measure.Voltage;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.Subsystem;
import edu.wpi.first.wpilibj2.command.sysid.SysIdRoutine;
import org.wpilib.units.measure.Voltage;
import org.wpilib.command2.Command;
import org.wpilib.command2.Subsystem;
import org.wpilib.command2.sysid.SysIdRoutine;
import java.util.function.Consumer;
import org.littletonrobotics.junction.Logger;

Expand Down
14 changes: 7 additions & 7 deletions src/main/java/frc/lib/utils/AllianceFlipUtil.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package frc.lib.utils;

import edu.wpi.first.math.geometry.Pose2d;
import edu.wpi.first.math.geometry.Pose3d;
import edu.wpi.first.math.geometry.Rotation2d;
import edu.wpi.first.math.geometry.Rotation3d;
import edu.wpi.first.math.geometry.Translation2d;
import edu.wpi.first.math.geometry.Translation3d;
import edu.wpi.first.wpilibj.DriverStation;
import org.wpilib.math.geometry.Pose2d;
import org.wpilib.math.geometry.Pose3d;
import org.wpilib.math.geometry.Rotation2d;
import org.wpilib.math.geometry.Rotation3d;
import org.wpilib.math.geometry.Translation2d;
import org.wpilib.math.geometry.Translation3d;
import org.wpilib.driverstation.DriverStation;
import frc.robot.FieldConstants;

/**
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/frc/lib/utils/GeomUtils.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package frc.lib.utils;

import edu.wpi.first.math.geometry.Pose2d;
import edu.wpi.first.math.geometry.Rotation2d;
import edu.wpi.first.math.geometry.Transform2d;
import edu.wpi.first.math.geometry.Translation2d;
import edu.wpi.first.math.geometry.Twist2d;
import org.wpilib.math.geometry.Pose2d;
import org.wpilib.math.geometry.Rotation2d;
import org.wpilib.math.geometry.Transform2d;
import org.wpilib.math.geometry.Translation2d;
import org.wpilib.math.geometry.Twist2d;

public class GeomUtils {

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/frc/lib/utils/LocalADStarAK.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import com.pathplanner.lib.path.PathPoint;
import com.pathplanner.lib.pathfinding.LocalADStar;
import com.pathplanner.lib.pathfinding.Pathfinder;
import edu.wpi.first.math.Pair;
import edu.wpi.first.math.geometry.Translation2d;
import org.wpilib.math.util.Pair;
import org.wpilib.math.geometry.Translation2d;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package frc.robot;

import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.RobotBase;
import org.wpilib.driverstation.DriverStation;
import org.wpilib.framework.RobotBase;
import org.wpilib.math.util.Units;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.Map;

public class Constants {
public static final double SLOW_SPEED = Units.inchesToMeters(20);

// Change this temporarily to override the RobotType, e.g. RobotType.ROBOT_SIMBOT
private static final RobotType ROBOT_TYPE_OVERRIDE = null;
public static final boolean tuningMode = false;
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/frc/robot/FieldConstants.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package frc.robot;

import com.fasterxml.jackson.databind.ObjectMapper;
import edu.wpi.first.apriltag.AprilTagFieldLayout;
import edu.wpi.first.math.geometry.Pose2d;
import edu.wpi.first.math.geometry.Translation2d;
import edu.wpi.first.math.geometry.Translation3d;
import edu.wpi.first.math.util.Units;
import edu.wpi.first.wpilibj.Filesystem;
import org.wpilib.vision.apriltag.AprilTagFieldLayout;
import org.wpilib.math.geometry.Pose2d;
import org.wpilib.math.geometry.Translation2d;
import org.wpilib.math.geometry.Translation3d;
import org.wpilib.math.util.Units;
import org.wpilib.system.Filesystem;
import java.io.IOException;
import java.nio.file.Path;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

package frc.robot;

import edu.wpi.first.wpilibj.RobotBase;
import org.wpilib.framework.RobotBase;

/**
* Do NOT add any static variables to this class, or any initialization at all. Unless you know what
Expand Down
Loading
Loading