Skip to content

Commit

Permalink
Merge branch 'dev' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
katzuv authored Jan 19, 2025
2 parents b7db809 + 6af1735 commit b6936b3
Show file tree
Hide file tree
Showing 101 changed files with 3,652 additions and 1,157 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Adapted from WPILib docs: https://docs.wpilib.org/en/stable/docs/software/advanced-gradlerio/robot-code-ci.html

name: Build, tests, formatting

# Controls when the action will run. Triggers the workflow on pull request events.
on:
pull_request

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Grab the WPILib docker container
container: wpilib/roborio-cross-ubuntu:2025-22.04

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Check-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4

# Declare the repository safe and not under dubious ownership.
- name: Add repository to git safe directories
run: git config --global --add safe.directory $GITHUB_WORKSPACE

# Grant execute permission for gradlew
- name: Grant execute permission for gradlew
run: chmod +x gradlew

# Run Gradle commands
- name: Check that the code builds
run: ./gradlew compileKotlin compileJava

- name: Run tests
run: ./gradlew test

- name: Check formatting
run: ./gradlew spotlessCheck
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ annotation/build/
# Simulation GUI and other tools window save file
*-window.json

BuildConstants.java
/src/main/kotlin/frc/robot/BuildConstants.java

simgui*
networktables.json
Expand Down
194 changes: 97 additions & 97 deletions AdvantageKit-License.md

Large diffs are not rendered by default.

85 changes: 61 additions & 24 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
id "java"
id "org.jetbrains.kotlin.jvm" version "2.0.0"
id "edu.wpi.first.GradleRIO" version "2025.1.1-beta-2"
id "edu.wpi.first.GradleRIO" version "2025.2.1"
id "com.diffplug.spotless" version "6.12.0"
id "com.peterabeles.gversion" version "1.10"
id 'com.google.devtools.ksp' version '2.0.0-1.0.21'
Expand Down Expand Up @@ -49,23 +49,25 @@ deploy {
// getTargetTypeClass is a shortcut to get the class type using a string

frcJava(getArtifactTypeClass('FRCJavaArtifact')) {
// https://www.chiefdelphi.com/t/2024-wpilib-feedback/464322/141
final MAX_JAVA_HEAP_SIZE_MB = 100;
jvmArgs.add("-XX:+UnlockExperimentalVMOptions")

// Set the minimum heap size to the maximum heap size to avoid resizing
jvmArgs.add("-Xmx" + MAX_JAVA_HEAP_SIZE_MB + "M")
jvmArgs.add("-Xms" + MAX_JAVA_HEAP_SIZE_MB + "M")
jvmArgs.add("-XX:GCTimeRatio=5")
jvmArgs.add("-XX:+UseSerialGC")
jvmArgs.add("-XX:MaxGCPauseMillis=50")

// Enable VisualVM connection
jvmArgs.add("-Dcom.sun.management.jmxremote=true")
jvmArgs.add("-Dcom.sun.management.jmxremote.port=1198")
jvmArgs.add("-Dcom.sun.management.jmxremote.local.only=false")
jvmArgs.add("-Dcom.sun.management.jmxremote.ssl=false")
jvmArgs.add("-Dcom.sun.management.jmxremote.authenticate=false")
jvmArgs.add("-Djava.rmi.server.hostname=10.59.87.2") // Replace TE.AM with team number

// The options below may improve performance, but should only be enabled on the RIO 2
//
final MAX_JAVA_HEAP_SIZE_MB = 100;
jvmArgs.add("-Xmx" + MAX_JAVA_HEAP_SIZE_MB + "M")
jvmArgs.add("-Xms" + MAX_JAVA_HEAP_SIZE_MB + "M")
jvmArgs.add("-XX:+AlwaysPreTouch")
}

// Static files artifact
Expand All @@ -90,18 +92,9 @@ wpi.java.debugJni = false
def includeDesktopSupport = true

// Configuration for AdvantageKit
repositories {
maven {
url = uri("https://maven.pkg.github.com/Mechanical-Advantage/AdvantageKit")
credentials {
username = "Mechanical-Advantage-Bot"
password = "\u0067\u0068\u0070\u005f\u006e\u0056\u0051\u006a\u0055\u004f\u004c\u0061\u0079\u0066\u006e\u0078\u006e\u0037\u0051\u0049\u0054\u0042\u0032\u004c\u004a\u006d\u0055\u0070\u0073\u0031\u006d\u0037\u004c\u005a\u0030\u0076\u0062\u0070\u0063\u0051"
}
}
maven {
url 'https://jitpack.io'
}
mavenCentral()
task(replayWatch, type: JavaExec) {
mainClass = "org.littletonrobotics.junction.ReplayWatch"
classpath = sourceSets.main.runtimeClasspath
}

// Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries.
Expand Down Expand Up @@ -147,16 +140,16 @@ sourceSets {
main {
java {
srcDirs = [
'src/main/java',
'src/main/kotlin'
'src/main/java',
'src/main/kotlin'
]
}
}
test {
java {
srcDirs = [
'src/test/java',
'src/test/kotlin'
'src/test/java',
'src/test/kotlin'
]
}
}
Expand All @@ -168,6 +161,11 @@ test {
}

// Simulation configuration (e.g. environment variables).
//
// The sim GUI is *disabled* by default to support running
// AdvantageKit log replay from the command line. Set the
// value to "true" to enable the sim GUI by default (this
// is the standard WPILib behavior).
wpi.sim.addGui().defaultEnabled = true
wpi.sim.addDriverstation()

Expand Down Expand Up @@ -230,6 +228,40 @@ idea {
}
}

// Create commit with working changes on event branches
task(eventDeploy) {
doLast {
if (project.gradle.startParameter.taskNames.any({ it.toLowerCase().contains("deploy") })) {
def branchPrefix = "event"
def branch = 'git branch --show-current'.execute().text.trim()
def commitMessage = "Update at '${new Date().toString()}'"

if (branch.startsWith(branchPrefix)) {
exec {
workingDir(projectDir)
executable 'git'
args 'add', '-A'
}
exec {
workingDir(projectDir)
executable 'git'
args 'commit', '-m', commitMessage
ignoreExitValue = true
}

println "Committed to branch: '$branch'"
println "Commit message: '$commitMessage'"
} else {
println "Not on an event branch, skipping commit"
}
} else {
println "Not running deploy task, skipping commit"
}
}
}
createVersionFile.dependsOn(eventDeploy)

//spotless formatting
spotless {
format 'misc', {
// define the files to apply `misc` to
Expand All @@ -253,6 +285,11 @@ spotless {
kotlin {
targetExclude('build/')

ktlint()
ktfmt().googleStyle().configure {
it.setBlockIndent(4)
it.setContinuationIndent(4)
it.setMaxWidth(80)
it.setRemoveUnusedImport(true)
}
}
}
115 changes: 115 additions & 0 deletions files/cad/Robot_2025Bot/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
{
"name": "2025Bot",
"disableSimplification": true,
"rotations": [
{
"axis": "x",
"degrees": 90
},
{
"axis": "z",
"degrees": -90
}
],
"position": [
0,
0,
0.05545625
],
"cameras": [],
"components": [
{
"zeroedRotations": [
{
"axis": "x",
"degrees": 90
},
{
"axis": "z",
"degrees": 90
}
],
"zeroedPosition": [
0,
0,
0.05545625
]
},
{
"zeroedRotations": [
{
"axis": "x",
"degrees": 90
},
{
"axis": "z",
"degrees": -90
}
],
"zeroedPosition": [
-0.65,
0,
-0.48
]
},
{
"zeroedRotations": [
{
"axis": "x",
"degrees": 90
},
{
"axis": "z",
"degrees": -90
}
],
"zeroedPosition": [
-0.65,
0,
0.0
]
},
{
"zeroedRotations": [
{
"axis": "x",
"degrees": -90
},
{
"axis": "z",
"degrees": -90
},
{
"axis": "y",
"degrees": 180
}
],
"zeroedPosition": [
-0.79,
0,
-0.84
]
},
{
"zeroedRotations": [
{
"axis": "x",
"degrees": -90
},
{
"axis": "z",
"degrees": -90
},
{
"axis": "y",
"degrees": 180
}
],
"zeroedPosition": [
0,
0,
0.05
]
}
]
}
Binary file added files/cad/Robot_2025Bot/model.glb
Binary file not shown.
Binary file added files/cad/Robot_2025Bot/model_0.glb
Binary file not shown.
Binary file added files/cad/Robot_2025Bot/model_1.glb
Binary file not shown.
Binary file added files/cad/Robot_2025Bot/model_2.glb
Binary file not shown.
Binary file added files/cad/Robot_2025Bot/model_3.glb
Binary file not shown.
Binary file added files/cad/Robot_2025Bot/model_4.glb
Binary file not shown.
Loading

0 comments on commit b6936b3

Please sign in to comment.