Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/staging' into broom-time
Browse files Browse the repository at this point in the history
  • Loading branch information
quackitsquinn committed Oct 26, 2023
2 parents c0ff0f1 + 02c1c4a commit 25b09a6
Show file tree
Hide file tree
Showing 44 changed files with 173 additions and 176 deletions.
18 changes: 0 additions & 18 deletions .github/workflows/format.yml

This file was deleted.

11 changes: 10 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,14 @@
"editor.detectIndentation": false,
"editor.tabSize": 2,
"editor.insertSpaces": true,
"java.format.settings.url": "https://raw.githubusercontent.com/google/styleguide/gh-pages/eclipse-java-google-style.xmleclipse-formatter.xml",

"files.eol": "\n",

"[java]": {
"spotlessGradle.format.enable": true,
"spotlessGradle.diagnostics.enable": true,
"editor.codeActionsOnSave": {
"source.fixAll.spotlessGradle": true
}
}
}
110 changes: 63 additions & 47 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id "java"
id "edu.wpi.first.GradleRIO" version "2023.1.1"
id "java"
id "edu.wpi.first.GradleRIO" version "2023.1.1"
id "com.diffplug.spotless" version "6.22.0"
}

sourceCompatibility = JavaVersion.VERSION_11
Expand All @@ -11,30 +12,30 @@ 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')) {
}

// Static files artifact
frcStaticFileDeploy(getArtifactTypeClass('FileTreeArtifact')) {
files = project.fileTree('src/main/deploy')
directory = '/home/lvuser/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')) {
}

// Static files artifact
frcStaticFileDeploy(getArtifactTypeClass('FileTreeArtifact')) {
files = project.fileTree('src/main/deploy')
directory = '/home/lvuser/deploy'
}
}
}
}
}

def deployArtifact = deploy.targets.roborio.artifacts.frcJava
Expand All @@ -48,31 +49,31 @@ def includeDesktopSupport = true
// Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries.
// Also defines JUnit 5.
dependencies {
implementation wpi.java.deps.wpilib()
implementation wpi.java.vendor.java()
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)
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)
simulationDebug wpi.sim.enableDebug()
nativeDebug wpi.java.deps.wpilibJniDebug(wpi.platforms.desktop)
nativeDebug wpi.java.vendor.jniDebug(wpi.platforms.desktop)
simulationDebug wpi.sim.enableDebug()

nativeRelease wpi.java.deps.wpilibJniRelease(wpi.platforms.desktop)
nativeRelease wpi.java.vendor.jniRelease(wpi.platforms.desktop)
simulationRelease wpi.sim.enableRelease()
nativeRelease wpi.java.deps.wpilibJniRelease(wpi.platforms.desktop)
nativeRelease wpi.java.vendor.jniRelease(wpi.platforms.desktop)
simulationRelease wpi.sim.enableRelease()

testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.8.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.8.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
}

test {
useJUnitPlatform()
systemProperty 'junit.jupiter.extensions.autodetection.enabled', 'true'
useJUnitPlatform()
systemProperty 'junit.jupiter.extensions.autodetection.enabled', 'true'
}

// Simulation configuration (e.g. environment variables).
Expand All @@ -83,9 +84,9 @@ wpi.sim.addDriverstation()
// in order to make them all available at runtime. Also adding the manifest so WPILib
// knows where to look for our Robot Class.
jar {
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_MAIN_CLASS)
duplicatesStrategy = DuplicatesStrategy.INCLUDE
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_MAIN_CLASS)
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}

// Configure jar and deploy tasks
Expand All @@ -95,5 +96,20 @@ wpi.java.configureTestTasks(test)

// Configure string concat to always inline compile
tasks.withType(JavaCompile) {
options.compilerArgs.add '-XDstringConcat=inline'
options.compilerArgs.add '-XDstringConcat=inline'
}

spotless {
format 'misc', {
target '*.gradle', '.gitignore', '*.txt'
trimTrailingWhitespace()
indentWithTabs()
}

java {
licenseHeader '// Copyright (c) FIRST and other WPILib contributors.\n// Open Source Software; you can modify and/or share it under the terms of\n// the WPILib BSD license file in the root directory of this project.'
removeUnusedImports()
formatAnnotations()
googleJavaFormat().reflowLongStrings()
}
}
46 changes: 23 additions & 23 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import org.gradle.internal.os.OperatingSystem

pluginManagement {
repositories {
mavenLocal()
gradlePluginPortal()
String frcYear = '2023'
File frcHome
if (OperatingSystem.current().isWindows()) {
String publicFolder = System.getenv('PUBLIC')
if (publicFolder == null) {
publicFolder = "C:\\Users\\Public"
}
def homeRoot = new File(publicFolder, "wpilib")
frcHome = new File(homeRoot, frcYear)
} else {
def userFolder = System.getProperty("user.home")
def homeRoot = new File(userFolder, "wpilib")
frcHome = new File(homeRoot, frcYear)
}
def frcHomeMaven = new File(frcHome, 'maven')
maven {
name 'frcHome'
url frcHomeMaven
}
}
repositories {
mavenLocal()
gradlePluginPortal()
String frcYear = '2023'
File frcHome
if (OperatingSystem.current().isWindows()) {
String publicFolder = System.getenv('PUBLIC')
if (publicFolder == null) {
publicFolder = "C:\\Users\\Public"
}
def homeRoot = new File(publicFolder, "wpilib")
frcHome = new File(homeRoot, frcYear)
} else {
def userFolder = System.getProperty("user.home")
def homeRoot = new File(userFolder, "wpilib")
frcHome = new File(homeRoot, frcYear)
}
def frcHomeMaven = new File(frcHome, 'maven')
maven {
name 'frcHome'
url frcHomeMaven
}
}
}
1 change: 0 additions & 1 deletion src/main/java/frc/robot/ArbitraryValues.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.

package frc.robot;

import edu.wpi.first.wpilibj.RobotBase;
Expand Down
22 changes: 21 additions & 1 deletion src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.

package frc.robot;

import frc.robot.positioning.Pose;
Expand Down Expand Up @@ -35,8 +34,10 @@ public static class OperatorConstants {
public static class RobotDimensions {
/** The pose of the robot's center */
public static final Pose CENTER_POSE = new Pose(0, 0, 8.5);

/** The front/back length of the robot's frame in inches */
public static final double FRAME_LENGTH = 29.0;

/** The left/right width of the robot's frame in inches */
public static final double FRAME_WIDTH = 29.0;
}
Expand Down Expand Up @@ -146,10 +147,13 @@ public static class DriveConstants {
public static class Arm {
/** The pose of the arm's base in robot oriented coordinates */
public static final Pose BASE_POSE = new Pose(0, 0, 8.5);

/** The distance between the floor and the arm base in inches */
public static final double BASE_DISTANCE_TO_FLOOR = 8.5;

/** Length in inches from the base of the arm to the shoulder joint */
public static final double BASE_TO_SHOULDER_LENGTH = 19;

/**
* How high above the arm base should we keep the end effector to stop the arm from stabbing the
* robot? This only matters inside the frame perimeter. Distance in inches.
Expand Down Expand Up @@ -231,8 +235,10 @@ public static class I2C {
public static class Limits {
/** Maximum horizontal extension over the frame in inches */
public static final double MAX_FRAME_EXTENSION = 48.0;

/** Maximum extended robot height in inches */
public static final double MAX_EXTENDED_HEIGHT = 78.0;

/** Minimum distance from overextending we want to keep in inches */
public static final double OVEREXTENSION_DANGER_DISTANCE = 4.0;
}
Expand All @@ -245,21 +251,27 @@ public static class ConeNode {
public static class Top {
/** Height of the node in feet */
public static final double HEIGHT = 3.8333;

/** Horizontal distance from the bumper to the node in feet */
public static final double DISTANCE = 3.3125;

/** Height of the reflective tape off the ground in feet */
public static final double TAPE_HEIGHT = 3.4896;

/** The distance from the top of the tape to the top of the node */
public static final double ABOVE_TAPE = 0.0156;
}

public static class Middle {
/** Height of the node in feet */
public static final double HEIGHT = 2.8333;

/** Horizontal distance from the bumper to the node in feet */
public static final double DISTANCE = 1.8958;

/** Height of the reflective tape off the ground in feet */
public static final double TAPE_HEIGHT = 1.8438;

/** The distance from the top of the tape to the top of the node */
public static final double ABOVE_TAPE = 0.6667;
}
Expand All @@ -268,13 +280,15 @@ public static class CubeNode {
public static class Top {
/** Height of the node in feet */
public static final double HEIGHT = 2.9583;

/** Horizontal distance from the bumper to the middle of the node in feet */
public static final double DISTANCE = 3.3125;
}

public static class Middle {
/** Height of the node in feet */
public static final double HEIGHT = 1.9583;

/** Horizontal distance from the bumper to the middle of the node in feet */
public static final double DISTANCE = 1.8958;
}
Expand All @@ -286,21 +300,27 @@ public static class Objects {
public static class Cone {
/** Height in inches */
public static final double HEIGHT = 12.8125;

/** Width of the square base in inches */
public static final double WIDTH = 8.375;

/** Diameter of the bottom of the cone */
public static final double BOTTOM_DIAMETER = 6.625;

/** Diameter of top bottom of the cone */
public static final double TOP_DIAMETER = 1.75;

/** Average diameter of the cone's grabbable area */
public static final double AVG_DIAMETER = 4.1875;

/** The pressure reading required to securely hold the cone */
public static final double PRESSURE_TO_HOLD = -1;
}

public static class Cube {
/** Side length of a properly inflated cube in inches */
public static final double LENGTH = 9.5;

/** The pressure reading required to securely hold the cube */
public static final double PRESSURE_TO_HOLD = -1;
}
Expand Down
1 change: 0 additions & 1 deletion src/main/java/frc/robot/Main.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.

package frc.robot;

import edu.wpi.first.wpilibj.RobotBase;
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@

// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.

package frc.robot;

import edu.wpi.first.wpilibj.DriverStation;
Expand Down
Loading

0 comments on commit 25b09a6

Please sign in to comment.