diff --git a/.github/workflows/gradle-build.yml b/.github/workflows/gradle-build.yml new file mode 100644 index 0000000..50ee8e3 --- /dev/null +++ b/.github/workflows/gradle-build.yml @@ -0,0 +1,59 @@ +# Gradle workflow to build the current project and generate a dependency graph for Dependabot Alerts. + +name: Gradle Dependencies and Build + +on: + push: + branches: [ "2025MainBranch" ] # Change to "main" when merged + pull_request: + branches: [ "2025MainBranch" ] # Change to "main" when merged + +jobs: + build: + + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - uses: actions/checkout@v4 + # Set up Java 17 JDK since the WPILib provided one isn't installed on this runner + # This will most likely change for a self-hosted runner + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + # Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies. + # See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md + - name: Setup Gradle + uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 + + - name: Build with Gradle Wrapper + # Set the working directory so gradlew and WPILib are in the right folder + # This will be removed in the future whenever this project is in the root folder + working-directory: ./2024-2025/main-bot + run: ./gradlew build + + dependency-submission: + + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - uses: actions/checkout@v4 + + # Set up Java 17 JDK since the WPILib provided one isn't installed on this runner + # This will most likely change for a self-hosted runner + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + # Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies. + # See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md + - name: Generate and submit dependency graph + uses: gradle/actions/dependency-submission@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 diff --git a/.github/workflows/superlinter.yml b/.github/workflows/superlinter.yml deleted file mode 100644 index a20e4e9..0000000 --- a/.github/workflows/superlinter.yml +++ /dev/null @@ -1,29 +0,0 @@ ---- -name: Super-Linter - -on: push - -jobs: - super-lint: - name: Super-Linter - runs-on: - - self-hosted - - Primary - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Run Super-Linter - uses: github/super-linter@v5 - env: - # Testing multiple folders and files - # Files to ignore: - # - gradlew - # - .gradle - # - WPILib-License.md - # Folders to ignore: - # - 2022-2023 - # - vendordeps - FILTER_REGEX_EXCLUDE: ".*2022-2023/.*|.*vendordeps/.*|.*gradlew|.*.gradle|.*WPILib-License.md.*" - DEFAULT_BRANCH: main - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/wpilib-build.yml b/.github/workflows/wpilib-build.yml deleted file mode 100644 index c866985..0000000 --- a/.github/workflows/wpilib-build.yml +++ /dev/null @@ -1,36 +0,0 @@ ---- -name: Build - -on: push - -jobs: - Build-Latest: - runs-on: - - self-hosted - - Primary - steps: - # Check out the code so the action can use it - - name: Checkout code - uses: actions/checkout@v4 - - - name: Build 2023-2024 - # Set the working directory so gradlew and WPILib are in the right folder - working-directory: ./2023-2024/main-bot - # Run gradlew to build the robot code with java home being what it is set to during manual runtime - # This machine should have Java 17 installed which is what WPILib is using for building with 2024 - run: ./gradlew build - Build-2022-2023: - runs-on: - - self-hosted - - Primary - steps: - # Check out the code so the action can use it - - name: Checkout code - uses: actions/checkout@v4 - - - name: Build 2022-2023 - working-directory: ./2022-2023/main-bot - run: ./gradlew build - - -# I have no idea if this will work but this is just to test to see if it's possible and to get used to using actions diff --git a/.gitignore b/.gitignore index 4835bef..a0a205e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,10 @@ # .gitignore # Ingore File For Git +*.gradle/ +*.wpilib/ +*bin/ + # -----=====[ IDEs ]=====----- # # VSCode @@ -148,9 +152,37 @@ dmypy.json # Pyre type checker .pyre/ +# -----=====[ Java ]=====----- # +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* +replay_pid* + # -----=====[ Misc ]=====----- # # MacOS Finder Cache # >:( *.DS_Store - +*.dat +*.hoot +*.lock \ No newline at end of file diff --git a/2022-2023/main-bot/.gradle/7.5.1/checksums/checksums.lock b/2022-2023/main-bot/.gradle/7.5.1/checksums/checksums.lock deleted file mode 100755 index d17e810..0000000 Binary files a/2022-2023/main-bot/.gradle/7.5.1/checksums/checksums.lock and /dev/null differ diff --git a/2022-2023/main-bot/.gradle/7.5.1/checksums/md5-checksums.bin b/2022-2023/main-bot/.gradle/7.5.1/checksums/md5-checksums.bin deleted file mode 100755 index 2f8a567..0000000 Binary files a/2022-2023/main-bot/.gradle/7.5.1/checksums/md5-checksums.bin and /dev/null differ diff --git a/2022-2023/main-bot/.gradle/7.5.1/checksums/sha1-checksums.bin b/2022-2023/main-bot/.gradle/7.5.1/checksums/sha1-checksums.bin deleted file mode 100755 index f874a97..0000000 Binary files a/2022-2023/main-bot/.gradle/7.5.1/checksums/sha1-checksums.bin and /dev/null differ diff --git a/2022-2023/main-bot/.gradle/7.5.1/dependencies-accessors/dependencies-accessors.lock b/2022-2023/main-bot/.gradle/7.5.1/dependencies-accessors/dependencies-accessors.lock deleted file mode 100755 index 4e31113..0000000 Binary files a/2022-2023/main-bot/.gradle/7.5.1/dependencies-accessors/dependencies-accessors.lock and /dev/null differ diff --git a/2022-2023/main-bot/.gradle/7.5.1/executionHistory/executionHistory.bin b/2022-2023/main-bot/.gradle/7.5.1/executionHistory/executionHistory.bin deleted file mode 100755 index b53bfdc..0000000 Binary files a/2022-2023/main-bot/.gradle/7.5.1/executionHistory/executionHistory.bin and /dev/null differ diff --git a/2022-2023/main-bot/.gradle/7.5.1/executionHistory/executionHistory.lock b/2022-2023/main-bot/.gradle/7.5.1/executionHistory/executionHistory.lock deleted file mode 100755 index a8b1257..0000000 Binary files a/2022-2023/main-bot/.gradle/7.5.1/executionHistory/executionHistory.lock and /dev/null differ diff --git a/2022-2023/main-bot/.gradle/7.5.1/fileChanges/last-build.bin b/2022-2023/main-bot/.gradle/7.5.1/fileChanges/last-build.bin deleted file mode 100755 index f76dd23..0000000 Binary files a/2022-2023/main-bot/.gradle/7.5.1/fileChanges/last-build.bin and /dev/null differ diff --git a/2022-2023/main-bot/.gradle/7.5.1/fileHashes/fileHashes.bin b/2022-2023/main-bot/.gradle/7.5.1/fileHashes/fileHashes.bin deleted file mode 100755 index 1b0c1b1..0000000 Binary files a/2022-2023/main-bot/.gradle/7.5.1/fileHashes/fileHashes.bin and /dev/null differ diff --git a/2022-2023/main-bot/.gradle/7.5.1/fileHashes/fileHashes.lock b/2022-2023/main-bot/.gradle/7.5.1/fileHashes/fileHashes.lock deleted file mode 100755 index a69daf0..0000000 Binary files a/2022-2023/main-bot/.gradle/7.5.1/fileHashes/fileHashes.lock and /dev/null differ diff --git a/2022-2023/main-bot/.gradle/7.5.1/fileHashes/resourceHashesCache.bin b/2022-2023/main-bot/.gradle/7.5.1/fileHashes/resourceHashesCache.bin deleted file mode 100755 index 7df2b98..0000000 Binary files a/2022-2023/main-bot/.gradle/7.5.1/fileHashes/resourceHashesCache.bin and /dev/null differ diff --git a/2022-2023/main-bot/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/2022-2023/main-bot/.gradle/buildOutputCleanup/buildOutputCleanup.lock deleted file mode 100755 index f4c0a08..0000000 Binary files a/2022-2023/main-bot/.gradle/buildOutputCleanup/buildOutputCleanup.lock and /dev/null differ diff --git a/2022-2023/main-bot/.gradle/buildOutputCleanup/outputFiles.bin b/2022-2023/main-bot/.gradle/buildOutputCleanup/outputFiles.bin deleted file mode 100755 index eae504c..0000000 Binary files a/2022-2023/main-bot/.gradle/buildOutputCleanup/outputFiles.bin and /dev/null differ diff --git a/2022-2023/main-bot/bin/main/frc/components/SwerveDrive.class b/2022-2023/main-bot/bin/main/frc/components/SwerveDrive.class index b0bfedf..084cf57 100644 Binary files a/2022-2023/main-bot/bin/main/frc/components/SwerveDrive.class and b/2022-2023/main-bot/bin/main/frc/components/SwerveDrive.class differ diff --git a/2022-2023/main-bot/bin/main/frc/components/autonomous/DriveState2.class b/2022-2023/main-bot/bin/main/frc/components/autonomous/DriveState2.class index 08983c3..60593cc 100644 Binary files a/2022-2023/main-bot/bin/main/frc/components/autonomous/DriveState2.class and b/2022-2023/main-bot/bin/main/frc/components/autonomous/DriveState2.class differ diff --git a/2022-2023/main-bot/bin/main/frc/components/autonomous/DriveState3.class b/2022-2023/main-bot/bin/main/frc/components/autonomous/DriveState3.class index 4ebecb7..70794fc 100644 Binary files a/2022-2023/main-bot/bin/main/frc/components/autonomous/DriveState3.class and b/2022-2023/main-bot/bin/main/frc/components/autonomous/DriveState3.class differ diff --git a/2022-2023/main-bot/bin/main/frc/robot/Utility.class b/2022-2023/main-bot/bin/main/frc/robot/Utility.class index f9d72fb..5dde4a6 100644 Binary files a/2022-2023/main-bot/bin/main/frc/robot/Utility.class and b/2022-2023/main-bot/bin/main/frc/robot/Utility.class differ diff --git a/2022-2023/main-bot/gradle/wrapper/gradle-wrapper.jar b/2022-2023/main-bot/gradle/wrapper/gradle-wrapper.jar deleted file mode 100755 index 249e583..0000000 Binary files a/2022-2023/main-bot/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/2023-2024/main-bot/gradle/wrapper/gradle-wrapper.jar b/2023-2024/main-bot/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 7f93135..0000000 Binary files a/2023-2024/main-bot/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/2024-2025/FreshmanProjectBots/DontOverthinkIt/.wpilib/wpilib_preferences.json b/2024-2025/FreshmanProjectBots/DontOverthinkIt/.wpilib/wpilib_preferences.json new file mode 100644 index 0000000..a5ebb07 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/DontOverthinkIt/.wpilib/wpilib_preferences.json @@ -0,0 +1,6 @@ +{ + "enableCppIntellisense": false, + "currentLanguage": "java", + "projectYear": "2024", + "teamNumber": 5098 +} \ No newline at end of file diff --git a/2024-2025/FreshmanProjectBots/DontOverthinkIt/WPILib-License.md b/2024-2025/FreshmanProjectBots/DontOverthinkIt/WPILib-License.md new file mode 100644 index 0000000..e7cd597 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/DontOverthinkIt/WPILib-License.md @@ -0,0 +1,24 @@ +Copyright (c) 2009-2024 FIRST and other WPILib contributors +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of FIRST, WPILib, nor the names of other WPILib + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY FIRST AND OTHER WPILIB CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY NONINFRINGEMENT AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL FIRST OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/2024-2025/FreshmanProjectBots/DontOverthinkIt/build.gradle b/2024-2025/FreshmanProjectBots/DontOverthinkIt/build.gradle new file mode 100644 index 0000000..1e8da00 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/DontOverthinkIt/build.gradle @@ -0,0 +1,101 @@ +plugins { + id "java" + id "edu.wpi.first.GradleRIO" version "2024.2.1" +} + +java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 +} + +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' + } + } + } + } +} + +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 = false + +// 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() + + 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) + + 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() + + testImplementation 'org.junit.jupiter:junit-jupiter:5.10.1' + testRuntimeOnly 'org.junit.platform:junit-platform-launcher' +} + +test { + useJUnitPlatform() + systemProperty 'junit.jupiter.extensions.autodetection.enabled', 'true' +} + +// Simulation configuration (e.g. environment variables). +wpi.sim.addGui().defaultEnabled = true +wpi.sim.addDriverstation() + +// Setting up my Jar File. In this case, adding all libraries into the main jar ('fat jar') +// 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) } } + from sourceSets.main.allSource + manifest edu.wpi.first.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) + +// Configure string concat to always inline compile +tasks.withType(JavaCompile) { + options.compilerArgs.add '-XDstringConcat=inline' +} diff --git a/2024-2025/FreshmanProjectBots/DontOverthinkIt/gradle/wrapper/gradle-wrapper.properties b/2024-2025/FreshmanProjectBots/DontOverthinkIt/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..7015f6b --- /dev/null +++ b/2024-2025/FreshmanProjectBots/DontOverthinkIt/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=permwrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=permwrapper/dists diff --git a/2024-2025/FreshmanProjectBots/DontOverthinkIt/gradlew b/2024-2025/FreshmanProjectBots/DontOverthinkIt/gradlew new file mode 100644 index 0000000..1aa94a4 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/DontOverthinkIt/gradlew @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/2024-2025/FreshmanProjectBots/DontOverthinkIt/gradlew.bat b/2024-2025/FreshmanProjectBots/DontOverthinkIt/gradlew.bat new file mode 100644 index 0000000..6689b85 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/DontOverthinkIt/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/2024-2025/FreshmanProjectBots/DontOverthinkIt/settings.gradle b/2024-2025/FreshmanProjectBots/DontOverthinkIt/settings.gradle new file mode 100644 index 0000000..3e30f84 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/DontOverthinkIt/settings.gradle @@ -0,0 +1,30 @@ +import org.gradle.internal.os.OperatingSystem + +pluginManagement { + repositories { + mavenLocal() + gradlePluginPortal() + String frcYear = '2024' + 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 + } + } +} + +Properties props = System.getProperties(); +props.setProperty("org.gradle.internal.native.headers.unresolved.dependencies.ignore", "true"); diff --git a/2024-2025/FreshmanProjectBots/DontOverthinkIt/src/main/deploy/example.txt b/2024-2025/FreshmanProjectBots/DontOverthinkIt/src/main/deploy/example.txt new file mode 100644 index 0000000..bb82515 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/DontOverthinkIt/src/main/deploy/example.txt @@ -0,0 +1,3 @@ +Files placed in this directory will be deployed to the RoboRIO into the +'deploy' directory in the home folder. Use the 'Filesystem.getDeployDirectory' wpilib function +to get a proper path relative to the deploy directory. \ No newline at end of file diff --git a/2024-2025/FreshmanProjectBots/DontOverthinkIt/src/main/java/frc/Components/Drive.java b/2024-2025/FreshmanProjectBots/DontOverthinkIt/src/main/java/frc/Components/Drive.java new file mode 100644 index 0000000..946bd8a --- /dev/null +++ b/2024-2025/FreshmanProjectBots/DontOverthinkIt/src/main/java/frc/Components/Drive.java @@ -0,0 +1,12 @@ +package frc.Components; +import com.ctre.phoenix6.hardware.TalonFX; +// import com.ctre.phoenix6.hardware.TalonSRX; +// import com.ctre.phoenix6.motorcontrol.ControlMode; +// import com.ctre.phoenix6.motorcontrol.can.TalonSRX; + +public class Drive { + private TalonFX motor; + + public Drive(int motorId) { motor = new TalonFX(motorId); } + public void MoveMotor(double power) { TalonFX leftMotor1 = new TalonFX(1); } +} \ No newline at end of file diff --git a/2024-2025/FreshmanProjectBots/DontOverthinkIt/src/main/java/frc/Controllers/Xbox.java b/2024-2025/FreshmanProjectBots/DontOverthinkIt/src/main/java/frc/Controllers/Xbox.java new file mode 100644 index 0000000..d8462f2 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/DontOverthinkIt/src/main/java/frc/Controllers/Xbox.java @@ -0,0 +1,393 @@ +package frc.Controllers; + +import edu.wpi.first.wpilibj.GenericHID.RumbleType; +import edu.wpi.first.wpilibj.XboxController; + +/** + * This class is used to create an Xbox controller object. + *
+ * This class uses the {@code XboxController} class from the wpilibj library. + *
+ *+ * This uses a deadband that can be set if needed. This helps control drift. + * This value can be in a range of 0 to 1. The higher the value, the more the + * stick has to move to register. This value is set in the constructor and is + * set alongside the controller ID. As a note: The deadband is only applied + * to the joystick axes. + *
+ * + * @see LogitechF310 + * @see PS4 + * + * @see edu.wpi.first.wpilibj.XboxController + */ +public class Xbox { + + /** + * The controller object. + * In this case, a {@code XboxController} object. + */ + private XboxController controller; + + /** + * The deadband value. + */ + private double deadBand; + + /** + * Constructor for the Xbox class. + *+ * This constructor is used to create a LogitechF310 object. + * This takes in the controller ID and the deadband value. + *
+ * + * @param id Controller ID (Port) + * @param deadBandValue Deadband value + */ + public Xbox(final int id, final double deadBandValue) { + controller = new XboxController(id); + deadBand = deadBandValue; + } + + // Deadband Method // + + // Although this isn't really needed for newer controllers, + // it's still here just in case one might develop drift + + /** + * Method for setting the deadband of the controller on the X and Y axes. + *+ * This sets a threshold the joystick must pass before registering a value. + * This value can be in a range of 0 to 1. The higher the value, + * the more the joystick has to move to register. + *
+ * + * @return Deadbanded value + * + * @param value Value to be deadbanded + */ + private double deadBand(final double value) { + return Math.abs(value) < deadBand ? 0 : value; + } + + // Joystick Methods // + + /** + * Method for returning the X value of the left joystick. + * + * @return X value of the left joystick + * + * @see Xbox#getRightX + * @see Xbox#getRightY + * @see Xbox#getLeftY + */ + public double getLeftX() { return deadBand(controller.getLeftX()); } + + /** + * Method for returning the Y value of the left joystick. + * + * @return Y value of the left joystick + * + * @see Xbox#getRightX + * @see Xbox#getRightY + * @see Xbox#getLeftX + */ + public double getLeftY() { return deadBand(controller.getLeftY()); } + + /** + * Method for returning the X value of the right joystick. + * + * @return X value of the right joystick + * + * @see Xbox#getRightY + * @see Xbox#getLeftX + * @see Xbox#getLeftY + */ + public double getRightX() { return deadBand(controller.getRightX()); } + + /** + * Method for returning the Y value of the right joystick. + * + * @return Y value of the right joystick + * + * @see Xbox#getRightX + * @see Xbox#getLeftX + * @see Xbox#getLeftY + */ + public double getRightY() { return deadBand(controller.getRightY()); } + + // Trigger Methods // + + /** + * Method for returning the value of the left trigger. + * + * @return value of the left trigger + * + * @see Xbox#getRightTrigger + */ + public double getLeftTrigger() { return controller.getLeftTriggerAxis(); } + + /** + * Method for returning the value of the right trigger. + * + * @return value of the right trigger + * + * @see Xbox#getLeftTrigger + */ + public double getRightTrigger() { return controller.getRightTriggerAxis(); } + + // Button Methods // + + /** + * Method for returning the value of the A button. + * + * @return value of the A button + * + * @see Xbox#getBButton + * @see Xbox#getXButton + * @see Xbox#getYButton + */ + public boolean getAButton() { return controller.getAButton(); } + + /** + * Method for returning the value of the B button. + * + * @return value of the B button + * + * @see Xbox#getAButton + * @see Xbox#getXButton + * @see Xbox#getYButton + */ + public boolean getBButton() { return controller.getBButton(); } + + /** + * Method for returning the value of the X button. + * + * @return value of the X button + * + * @see Xbox#getAButton + * @see Xbox#getBButton + * @see Xbox#getYButton + */ + public boolean getXButton() { return controller.getXButton(); } + + /** + * Method for returning the value of the Y button. + * + * @return value of the Y button + * + * @see Xbox#getAButton + * @see Xbox#getBButton + * @see Xbox#getXButton + */ + public boolean getYButton() { return controller.getYButton(); } + + /** + * Method for returning the value of the start button. + * + * @return value of the start button + * + * @see Xbox#getBackButton + */ + public boolean getStartButton() { return controller.getStartButton(); } + + /** + * Method for returning the value of the back button. + * + * @return value of the back button + * + * @see Xbox#getStartButton + */ + public boolean getBackButton() { return controller.getBackButton(); } + + /** + * Method for returning the value of the left bumper. + * + * @return value of the left bumper + * + * @see Xbox#getRightBumper + */ + public boolean getLeftBumper() { return controller.getLeftBumper(); } + + /** + * Method for returning the value of the right bumper. + * + * @return value of the right bumper + * + * @see Xbox#getLeftBumper + */ + public boolean getRightBumper() { return controller.getRightBumper(); } + + /** + * Method for returning the value of the left stick button. + * + * @return value of the left stick button + * + * @see Xbox#getRightStickButton + */ + public boolean getLeftStickButton() { + return controller.getLeftStickButton(); + } + + /** + * Method for returning the value of the right stick button. + * + * @return value of the right stick button + * + * @see Xbox#getLeftStickButton + */ + public boolean getRightStickButton() { + return controller.getRightStickButton(); + } + + // D-Pad Methods // + + public enum DPad { + /** + * Up on the D-Pad. + */ + up, + + /** + * Down on the D-Pad. + */ + down, + + /** + * Right on the D-Pad. + */ + left, + + /** + * Left on the D-Pad. + */ + right, + + /** + * Up-Right on the D-Pad. + */ + upright, + + /** + * Up-Left on the D-Pad. + */ + upleft, + + /** + * Down-Right on the D-Pad. + */ + downright, + + /** + * Down-Left on the D-Pad. + */ + downleft, + + /** + * No direction on the D-Pad. + */ + none + } + + /** + * Upright D-Pad POV value. + */ + private static final int DPAD_UPRIGHT = 45; + + /** + * Right D-Pad POV value. + */ + private static final int DPAD_RIGHT = 90; + + /** + * Downright D-Pad POV value. + */ + private static final int DPAD_DOWNRIGHT = 135; + + /** + * Down POV D-Pad value. + */ + private static final int DPAD_DOWN = 180; + + /** + * Downleft D-Pad POV value. + */ + private static final int DPAD_DOWNLEFT = 225; + + /** + * Left D-Pad POV value. + */ + private static final int DPAD_LEFT = 270; + + /** + * Upleft D-Pad POV value. + */ + private static final int DPAD_UPLEFT = 315; + + /** + * Up D-Pad POV value. + */ + private static final int DPAD_UP = 360; + + /** + * Method for returning the value of the D-Pad. + * + * @return value of the D-Pad + * + * @see Xbox.DPad + */ + public DPad getDPad() { + switch (controller.getPOV()) { + case 0: + return DPad.up; + case DPAD_UPRIGHT: + return DPad.upright; + case DPAD_RIGHT: + return DPad.right; + case DPAD_DOWNRIGHT: + return DPad.downright; + case DPAD_DOWN: + return DPad.down; + case DPAD_DOWNLEFT: + return DPad.downleft; + case DPAD_LEFT: + return DPad.left; + case DPAD_UPLEFT: + return DPad.upleft; + case DPAD_UP: + return DPad.up; + default: + return DPad.none; + } + } + + // Rumble Methods // + + /** + * Method for setting the rumble of the controller. + * + * @param type type of rumble to set + * @param value value to set the rumble to + * + * @see edu.wpi.first.wpilibj.GenericHID.RumbleType + */ + public void setRumble(final RumbleType type, final double value) { + controller.setRumble(type, value); + } + + // General Methods // + + /** + * Method for checking if the controller is connected. + * + * @return true if the controller is connected, false if not + */ + public boolean isConnected() { return (controller.isConnected()); } + + /** + * Method for getting the name of the controller. + * + * @return name of the controller + */ + public String getName() { return controller.getName(); } +} diff --git a/2024-2025/FreshmanProjectBots/DontOverthinkIt/src/main/java/frc/robot/Main.java b/2024-2025/FreshmanProjectBots/DontOverthinkIt/src/main/java/frc/robot/Main.java new file mode 100644 index 0000000..8776e5d --- /dev/null +++ b/2024-2025/FreshmanProjectBots/DontOverthinkIt/src/main/java/frc/robot/Main.java @@ -0,0 +1,25 @@ +// 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; + +/** + * Do NOT add any static variables to this class, or any initialization at all. Unless you know what + * you are doing, do not modify this file except to change the parameter class to the startRobot + * call. + */ +public final class Main { + private Main() {} + + /** + * Main initialization function. Do not perform any initialization here. + * + *If you change your main robot class, change the parameter type. + */ + public static void main(String... args) { + RobotBase.startRobot(Robot::new); + } +} diff --git a/2024-2025/FreshmanProjectBots/DontOverthinkIt/src/main/java/frc/robot/Robot.java b/2024-2025/FreshmanProjectBots/DontOverthinkIt/src/main/java/frc/robot/Robot.java new file mode 100644 index 0000000..e8946ec --- /dev/null +++ b/2024-2025/FreshmanProjectBots/DontOverthinkIt/src/main/java/frc/robot/Robot.java @@ -0,0 +1,64 @@ +// 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.TimedRobot; +import frc.Components.Drive; + +/** + * The VM is configured to automatically run this class, and to call the + * functions corresponding to each mode, as described in the TimedRobot + * documentation. If you change the name of this class or the package after + * creating this project, you must also update the build.gradle file in the + * project. + */ +public class Robot extends TimedRobot { + /** + * This function is run when the robot is first started up and should be used + * for any initialization code. + */ + + Drive drive; + + @Override + public void robotInit() { + drive = new Drive(0); // Heyyyy bestie this is a temporary ID + } + + @Override + public void robotPeriodic() {} + + @Override + public void autonomousInit() {} + + @Override + public void autonomousPeriodic() {} + + @Override + public void teleopInit() {} + + @Override + public void teleopPeriodic() {} + + @Override + public void disabledInit() {} + + @Override + public void disabledPeriodic() {} + + @Override + public void testInit() {} + + @Override + public void testPeriodic() { + drive.MoveMotor(0.5); + } + + @Override + public void simulationInit() {} + + @Override + public void simulationPeriodic() {} +} diff --git a/2024-2025/FreshmanProjectBots/DontOverthinkIt/vendordeps/Phoenix6.json b/2024-2025/FreshmanProjectBots/DontOverthinkIt/vendordeps/Phoenix6.json new file mode 100644 index 0000000..0322385 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/DontOverthinkIt/vendordeps/Phoenix6.json @@ -0,0 +1,339 @@ +{ + "fileName": "Phoenix6.json", + "name": "CTRE-Phoenix (v6)", + "version": "24.3.0", + "frcYear": 2024, + "uuid": "e995de00-2c64-4df5-8831-c1441420ff19", + "mavenUrls": [ + "https://maven.ctr-electronics.com/release/" + ], + "jsonUrl": "https://maven.ctr-electronics.com/release/com/ctre/phoenix6/latest/Phoenix6-frc2024-latest.json", + "conflictsWith": [ + { + "uuid": "3fcf3402-e646-4fa6-971e-18afe8173b1a", + "errorMessage": "The combined Phoenix-6-And-5 vendordep is no longer supported. Please remove the vendordep and instead add both the latest Phoenix 6 vendordep and Phoenix 5 vendordep.", + "offlineFileName": "Phoenix6And5.json" + } + ], + "javaDependencies": [ + { + "groupId": "com.ctre.phoenix6", + "artifactId": "wpiapi-java", + "version": "24.3.0" + } + ], + "jniDependencies": [ + { + "groupId": "com.ctre.phoenix6", + "artifactId": "tools", + "version": "24.3.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxathena" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "tools-sim", + "version": "24.3.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simTalonSRX", + "version": "24.3.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simTalonFX", + "version": "24.3.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simVictorSPX", + "version": "24.3.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simPigeonIMU", + "version": "24.3.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simCANCoder", + "version": "24.3.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProTalonFX", + "version": "24.3.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProCANcoder", + "version": "24.3.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProPigeon2", + "version": "24.3.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + } + ], + "cppDependencies": [ + { + "groupId": "com.ctre.phoenix6", + "artifactId": "wpiapi-cpp", + "version": "24.3.0", + "libName": "CTRE_Phoenix6_WPI", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxathena" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix6", + "artifactId": "tools", + "version": "24.3.0", + "libName": "CTRE_PhoenixTools", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxathena" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "wpiapi-cpp-sim", + "version": "24.3.0", + "libName": "CTRE_Phoenix6_WPISim", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "tools-sim", + "version": "24.3.0", + "libName": "CTRE_PhoenixTools_Sim", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simTalonSRX", + "version": "24.3.0", + "libName": "CTRE_SimTalonSRX", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simTalonFX", + "version": "24.3.0", + "libName": "CTRE_SimTalonFX", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simVictorSPX", + "version": "24.3.0", + "libName": "CTRE_SimVictorSPX", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simPigeonIMU", + "version": "24.3.0", + "libName": "CTRE_SimPigeonIMU", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simCANCoder", + "version": "24.3.0", + "libName": "CTRE_SimCANCoder", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProTalonFX", + "version": "24.3.0", + "libName": "CTRE_SimProTalonFX", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProCANcoder", + "version": "24.3.0", + "libName": "CTRE_SimProCANcoder", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProPigeon2", + "version": "24.3.0", + "libName": "CTRE_SimProPigeon2", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + } + ] +} \ No newline at end of file diff --git a/2024-2025/FreshmanProjectBots/DontOverthinkIt/vendordeps/WPILibNewCommands.json b/2024-2025/FreshmanProjectBots/DontOverthinkIt/vendordeps/WPILibNewCommands.json new file mode 100644 index 0000000..67bf389 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/DontOverthinkIt/vendordeps/WPILibNewCommands.json @@ -0,0 +1,38 @@ +{ + "fileName": "WPILibNewCommands.json", + "name": "WPILib-New-Commands", + "version": "1.0.0", + "uuid": "111e20f7-815e-48f8-9dd6-e675ce75b266", + "frcYear": "2024", + "mavenUrls": [], + "jsonUrl": "", + "javaDependencies": [ + { + "groupId": "edu.wpi.first.wpilibNewCommands", + "artifactId": "wpilibNewCommands-java", + "version": "wpilib" + } + ], + "jniDependencies": [], + "cppDependencies": [ + { + "groupId": "edu.wpi.first.wpilibNewCommands", + "artifactId": "wpilibNewCommands-cpp", + "version": "wpilib", + "libName": "wpilibNewCommands", + "headerClassifier": "headers", + "sourcesClassifier": "sources", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "linuxathena", + "linuxarm32", + "linuxarm64", + "windowsx86-64", + "windowsx86", + "linuxx86-64", + "osxuniversal" + ] + } + ] +} diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/WPILib-License.md b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/WPILib-License.md new file mode 100644 index 0000000..e7cd597 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/WPILib-License.md @@ -0,0 +1,24 @@ +Copyright (c) 2009-2024 FIRST and other WPILib contributors +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of FIRST, WPILib, nor the names of other WPILib + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY FIRST AND OTHER WPILIB CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY NONINFRINGEMENT AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL FIRST OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/build.gradle b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/build.gradle new file mode 100644 index 0000000..b9f0e50 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/build.gradle @@ -0,0 +1,104 @@ +plugins { + id "java" + id "edu.wpi.first.GradleRIO" version "2025.2.1" +} + +java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 +} + +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' + deleteOldFiles = false // Change to true to delete files on roboRIO that no + // longer exist in deploy directory of this project + } + } + } + } +} + +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 = false + +// Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries. +// Also defines JUnit 5. +dependencies { + annotationProcessor wpi.java.deps.wpilibAnnotations() + 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) + + 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() + + 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:5.10.1' + testRuntimeOnly 'org.junit.platform:junit-platform-launcher' +} + +test { + useJUnitPlatform() + systemProperty 'junit.jupiter.extensions.autodetection.enabled', 'true' +} + +// Simulation configuration (e.g. environment variables). +wpi.sim.addGui().defaultEnabled = true +wpi.sim.addDriverstation() + +// Setting up my Jar File. In this case, adding all libraries into the main jar ('fat jar') +// 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) } } + from sourceSets.main.allSource + manifest edu.wpi.first.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) + +// Configure string concat to always inline compile +tasks.withType(JavaCompile) { + options.compilerArgs.add '-XDstringConcat=inline' +} diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/gradle/wrapper/gradle-wrapper.properties b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..8e975a5 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=permwrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=permwrapper/dists diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/gradlew b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/gradlew new file mode 100644 index 0000000..f5feea6 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/gradlew @@ -0,0 +1,252 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/gradlew.bat b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/gradlew.bat new file mode 100644 index 0000000..9b42019 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/gradlew.bat @@ -0,0 +1,94 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/settings.gradle b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/settings.gradle new file mode 100644 index 0000000..3bc070a --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/settings.gradle @@ -0,0 +1,30 @@ +import org.gradle.internal.os.OperatingSystem + +pluginManagement { + repositories { + mavenLocal() + gradlePluginPortal() + String frcYear = '2025' + 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 + } + } +} + +Properties props = System.getProperties(); +props.setProperty("org.gradle.internal.native.headers.unresolved.dependencies.ignore", "true"); diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/src/main/deploy/example.txt b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/src/main/deploy/example.txt new file mode 100644 index 0000000..bb82515 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/src/main/deploy/example.txt @@ -0,0 +1,3 @@ +Files placed in this directory will be deployed to the RoboRIO into the +'deploy' directory in the home folder. Use the 'Filesystem.getDeployDirectory' wpilib function +to get a proper path relative to the deploy directory. \ No newline at end of file diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/src/main/java/frc/robot/Constants.java b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/src/main/java/frc/robot/Constants.java new file mode 100644 index 0000000..768c0cb --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/src/main/java/frc/robot/Constants.java @@ -0,0 +1,27 @@ +// 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; + +/** + * The Constants class provides a convenient place for teams to hold robot-wide numerical or boolean + * constants. This class should not be used for any other purpose. All constants should be declared + * globally (i.e. public static). Do not put anything functional in this class. + * + *
It is advised to statically import this class (or one of its inner classes) wherever the + * constants are needed, to reduce verbosity. + */ +public final class Constants { + public static class OperatorConstants { + public static final int kDriverControllerPort = 0; + public static final int motorId = 0; + } + + public static class DriveConstants { + public static final int kFLMotorId = 3; + public static final int kFRMotorId = 1; + public static final int kBLMotorId = 4; + public static final int kBRMotorId = 2; + } +} diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/src/main/java/frc/robot/Main.java b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/src/main/java/frc/robot/Main.java new file mode 100644 index 0000000..8776e5d --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/src/main/java/frc/robot/Main.java @@ -0,0 +1,25 @@ +// 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; + +/** + * Do NOT add any static variables to this class, or any initialization at all. Unless you know what + * you are doing, do not modify this file except to change the parameter class to the startRobot + * call. + */ +public final class Main { + private Main() {} + + /** + * Main initialization function. Do not perform any initialization here. + * + *
If you change your main robot class, change the parameter type. + */ + public static void main(String... args) { + RobotBase.startRobot(Robot::new); + } +} diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/src/main/java/frc/robot/Robot.java b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/src/main/java/frc/robot/Robot.java new file mode 100644 index 0000000..91e75cd --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/src/main/java/frc/robot/Robot.java @@ -0,0 +1,104 @@ +// 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.TimedRobot; +import edu.wpi.first.wpilibj2.command.Command; +import edu.wpi.first.wpilibj2.command.CommandScheduler; + +/** + * The VM is configured to automatically run this class, and to call the functions corresponding to + * each mode, as described in the TimedRobot documentation. If you change the name of this class or + * the package after creating this project, you must also update the build.gradle file in the + * project. + */ +public class Robot extends TimedRobot { + + private Command m_autonomousCommand; + + private RobotContainer m_robotContainer; + + /** + * This function is run when the robot is first started up and should be used for any + * initialization code. + */ + @Override + public void robotInit() { + // Instantiate our RobotContainer. This will perform all our button bindings, and put our + // autonomous chooser on the dashboard. + m_robotContainer = new RobotContainer(); + } + + /** + * This function is called every 20 ms, no matter the mode. Use this for items like diagnostics + * that you want ran during disabled, autonomous, teleoperated and test. + * + *
This runs after the mode specific periodic functions, but before LiveWindow and + * SmartDashboard integrated updating. + */ + @Override + public void robotPeriodic() { + // Runs the Scheduler. This is responsible for polling buttons, adding newly-scheduled + // commands, running already-scheduled commands, removing finished or interrupted commands, + // and running subsystem periodic() methods. This must be called from the robot's periodic + // block in order for anything in the Command-based framework to work. + CommandScheduler.getInstance().run(); + } + + /** This function is called once each time the robot enters Disabled mode. */ + @Override + public void disabledInit() {} + + @Override + public void disabledPeriodic() {} + + /** This autonomous runs the autonomous command selected by your {@link RobotContainer} class. */ + @Override + public void autonomousInit() { + // m_autonomousCommand = m_robotContainer.getAutonomousCommand(); + + // schedule the autonomous command (example) + if (m_autonomousCommand != null) { + m_autonomousCommand.schedule(); + } + } + + /** This function is called periodically during autonomous. */ + @Override + public void autonomousPeriodic() {} + + @Override + public void teleopInit() { + // This makes sure that the autonomous stops running when + // teleop starts running. If you want the autonomous to + // continue until interrupted by another command, remove + // this line or comment it out. + if (m_autonomousCommand != null) { + m_autonomousCommand.cancel(); + } + } + + /** This function is called periodically during operator control. */ + @Override + public void teleopPeriodic() {} + + @Override + public void testInit() { + // Cancels all running commands at the start of test mode. + CommandScheduler.getInstance().cancelAll(); + } + + /** This function is called periodically during test mode. */ + @Override + public void testPeriodic() {} + + /** This function is called once when the robot is first started up. */ + @Override + public void simulationInit() {} + + /** This function is called periodically whilst in simulation. */ + @Override + public void simulationPeriodic() {} +} diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/src/main/java/frc/robot/RobotContainer.java b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/src/main/java/frc/robot/RobotContainer.java new file mode 100644 index 0000000..c0a0b59 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/src/main/java/frc/robot/RobotContainer.java @@ -0,0 +1,92 @@ +// 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.Constants.OperatorConstants; +import frc.robot.Constants.DriveConstants; +import frc.robot.commands.Autos; +import frc.robot.commands.ExampleCommand; +import frc.robot.subsystems.DriveSubsystem; +import frc.robot.subsystems.ExampleSubsystem; +import edu.wpi.first.wpilibj.XboxController; +import edu.wpi.first.wpilibj2.command.Command; +import edu.wpi.first.wpilibj2.command.RunCommand; +import edu.wpi.first.wpilibj2.command.button.CommandXboxController; +import edu.wpi.first.wpilibj2.command.button.JoystickButton; +import edu.wpi.first.wpilibj2.command.button.Trigger; +import frc.robot.controllers.Xbox; + +/** + * This class is where the bulk of the robot should be declared. Since Command-based is a + * "declarative" paradigm, very little robot logic should actually be handled in the {@link Robot} + * periodic methods (other than the scheduler calls). Instead, the structure of the robot (including + * subsystems, commands, and trigger mappings) should be declared here. + */ +public class RobotContainer { + // The robot's subsystems and commands are defined here... + // private final ExampleSubsystem m_exampleSubsystem = new ExampleSubsystem(OperatorConstants.motorId); + private final DriveSubsystem m_driveSubsystem = new DriveSubsystem(DriveConstants.kFLMotorId, DriveConstants.kFRMotorId, DriveConstants.kBLMotorId, DriveConstants.kBRMotorId); + + // Replace with CommandPS4Controller or CommandJoystick if needed + private final CommandXboxController m_driverController = + new CommandXboxController(OperatorConstants.kDriverControllerPort); + + // Creation of normal controller + // private final XboxController normalXboxController = new XboxController(0); + + /** The container for the robot. Contains subsystems, OI devices, and commands. */ + public RobotContainer() { + // Configure the trigger bindings + configureBindings(); + } + + /** + * Use this method to define your trigger->command mappings. Triggers can be created via the + * {@link Trigger#Trigger(java.util.function.BooleanSupplier)} constructor with an arbitrary + * predicate, or via the named factories in {@link + * edu.wpi.first.wpilibj2.command.button.CommandGenericHID}'s subclasses for {@link + * CommandXboxController Xbox}/{@link edu.wpi.first.wpilibj2.command.button.CommandPS4Controller + * PS4} controllers or {@link edu.wpi.first.wpilibj2.command.button.CommandJoystick Flight + * joysticks}. + */ + private void configureBindings() { + // Schedule `ExampleCommand` when `exampleCondition` changes to `true` + // new Trigger(m_exampleSubsystem::exampleCondition) + // .onTrue(new ExampleCommand(m_exampleSubsystem)); + System.out.println("Bindings Configured ********************************************"); + + // Controls using the command based xbox controller + // m_driverController.leftTrigger().whileTrue(m_driveSubsystem.setMotorVoltageCommand(m_driverController.getLeftX(), m_driverController.getRawAxis(3), m_driverController.getRawAxis(4))); + // m_driverController.rightTrigger().whileTrue(m_driveSubsystem.setMotorVoltageCommand(m_driverController.getRawAxis(2), m_driverController.getRawAxis(3), m_driverController.getRawAxis(4))); + // m_driverController.rightStick().whileTrue(m_driveSubsystem.setMotorVoltageCommand(m_driverController.getRawAxis(2), m_driverController.getRawAxis(3), m_driverController.getRawAxis(4))); + m_driveSubsystem.setDefaultCommand( + new RunCommand( + () -> + m_driveSubsystem.setMotorVoltage( + m_driverController.getLeftTriggerAxis(), + m_driverController.getRightTriggerAxis(), + m_driverController.getRightX()), + m_driveSubsystem)); + + // Controls using the normal xbox controller + // Trigger leftTriggerActivated = new JoystickButton(normalXboxController, XboxController.Axis.kLeftTrigger.value); + // leftTriggerActivated.whileTrue(m_driveSubsystem.setMotorVoltageCommand(normalXboxController.getRawAxis(2), normalXboxController.getRawAxis(3), normalXboxController.getRawAxis(4))); + + + // Schedule `exampleMethodCommand` when the Xbox controller's B button is pressed, + // cancelling on release. + // m_driverController.b().whileTrue(m_exampleSubsystem.exampleMethodCommand()); + } + + /** + * Use this to pass the autonomous command to the main {@link Robot} class. + * + * @return the command to run in autonomous + */ + // public Command getAutonomousCommand() { + // // An example command will be run in autonomous + // return Autos.exampleAuto(m_exampleSubsystem); + // } +} diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/src/main/java/frc/robot/commands/Autos.java b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/src/main/java/frc/robot/commands/Autos.java new file mode 100644 index 0000000..107aad7 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/src/main/java/frc/robot/commands/Autos.java @@ -0,0 +1,20 @@ +// 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.commands; + +import frc.robot.subsystems.ExampleSubsystem; +import edu.wpi.first.wpilibj2.command.Command; +import edu.wpi.first.wpilibj2.command.Commands; + +public final class Autos { + /** Example static factory for an autonomous command. */ + public static Command exampleAuto(ExampleSubsystem subsystem) { + return Commands.sequence(subsystem.exampleMethodCommand(), new ExampleCommand(subsystem)); + } + + private Autos() { + throw new UnsupportedOperationException("This is a utility class!"); + } +} diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/src/main/java/frc/robot/commands/ExampleCommand.java b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/src/main/java/frc/robot/commands/ExampleCommand.java new file mode 100644 index 0000000..d609d82 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/src/main/java/frc/robot/commands/ExampleCommand.java @@ -0,0 +1,63 @@ +// 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.commands; + +import frc.robot.subsystems.ExampleSubsystem; +import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; +import edu.wpi.first.wpilibj2.command.Command; + +import com.ctre.phoenix.motorcontrol.ControlMode; +import com.ctre.phoenix.motorcontrol.TalonSRXControlMode; +import com.ctre.phoenix.motorcontrol.can.TalonSRX; +import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;; + +/** An example command that uses an example subsystem. */ + + +public class ExampleCommand extends Command { + @SuppressWarnings({"PMD.UnusedPrivateField", "PMD.SingularField"}) + private final ExampleSubsystem m_subsystem; + // private final TalonSRX FLMotor; + // private final TalonSRX BLMotor; + + + /** + * Creates a new ExampleCommand. + * + * @param subsystem The subsystem used by this command. + */ + public ExampleCommand(ExampleSubsystem subsystem ) { + m_subsystem = subsystem; + // FLMotor = new TalonSRX(FLId); + // BLMotor = new TalonSRX(BLId); + // Use addRequirements() here to declare subsystem dependencies. + addRequirements(subsystem); + } + + // Called when the command is initially scheduled. + @Override + public void initialize() { + } + + // Called every time the scheduler runs while the command is scheduled. + @Override + public void execute() { + + // double leftFrontMotorInput = rightTrigger + jfioejo + hiofeaj; + + // FLMotor.set(ControlMode.PercentOutput, leftFrontMotorInput); + // BLMotor.set(ControlMode.PercentOutput, leftTrigger); + } + + // Called once the command ends or is interrupted. + @Override + public void end(boolean interrupted) {} + + // Returns true when the command should end. + @Override + public boolean isFinished() { + return false; + } +} diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/src/main/java/frc/robot/controllers/LogitechF310.java b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/src/main/java/frc/robot/controllers/LogitechF310.java new file mode 100644 index 0000000..57ba088 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/src/main/java/frc/robot/controllers/LogitechF310.java @@ -0,0 +1,463 @@ +package frc.robot.controllers; + +import edu.wpi.first.wpilibj.Joystick; + +/** + * This class is used to create an LogitechF310 controller object. + *
+ * This class uses the {@code Joystick} class from the wpilibj library. + *
+ *+ * This uses a deadband that can be set if needed. This helps control drift. + * This value can be in a range of 0 to 1. The higher the value, the more the + * stick has to move to register. This value is set in the constructor and is + * set alongside the controller ID. As a note: The deadband is only applied + * to the joystick axes. + *
+ * + * @see PS4 + * @see Xbox + * + * @see edu.wpi.first.wpilibj.Joystick + */ +public class LogitechF310 { + + // Button IDs // + + /** + * The axis ID for the left joystick x. + */ + private static final int JOYSTICK_LEFT_X = 0; + + /** + * The axis ID for the left joystick y. + */ + private static final int JOYSTICK_LEFT_Y = 1; + + /** + * The axis ID for the left trigger. + */ + private static final int TRIGGER_LEFT = 2; + + /** + * The axis ID for the right trigger. + */ + private static final int TRIGGER_RIGHT = 3; + + /** + * The axis ID for the right joystick x. + */ + private static final int JOYSTICK_RIGHT_X = 4; + + /** + * The axis ID for the right joystick y. + */ + private static final int JOYSTICK_RIGHT_Y = 5; + + /** + * The button ID for the A button. + */ + private static final int BUTTON_A = 1; + + /** + * The button ID for the B button. + */ + private static final int BUTTON_B = 2; + + /** + * The button ID for the X button. + */ + private static final int BUTTON_X = 3; + + /** + * The button ID for the Y button. + */ + private static final int BUTTON_Y = 4; + + /** + * The button ID for the left bumper. + */ + private static final int BUTTON_LEFT_BUMPER = 5; + + /** + * The button ID for the right bumper. + */ + private static final int BUTTON_RIGHT_BUMPER = 6; + + /** + * The button ID for the start button. + */ + private static final int BUTTON_START = 7; + + /** + * The button ID for the back button. + */ + private static final int BUTTON_BACK = 8; + + /** + * The controller object. + * In this case, a {@code Joystick} object. + * + * @see edu.wpi.first.wpilibj.Joystick + */ + private Joystick controller; + + /** + * The deadband value. + */ + private double deadBand; + + /** + * Constructor for the LogitechF310 class. + *+ * This constructor is used to create a LogitechF310 object. + * This takes in the controller ID and the deadband value. + *
+ * + * @param id Controller ID (Port) + * @param deadBandValue Deadband value + */ + public LogitechF310(final int id, final double deadBandValue) { + controller = new Joystick(id); + deadBand = deadBandValue; + } + + // Deadband Method // + + /** + * Method for setting the deadband of the controller on the X and Y axes. + *+ * This sets a threshold the joystick must pass before registering a value. + * This value can be in a range of 0 to 1. The higher the value, + * the more the joystick has to move to register. + *
+ * + * @return Deadbanded value + * + * @param value Value to be deadbanded + */ + private double deadBand(final double value) { + return Math.abs(value) < deadBand ? 0 : value; + } + + // Joystick Methods // + + /** + * Method for returning the X value of the left joystick. + * + * @return X value of the left joystick + * + * @see LogitechF310#getRightX + * @see LogitechF310#getRightY + * @see LogitechF310#getLeftY + */ + public double getLeftX() { + return deadBand(controller.getRawAxis(JOYSTICK_LEFT_X)); + } + + /** + * Method for returning the Y value of the left joystick. + * + * @return Y value of the left joystick + * + * @see LogitechF310#getRightX + * @see LogitechF310#getRightY + * @see LogitechF310#getLeftX + */ + public double getLeftY() { + return deadBand(controller.getRawAxis(JOYSTICK_LEFT_Y)); + } + + /** + * Method for returning the X value of the right joystick. + * + * @return X value of the right joystick + * + * @see LogitechF310#getRightY + * @see LogitechF310#getLeftX + * @see LogitechF310#getLeftY + */ + public double getRightX() { + return deadBand(controller.getRawAxis(JOYSTICK_RIGHT_X)); + } + + /** + * Method for returning the Y value of the right joystick. + * + * @return Y value of the right joystick + * + * @see LogitechF310#getRightX + * @see LogitechF310#getLeftX + * @see LogitechF310#getLeftY + */ + public double getRightY() { + return deadBand(controller.getRawAxis(JOYSTICK_RIGHT_Y)); + } + + // Trigger Methods // + + /** + * Method for returning the value of the left trigger. + * + * @return Value of the left trigger + * + * @see LogitechF310#getRightTrigger + */ + public double getLeftTrigger() { + return deadBand(controller.getRawAxis(TRIGGER_LEFT)); + } + + /** + * Method for returning the value of the right trigger. + * + * @return Value of the right trigger + * + * @see LogitechF310#getLeftTrigger + */ + public double getRightTrigger() { + return deadBand(controller.getRawAxis(TRIGGER_RIGHT)); + } + + // Button Methods // + + /** + * Method for returning the value of the A button. + * + * @return Value of the A button + * + * @see LogitechF310#getBButton + * @see LogitechF310#getXButton + * @see LogitechF310#getYButton + */ + public boolean getAButton() { + return controller.getRawButton(BUTTON_A); + } + + /** + * Method for returning the value of the B button. + * + * @return Value of the B button + * + * @see LogitechF310#getAButton + * @see LogitechF310#getXButton + * @see LogitechF310#getYButton + */ + public boolean getBButton() { + return controller.getRawButton(BUTTON_B); + } + + /** + * Method for returning the value of the X button. + * + * @return Value of the X button + * + * @see LogitechF310#getAButton + * @see LogitechF310#getBButton + * @see LogitechF310#getYButton + */ + public boolean getXButton() { + return controller.getRawButton(BUTTON_X); + } + + /** + * Method for returning the value of the Y button. + * + * @return Value of the Y button + * + * @see LogitechF310#getAButton + * @see LogitechF310#getBButton + * @see LogitechF310#getXButton + */ + public boolean getYButton() { + return controller.getRawButton(BUTTON_Y); + } + + /** + * Method for returning the value of the back button. + * + * @return Value of the back button + * + * @see LogitechF310#getStartButton + */ + public boolean getBackButton() { + return controller.getRawButton(BUTTON_START); + } + + /** + * Method for returning the value of the start button. + * + * @return Value of the start button + * + * @see LogitechF310#getBackButton + */ + public boolean getStartButton() { + return controller.getRawButton(BUTTON_BACK); + } + + /** + * Method for returning the value of the left bumper. + * + * @return Value of the left bumper + * + * @see LogitechF310#getRightBumper + */ + public boolean getLeftBumper() { + return controller.getRawButton(BUTTON_LEFT_BUMPER); + } + + /** + * Method for returning the value of the right bumper. + * + * @return Value of the right bumper + * + * @see LogitechF310#getLeftBumper + */ + public boolean getRightBumper() { + return controller.getRawButton(BUTTON_RIGHT_BUMPER); + } + + // D-Pad Methods // + + public enum DPad { + /** + * Up on the D-Pad. + */ + up, + + /** + * Down on the D-Pad. + */ + down, + + /** + * Right on the D-Pad. + */ + left, + + /** + * Left on the D-Pad. + */ + right, + + /** + * Up-Right on the D-Pad. + */ + upright, + + /** + * Up-Left on the D-Pad. + */ + upleft, + + /** + * Down-Right on the D-Pad. + */ + downright, + + /** + * Down-Left on the D-Pad. + */ + downleft, + + /** + * No direction on the D-Pad. + */ + none + } + + /** + * Upright D-Pad POV value. + */ + private static final int DPAD_UPRIGHT = 45; + + /** + * Right D-Pad POV value. + */ + private static final int DPAD_RIGHT = 90; + + /** + * Downright D-Pad POV value. + */ + private static final int DPAD_DOWNRIGHT = 135; + + /** + * Down POV D-Pad value. + */ + private static final int DPAD_DOWN = 180; + + /** + * Downleft D-Pad POV value. + */ + private static final int DPAD_DOWNLEFT = 225; + + /** + * Left D-Pad POV value. + */ + private static final int DPAD_LEFT = 270; + + /** + * Upleft D-Pad POV value. + */ + private static final int DPAD_UPLEFT = 315; + + /** + * Up D-Pad POV value. + */ + private static final int DPAD_UP = 360; + + /** + * Method for returning the value of the D-Pad. + * + * @return value of the D-Pad + * + * @see LogitechF310.DPad + */ + public DPad getDPad() { + switch (controller.getPOV()) { + case 0: + return DPad.up; + case DPAD_UPRIGHT: + return DPad.upright; + case DPAD_RIGHT: + return DPad.right; + case DPAD_DOWNRIGHT: + return DPad.downright; + case DPAD_DOWN: + return DPad.down; + case DPAD_DOWNLEFT: + return DPad.downleft; + case DPAD_LEFT: + return DPad.left; + case DPAD_UPLEFT: + return DPad.upleft; + case DPAD_UP: + return DPad.up; + default: + return DPad.none; + } + } + + // Rumble Methods // + + // This controller does not have rumble functionality :( + + // General Methods // + + /** + * Method for checking if the controller is connected. + * + * @return true if the controller is connected, false if not + */ + public boolean isConnected() { + return (controller.isConnected()); + } + + /** + * Method for getting the name of the controller. + * + * @return name of the controller + */ + public String getName() { + return controller.getName(); + } +} diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/src/main/java/frc/robot/controllers/PS4.java b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/src/main/java/frc/robot/controllers/PS4.java new file mode 100644 index 0000000..398da6c --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/src/main/java/frc/robot/controllers/PS4.java @@ -0,0 +1,498 @@ +package frc.robot.controllers; + +import edu.wpi.first.wpilibj.PS4Controller; +import edu.wpi.first.wpilibj.GenericHID.RumbleType; + +/** + * This class is used to create an PS4 controller object. + *+ * This class uses the {@code PS4Controller} class from the wpilibj library. + *
+ *+ * This uses a deadband that can be set if needed. This helps control drift. + * This value can be in a range of 0 to 1. The higher the value, the more the + * stick has to move to register. This value is set in the constructor and is + * set alongside the controller ID. As a note: The deadband is only applied + * to the joystick axes. + *
+ * + * @see LogitechF310 + * @see Xbox + * + * @see edu.wpi.first.wpilibj.PS4Controller + */ +public class PS4 { + + /** + * The controller object. + * In this case, a {@code PS4Controller} object. + * + * @see edu.wpi.first.wpilibj.PS4Controller + */ + private PS4Controller controller; + + /** + * The deadband value. + */ + private double deadBand; + + /** + * Constructor for the PS4 class. + *+ * This constructor is used to create a LogitechF310 object. + * This takes in the controller ID and the deadband value. + *
+ * + * @param id Controller ID (Port) + * @param deadBandValue Deadband value + */ + public PS4(final int id, final double deadBandValue) { + controller = new PS4Controller(id); + deadBand = deadBandValue; + } + + // Deadband Method // + + // Although this isn't really needed for newer controllers, + // it's still here just in case one might develop drift + + /** + * Method for setting the deadband of the controller on the X and Y axes. + *+ * This sets a threshold the joystick must pass before registering a value. + * This value can be in a range of 0 to 1. The higher the value, + * the more the joystick has to move to register. + *
+ * + * @return Deadbanded value + * + * @param value Value to be deadbanded + */ + private double deadBand(final double value) { + return Math.abs(value) < deadBand ? 0 : value; + } + + // Joystick Methods // + + /** + * Method for returning the X value of the left joystick. + * + * @return X value of the left joystick + * + * @see PS4#getRightX + * @see PS4#getRightY + * @see PS4#getLeftY + */ + public double getLeftX() { + return deadBand(controller.getLeftX()); + } + + /** + * Method for returning the Y value of the left joystick. + * + * @return Y value of the left joystick + * + * @see PS4#getRightX + * @see PS4#getRightY + * @see PS4#getLeftX + */ + public double getLeftY() { + return deadBand(controller.getLeftY()); + } + + /** + * Method for returning the X value of the right joystick. + * + * @return X value of the right joystick + * + * @see PS4#getLeftX + * @see PS4#getRightY + * @see PS4#getLeftY + */ + public double getRightX() { + return deadBand(controller.getRightX()); + } + + /** + * Method for returning the Y value of the right joystick. + * + * @return Y value of the right joystick + * + * @see PS4#getRightX + * @see PS4#getLeftX + * @see PS4#getLeftY + */ + public double getRightY() { + return deadBand(controller.getRightY()); + } + + // Trigger Methods // + + /** + * Method for returning the value of the left trigger. + * + * @return value of the left trigger + * + * @see PS4#getRightTrigger + */ + public double getLeftTrigger() { + return deadBand(controller.getL2Axis()); + } + + /** + * Method for returning the value of the right trigger. + * + * @return value of the right trigger + * + * @see PS4#getLeftTrigger + */ + public double getRightTrigger() { + return deadBand(controller.getR2Axis()); + } + + // Button Methods // + + /** + * Method for returning the value of the X button. + * + * @return value of the X button + * + * @see PS4#getSquareButton + * @see PS4#getCircleButton + * @see PS4#getTriangleButton + * @see PS4#getShareButton + * @see PS4#getOptionsButton + * @see PS4#getPlayStationButton + * @see PS4#getTouchpadButton + */ + public boolean getXButton() { + return controller.getCrossButton(); + } + + /** + * Method for returning the value of the Square button. + * + * @return value of the Square button + * + * @see PS4#getXButton + * @see PS4#getCircleButton + * @see PS4#getTriangleButton + * @see PS4#getShareButton + * @see PS4#getOptionsButton + * @see PS4#getPlayStationButton + * @see PS4#getTouchpadButton + */ + public boolean getSquareButton() { + return controller.getSquareButton(); + } + + /** + * Method for returning the value of the Circle button. + * + * @return value of the Circle button + * + * @see PS4#getXButton + * @see PS4#getSquareButton + * @see PS4#getTriangleButton + * @see PS4#getShareButton + * @see PS4#getOptionsButton + * @see PS4#getPlayStationButton + * @see PS4#getTouchpadButton + */ + public boolean getCircleButton() { + return controller.getCircleButton(); + } + + /** + * Method for returning the value of the Triangle button. + * + * @return value of the Triangle button + * + * @see PS4#getXButton + * @see PS4#getSquareButton + * @see PS4#getCircleButton + * @see PS4#getShareButton + * @see PS4#getOptionsButton + * @see PS4#getPlayStationButton + * @see PS4#getTouchpadButton + */ + public boolean getTriangleButton() { + return controller.getTriangleButton(); + } + + /** + * Method for returning the value of the Share button. + * + * @return value of the Share button + * + * @see PS4#getXButton + * @see PS4#getSquareButton + * @see PS4#getCircleButton + * @see PS4#getTriangleButton + * @see PS4#getOptionsButton + * @see PS4#getPlayStationButton + * @see PS4#getTouchpadButton + */ + public boolean getShareButton() { + return controller.getShareButton(); + } + + /** + * Method for returning the value of the Options button. + * + * @return value of the Options button + * + * @see PS4#getXButton + * @see PS4#getSquareButton + * @see PS4#getCircleButton + * @see PS4#getTriangleButton + * @see PS4#getShareButton + * @see PS4#getPlayStationButton + * @see PS4#getTouchpadButton + */ + public boolean getOptionsButton() { + return controller.getOptionsButton(); + } + + /** + * Method for returning the value of the PlayStation button. + * + * @return value of the PlayStation button + * + * @see PS4#getXButton + * @see PS4#getSquareButton + * @see PS4#getCircleButton + * @see PS4#getTriangleButton + * @see PS4#getShareButton + * @see PS4#getOptionsButton + * @see PS4#getTouchpadButton + */ + public boolean getPlayStationButton() { + return controller.getPSButton(); + } + + /** + * Method for returning the value of the left bumper. + * + * @return value of the left bumper + * + * @see PS4#getRightBumper + */ + public boolean getLeftBumper() { + return controller.getL1Button(); + } + + /** + * Method for returning the value of the right bumper. + * + * @return value of the right bumper + * + * @see PS4#getLeftBumper + */ + public boolean getRightBumper() { + return controller.getR1Button(); + } + + /** + * Method for returning the value of the left joystick button. + * + * @return value of the left joystick button + * + * @see PS4#getRightJoystickButton + */ + public boolean getLeftJoystickButton() { + return controller.getL3Button(); + } + + /** + * Method for returning the value of the right joystick button. + * + * @return value of the right joystick button + * + * @see PS4#getLeftJoystickButton + */ + public boolean getRightJoystickButton() { + return controller.getR3Button(); + } + + // Touchpad Methods // + + /** + * Method for returning the value of the Touchpad button. + * + * @return value of the Touchpad button + * + * @see PS4#getXButton + * @see PS4#getSquareButton + * @see PS4#getCircleButton + * @see PS4#getTriangleButton + * @see PS4#getShareButton + * @see PS4#getOptionsButton + * @see PS4#getPlayStationButton + */ + public boolean getTouchpadButton() { + return controller.getTouchpad(); + } + + // There is a 'touchpad' that uses an event loop + // but for the purpose of this class, it is not needed + // It might be added in a future version if there becomes a need for it + // If you have a need for it or have added it yourself, + // Submit a pull request or submit an issue on the GitHub repository + // https://github.com/J-The-Fox/FRC-Team-5098 + + // D-Pad Methods // + + public enum DPad { + /** + * Up on the D-Pad. + */ + up, + + /** + * Down on the D-Pad. + */ + down, + + /** + * Right on the D-Pad. + */ + left, + + /** + * Left on the D-Pad. + */ + right, + + /** + * Up-Right on the D-Pad. + */ + upright, + + /** + * Up-Left on the D-Pad. + */ + upleft, + + /** + * Down-Right on the D-Pad. + */ + downright, + + /** + * Down-Left on the D-Pad. + */ + downleft, + + /** + * No direction on the D-Pad. + */ + none + } + + /** + * Upright D-Pad POV value. + */ + private static final int DPAD_UPRIGHT = 45; + + /** + * Right D-Pad POV value. + */ + private static final int DPAD_RIGHT = 90; + + /** + * Downright D-Pad POV value. + */ + private static final int DPAD_DOWNRIGHT = 135; + + /** + * Down POV D-Pad value. + */ + private static final int DPAD_DOWN = 180; + + /** + * Downleft D-Pad POV value. + */ + private static final int DPAD_DOWNLEFT = 225; + + /** + * Left D-Pad POV value. + */ + private static final int DPAD_LEFT = 270; + + /** + * Upleft D-Pad POV value. + */ + private static final int DPAD_UPLEFT = 315; + + /** + * Up D-Pad POV value. + */ + private static final int DPAD_UP = 360; + + /** + * Method for returning the value of the D-Pad. + * + * @return value of the D-Pad + * + * @see PS4.DPad + */ + public DPad getDPad() { + switch (controller.getPOV()) { + case 0: + return DPad.up; + case DPAD_UPRIGHT: + return DPad.upright; + case DPAD_RIGHT: + return DPad.right; + case DPAD_DOWNRIGHT: + return DPad.downright; + case DPAD_DOWN: + return DPad.down; + case DPAD_DOWNLEFT: + return DPad.downleft; + case DPAD_LEFT: + return DPad.left; + case DPAD_UPLEFT: + return DPad.upleft; + case DPAD_UP: + return DPad.up; + default: + return DPad.none; + } + } + + // Rumble Methods // + + /** + * Method for setting the rumble of the controller. + * + * @param type type of rumble to set + * @param value value to set the rumble to + * + * @see edu.wpi.first.wpilibj.GenericHID.RumbleType + */ + public void setRumble(final RumbleType type, final double value) { + controller.setRumble(type, value); + } + + // General Methods // + + /** + * Method for checking if the controller is connected. + * + * @return true if the controller is connected, false if not + */ + public boolean isConnected() { + return (controller.isConnected()); + } + + /** + * Method for getting the name of the controller. + * + * @return name of the controller + */ + public String getName() { + return controller.getName(); + } +} diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/src/main/java/frc/robot/controllers/Xbox.java b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/src/main/java/frc/robot/controllers/Xbox.java new file mode 100644 index 0000000..421866a --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/src/main/java/frc/robot/controllers/Xbox.java @@ -0,0 +1,425 @@ +package frc.robot.controllers; + +import edu.wpi.first.wpilibj.XboxController; +import edu.wpi.first.wpilibj.GenericHID.RumbleType; + +/** + * This class is used to create an Xbox controller object. + *+ * This class uses the {@code XboxController} class from the wpilibj library. + *
+ *+ * This uses a deadband that can be set if needed. This helps control drift. + * This value can be in a range of 0 to 1. The higher the value, the more the + * stick has to move to register. This value is set in the constructor and is + * set alongside the controller ID. As a note: The deadband is only applied + * to the joystick axes. + *
+ * + * @see LogitechF310 + * @see PS4 + * + * @see edu.wpi.first.wpilibj.XboxController + */ +public class Xbox { + + /** + * The controller object. + * In this case, a {@code XboxController} object. + */ + private XboxController controller; + + /** + * The deadband value. + */ + private double deadBand; + + /** + * Constructor for the Xbox class. + *+ * This constructor is used to create a LogitechF310 object. + * This takes in the controller ID and the deadband value. + *
+ * + * @param id Controller ID (Port) + * @param deadBandValue Deadband value + */ + public Xbox(final int id, final double deadBandValue) { + controller = new XboxController(id); + deadBand = deadBandValue; + } + + // Deadband Method // + + // Although this isn't really needed for newer controllers, + // it's still here just in case one might develop drift + + /** + * Method for setting the deadband of the controller on the X and Y axes. + *+ * This sets a threshold the joystick must pass before registering a value. + * This value can be in a range of 0 to 1. The higher the value, + * the more the joystick has to move to register. + *
+ * + * @return Deadbanded value + * + * @param value Value to be deadbanded + */ + private double deadBand(final double value) { + return Math.abs(value) < deadBand ? 0 : value; + } + + // Joystick Methods // + + /** + * Method for returning the X value of the left joystick. + * + * @return X value of the left joystick + * + * @see Xbox#getRightX + * @see Xbox#getRightY + * @see Xbox#getLeftY + */ + public double getLeftX() { + return deadBand(controller.getLeftX()); + } + + /** + * Method for returning the Y value of the left joystick. + * + * @return Y value of the left joystick + * + * @see Xbox#getRightX + * @see Xbox#getRightY + * @see Xbox#getLeftX + */ + public double getLeftY() { + return deadBand(controller.getLeftY()); + } + + /** + * Method for returning the X value of the right joystick. + * + * @return X value of the right joystick + * + * @see Xbox#getRightY + * @see Xbox#getLeftX + * @see Xbox#getLeftY + */ + public double getRightX() { + return deadBand(controller.getRightX()); + } + + /** + * Method for returning the Y value of the right joystick. + * + * @return Y value of the right joystick + * + * @see Xbox#getRightX + * @see Xbox#getLeftX + * @see Xbox#getLeftY + */ + public double getRightY() { + return deadBand(controller.getRightY()); + } + + // Trigger Methods // + + /** + * Method for returning the value of the left trigger. + * + * @return value of the left trigger + * + * @see Xbox#getRightTrigger + */ + public double getLeftTrigger() { + return controller.getLeftTriggerAxis(); + } + + /** + * Method for returning the value of the right trigger. + * + * @return value of the right trigger + * + * @see Xbox#getLeftTrigger + */ + public double getRightTrigger() { + return controller.getRightTriggerAxis(); + } + + // Button Methods // + + /** + * Method for returning the value of the A button. + * + * @return value of the A button + * + * @see Xbox#getBButton + * @see Xbox#getXButton + * @see Xbox#getYButton + */ + public boolean getAButton() { + return controller.getAButton(); + } + + /** + * Method for returning the value of the B button. + * + * @return value of the B button + * + * @see Xbox#getAButton + * @see Xbox#getXButton + * @see Xbox#getYButton + */ + public boolean getBButton() { + return controller.getBButton(); + } + + /** + * Method for returning the value of the X button. + * + * @return value of the X button + * + * @see Xbox#getAButton + * @see Xbox#getBButton + * @see Xbox#getYButton + */ + public boolean getXButton() { + return controller.getXButton(); + } + + /** + * Method for returning the value of the Y button. + * + * @return value of the Y button + * + * @see Xbox#getAButton + * @see Xbox#getBButton + * @see Xbox#getXButton + */ + public boolean getYButton() { + return controller.getYButton(); + } + + /** + * Method for returning the value of the start button. + * + * @return value of the start button + * + * @see Xbox#getBackButton + */ + public boolean getStartButton() { + return controller.getStartButton(); + } + + /** + * Method for returning the value of the back button. + * + * @return value of the back button + * + * @see Xbox#getStartButton + */ + public boolean getBackButton() { + return controller.getBackButton(); + } + + /** + * Method for returning the value of the left bumper. + * + * @return value of the left bumper + * + * @see Xbox#getRightBumper + */ + public boolean getLeftBumper() { + return controller.getLeftBumper(); + } + + /** + * Method for returning the value of the right bumper. + * + * @return value of the right bumper + * + * @see Xbox#getLeftBumper + */ + public boolean getRightBumper() { + return controller.getRightBumper(); + } + + /** + * Method for returning the value of the left stick button. + * + * @return value of the left stick button + * + * @see Xbox#getRightStickButton + */ + public boolean getLeftStickButton() { + return controller.getLeftStickButton(); + } + + /** + * Method for returning the value of the right stick button. + * + * @return value of the right stick button + * + * @see Xbox#getLeftStickButton + */ + public boolean getRightStickButton() { + return controller.getRightStickButton(); + } + + // D-Pad Methods // + + public enum DPad { + /** + * Up on the D-Pad. + */ + up, + + /** + * Down on the D-Pad. + */ + down, + + /** + * Right on the D-Pad. + */ + left, + + /** + * Left on the D-Pad. + */ + right, + + /** + * Up-Right on the D-Pad. + */ + upright, + + /** + * Up-Left on the D-Pad. + */ + upleft, + + /** + * Down-Right on the D-Pad. + */ + downright, + + /** + * Down-Left on the D-Pad. + */ + downleft, + + /** + * No direction on the D-Pad. + */ + none + } + + /** + * Upright D-Pad POV value. + */ + private static final int DPAD_UPRIGHT = 45; + + /** + * Right D-Pad POV value. + */ + private static final int DPAD_RIGHT = 90; + + /** + * Downright D-Pad POV value. + */ + private static final int DPAD_DOWNRIGHT = 135; + + /** + * Down POV D-Pad value. + */ + private static final int DPAD_DOWN = 180; + + /** + * Downleft D-Pad POV value. + */ + private static final int DPAD_DOWNLEFT = 225; + + /** + * Left D-Pad POV value. + */ + private static final int DPAD_LEFT = 270; + + /** + * Upleft D-Pad POV value. + */ + private static final int DPAD_UPLEFT = 315; + + /** + * Up D-Pad POV value. + */ + private static final int DPAD_UP = 360; + + /** + * Method for returning the value of the D-Pad. + * + * @return value of the D-Pad + * + * @see Xbox.DPad + */ + public DPad getDPad() { + switch (controller.getPOV()) { + case 0: + return DPad.up; + case DPAD_UPRIGHT: + return DPad.upright; + case DPAD_RIGHT: + return DPad.right; + case DPAD_DOWNRIGHT: + return DPad.downright; + case DPAD_DOWN: + return DPad.down; + case DPAD_DOWNLEFT: + return DPad.downleft; + case DPAD_LEFT: + return DPad.left; + case DPAD_UPLEFT: + return DPad.upleft; + case DPAD_UP: + return DPad.up; + default: + return DPad.none; + } + } + + // Rumble Methods // + + /** + * Method for setting the rumble of the controller. + * + * @param type type of rumble to set + * @param value value to set the rumble to + * + * @see edu.wpi.first.wpilibj.GenericHID.RumbleType + */ + public void setRumble(final RumbleType type, final double value) { + controller.setRumble(type, value); + } + + // General Methods // + + /** + * Method for checking if the controller is connected. + * + * @return true if the controller is connected, false if not + */ + public boolean isConnected() { + return (controller.isConnected()); + } + + /** + * Method for getting the name of the controller. + * + * @return name of the controller + */ + public String getName() { + return controller.getName(); + } +} diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/src/main/java/frc/robot/controllers/package-info.java b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/src/main/java/frc/robot/controllers/package-info.java new file mode 100644 index 0000000..7c768d9 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/src/main/java/frc/robot/controllers/package-info.java @@ -0,0 +1,7 @@ +/** + * Holds controller classes + *+ * This can be used to hold both custom and pre-made controller classes. + *
+ */ +package frc.robot.controllers; diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/src/main/java/frc/robot/subsystems/DriveSubsystem.java b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/src/main/java/frc/robot/subsystems/DriveSubsystem.java new file mode 100644 index 0000000..6877d47 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/src/main/java/frc/robot/subsystems/DriveSubsystem.java @@ -0,0 +1,47 @@ +package frc.robot.subsystems; + +import edu.wpi.first.wpilibj2.command.SubsystemBase; +import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; +import edu.wpi.first.wpilibj2.command.Command; +import com.ctre.phoenix.motorcontrol.can.TalonSRX; +import com.ctre.phoenix.motorcontrol.ControlMode; + +public class DriveSubsystem extends SubsystemBase { + + // Motors + private final TalonSRX FLMotor; + private final TalonSRX FRMotor; + private final TalonSRX BLMotor; + private final TalonSRX BRMotor; + + public DriveSubsystem(int FLId, int FRId, int BLId, int BRId) { + FLMotor = new TalonSRX(FLId); + FRMotor = new TalonSRX(FRId); + BLMotor = new TalonSRX(BLId); + BRMotor = new TalonSRX(BRId); + } + + public Command setMotorVoltageCommand(double leftTrigger, double rightTrigger, double rightXAxis) { + return runOnce(() -> { + // System.out.println("Command Ran"); + setMotorVoltage(leftTrigger, rightTrigger, rightXAxis); + }); + } + + public void setMotorVoltage(double leftTrigger, double rightTrigger, double rightXAxis) { + // System.out.println("method ran"); + FLMotor.set(ControlMode.PercentOutput, rightTrigger -leftTrigger + rightXAxis); + FRMotor.set(ControlMode.PercentOutput, -rightTrigger + leftTrigger -rightXAxis); + BLMotor.set(ControlMode.PercentOutput, rightTrigger -leftTrigger + rightXAxis); + BRMotor.set(ControlMode.PercentOutput, -rightTrigger + leftTrigger -rightXAxis); + + // FLMotor.set(ControlMode.PercentOutput, 0.5); + // BLMotor.set(ControlMode.PercentOutput, 0.5); + + SmartDashboard.putNumber("Left Trigger", leftTrigger); + SmartDashboard.putNumber("Right Trigger", rightTrigger); + SmartDashboard.putNumber("Stick", rightXAxis); + + } + +} diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/src/main/java/frc/robot/subsystems/ExampleSubsystem.java b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/src/main/java/frc/robot/subsystems/ExampleSubsystem.java new file mode 100644 index 0000000..53776e3 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/src/main/java/frc/robot/subsystems/ExampleSubsystem.java @@ -0,0 +1,70 @@ +// 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.subsystems; + +import edu.wpi.first.wpilibj2.command.Command; +import edu.wpi.first.wpilibj2.command.SubsystemBase; +import com.ctre.phoenix.motorcontrol.can.TalonSRX; +import com.ctre.phoenix.motorcontrol.ControlMode; + +public class ExampleSubsystem extends SubsystemBase { + + private final TalonSRX testMotor; + /** Creates a new ExampleSubsystem. */ + public ExampleSubsystem(int testId) { + testMotor = new TalonSRX(testId); + } + + /** + * Example command factory method. + * + * @return a command + */ + public Command exampleMethodCommand() { + // Inline construction of command goes here. + // Subsystem::RunOnce implicitly requires `this` subsystem. + return runOnce(() + -> { + /* one-time action goes here */ + }); + } + + public Command setMotorVoltageCommand(double voltage) { + return runOnce(() + -> { + setMotorVoltage(voltage); + }); + } + + /** + * An example method querying a boolean state of the subsystem (for example, a + * digital sensor). + * + * @return value of some boolean subsystem state, such as a digital sensor. + */ + public boolean exampleCondition() { + // Query some boolean state, such as a digital sensor. + int x = 3; + if (x != 1) { + return false; + } + return true; + + } + + public void setMotorVoltage(double voltage) { + testMotor.set(ControlMode.PercentOutput, voltage); + } + + @Override + public void periodic() { + // This method will be called once per scheduler run + } + + @Override + public void simulationPeriodic() { + // This method will be called once per scheduler run during simulation + } +} diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/vendordeps/AdvantageKit.json b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/vendordeps/AdvantageKit.json new file mode 100644 index 0000000..1fa7c03 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/vendordeps/AdvantageKit.json @@ -0,0 +1,34 @@ +{ + "fileName": "AdvantageKit.json", + "name": "AdvantageKit", + "version": "4.0.0", + "uuid": "d820cc26-74e3-11ec-90d6-0242ac120003", + "frcYear": "2025", + "mavenUrls": [ + "https://frcmaven.wpi.edu/artifactory/littletonrobotics-mvn-release/" + ], + "jsonUrl": "https://github.com/Mechanical-Advantage/AdvantageKit/releases/latest/download/AdvantageKit.json", + "javaDependencies": [ + { + "groupId": "org.littletonrobotics.akit", + "artifactId": "akit-java", + "version": "4.0.0" + } + ], + "jniDependencies": [ + { + "groupId": "org.littletonrobotics.akit", + "artifactId": "akit-wpilibio", + "version": "4.0.0", + "skipInvalidPlatforms": false, + "isJar": false, + "validPlatforms": [ + "linuxathena", + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ] + } + ], + "cppDependencies": [] +} \ No newline at end of file diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/vendordeps/PathplannerLib-2025.2.1.json b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/vendordeps/PathplannerLib-2025.2.1.json new file mode 100644 index 0000000..71e25f3 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/vendordeps/PathplannerLib-2025.2.1.json @@ -0,0 +1,38 @@ +{ + "fileName": "PathplannerLib-2025.2.1.json", + "name": "PathplannerLib", + "version": "2025.2.1", + "uuid": "1b42324f-17c6-4875-8e77-1c312bc8c786", + "frcYear": "2025", + "mavenUrls": [ + "https://3015rangerrobotics.github.io/pathplannerlib/repo" + ], + "jsonUrl": "https://3015rangerrobotics.github.io/pathplannerlib/PathplannerLib.json", + "javaDependencies": [ + { + "groupId": "com.pathplanner.lib", + "artifactId": "PathplannerLib-java", + "version": "2025.2.1" + } + ], + "jniDependencies": [], + "cppDependencies": [ + { + "groupId": "com.pathplanner.lib", + "artifactId": "PathplannerLib-cpp", + "version": "2025.2.1", + "libName": "PathplannerLib", + "headerClassifier": "headers", + "sharedLibrary": false, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal", + "linuxathena", + "linuxarm32", + "linuxarm64" + ] + } + ] +} \ No newline at end of file diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/vendordeps/Phoenix5-replay-5.35.1.json b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/vendordeps/Phoenix5-replay-5.35.1.json new file mode 100644 index 0000000..bdf2f44 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/vendordeps/Phoenix5-replay-5.35.1.json @@ -0,0 +1,221 @@ +{ + "fileName": "Phoenix5-replay-5.35.1.json", + "name": "CTRE-Phoenix (v5)", + "version": "5.35.1", + "frcYear": "2025", + "uuid": "fbc886a4-2cec-40c0-9835-71086a8cc3df", + "mavenUrls": [ + "https://maven.ctr-electronics.com/release/" + ], + "jsonUrl": "https://maven.ctr-electronics.com/release/com/ctre/phoenix/Phoenix5-replay-frc2025-latest.json", + "requires": [ + { + "uuid": "e7900d8d-826f-4dca-a1ff-182f658e98af", + "errorMessage": "Phoenix 5 requires low-level libraries from Phoenix 6. Please add the Phoenix 6 vendordep before adding Phoenix 5.", + "offlineFileName": "Phoenix6-replay-frc2025-latest.json", + "onlineUrl": "https://maven.ctr-electronics.com/release/com/ctre/phoenix6/latest/Phoenix6-replay-frc2025-latest.json" + } + ], + "conflictsWith": [ + { + "uuid": "e995de00-2c64-4df5-8831-c1441420ff19", + "errorMessage": "Users must use the regular Phoenix 5 vendordep when using the regular Phoenix 6 vendordep.", + "offlineFileName": "Phoenix6-frc2025-latest.json" + }, + { + "uuid": "ab676553-b602-441f-a38d-f1296eff6537", + "errorMessage": "Users cannot have both the replay and regular Phoenix 5 vendordeps in their robot program.", + "offlineFileName": "Phoenix5-frc2025-latest.json" + } + ], + "javaDependencies": [ + { + "groupId": "com.ctre.phoenix", + "artifactId": "api-java", + "version": "5.35.1" + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "wpiapi-java", + "version": "5.35.1" + } + ], + "jniDependencies": [ + { + "groupId": "com.ctre.phoenix", + "artifactId": "cci", + "version": "5.35.1", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "linuxathena" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix.replay", + "artifactId": "cci-replay", + "version": "5.35.1", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix.sim", + "artifactId": "cci-sim", + "version": "5.35.1", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + } + ], + "cppDependencies": [ + { + "groupId": "com.ctre.phoenix", + "artifactId": "wpiapi-cpp", + "version": "5.35.1", + "libName": "CTRE_Phoenix_WPI", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "linuxathena" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "api-cpp", + "version": "5.35.1", + "libName": "CTRE_Phoenix", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "linuxathena" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "cci", + "version": "5.35.1", + "libName": "CTRE_PhoenixCCI", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "linuxathena" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix.replay", + "artifactId": "wpiapi-cpp-replay", + "version": "5.35.1", + "libName": "CTRE_Phoenix_WPIReplay", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix.replay", + "artifactId": "api-cpp-replay", + "version": "5.35.1", + "libName": "CTRE_PhoenixReplay", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix.replay", + "artifactId": "cci-replay", + "version": "5.35.1", + "libName": "CTRE_PhoenixCCIReplay", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix.sim", + "artifactId": "wpiapi-cpp-sim", + "version": "5.35.1", + "libName": "CTRE_Phoenix_WPISim", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix.sim", + "artifactId": "api-cpp-sim", + "version": "5.35.1", + "libName": "CTRE_PhoenixSim", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix.sim", + "artifactId": "cci-sim", + "version": "5.35.1", + "libName": "CTRE_PhoenixCCISim", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + } + ] +} \ No newline at end of file diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/vendordeps/Phoenix6-replay-25.2.0.json b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/vendordeps/Phoenix6-replay-25.2.0.json new file mode 100644 index 0000000..52725fb --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/vendordeps/Phoenix6-replay-25.2.0.json @@ -0,0 +1,467 @@ +{ + "fileName": "Phoenix6-replay-25.2.0.json", + "name": "CTRE-Phoenix (v6) Replay", + "version": "25.2.0", + "frcYear": "2025", + "uuid": "e7900d8d-826f-4dca-a1ff-182f658e98af", + "mavenUrls": [ + "https://maven.ctr-electronics.com/release/" + ], + "jsonUrl": "https://maven.ctr-electronics.com/release/com/ctre/phoenix6/latest/Phoenix6-replay-frc2025-latest.json", + "conflictsWith": [ + { + "uuid": "e995de00-2c64-4df5-8831-c1441420ff19", + "errorMessage": "Users can not have both the replay and regular Phoenix 6 vendordeps in their robot program.", + "offlineFileName": "Phoenix6-frc2025-latest.json" + } + ], + "javaDependencies": [ + { + "groupId": "com.ctre.phoenix6", + "artifactId": "wpiapi-java", + "version": "25.2.0" + } + ], + "jniDependencies": [ + { + "groupId": "com.ctre.phoenix6", + "artifactId": "api-cpp", + "version": "25.2.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "linuxathena" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix6", + "artifactId": "tools", + "version": "25.2.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "linuxathena" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix6.replay", + "artifactId": "api-cpp-replay", + "version": "25.2.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix6.replay", + "artifactId": "tools-replay", + "version": "25.2.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "api-cpp-sim", + "version": "25.2.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "tools-sim", + "version": "25.2.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simTalonSRX", + "version": "25.2.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simVictorSPX", + "version": "25.2.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simPigeonIMU", + "version": "25.2.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simCANCoder", + "version": "25.2.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProTalonFX", + "version": "25.2.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProTalonFXS", + "version": "25.2.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProCANcoder", + "version": "25.2.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProPigeon2", + "version": "25.2.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProCANrange", + "version": "25.2.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + } + ], + "cppDependencies": [ + { + "groupId": "com.ctre.phoenix6", + "artifactId": "wpiapi-cpp", + "version": "25.2.0", + "libName": "CTRE_Phoenix6_WPI", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "linuxathena" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix6", + "artifactId": "tools", + "version": "25.2.0", + "libName": "CTRE_PhoenixTools", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "linuxathena" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix6.replay", + "artifactId": "wpiapi-cpp-replay", + "version": "25.2.0", + "libName": "CTRE_Phoenix6_WPIReplay", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix6.replay", + "artifactId": "tools-replay", + "version": "25.2.0", + "libName": "CTRE_PhoenixTools_Replay", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "wpiapi-cpp-sim", + "version": "25.2.0", + "libName": "CTRE_Phoenix6_WPISim", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "tools-sim", + "version": "25.2.0", + "libName": "CTRE_PhoenixTools_Sim", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simTalonSRX", + "version": "25.2.0", + "libName": "CTRE_SimTalonSRX", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simVictorSPX", + "version": "25.2.0", + "libName": "CTRE_SimVictorSPX", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simPigeonIMU", + "version": "25.2.0", + "libName": "CTRE_SimPigeonIMU", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simCANCoder", + "version": "25.2.0", + "libName": "CTRE_SimCANCoder", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProTalonFX", + "version": "25.2.0", + "libName": "CTRE_SimProTalonFX", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProTalonFXS", + "version": "25.2.0", + "libName": "CTRE_SimProTalonFXS", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProCANcoder", + "version": "25.2.0", + "libName": "CTRE_SimProCANcoder", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProPigeon2", + "version": "25.2.0", + "libName": "CTRE_SimProPigeon2", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProCANrange", + "version": "25.2.0", + "libName": "CTRE_SimProCANrange", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + } + ] +} \ No newline at end of file diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/vendordeps/WPILibNewCommands.json b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/vendordeps/WPILibNewCommands.json new file mode 100644 index 0000000..3718e0a --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test-Imported/vendordeps/WPILibNewCommands.json @@ -0,0 +1,38 @@ +{ + "fileName": "WPILibNewCommands.json", + "name": "WPILib-New-Commands", + "version": "1.0.0", + "uuid": "111e20f7-815e-48f8-9dd6-e675ce75b266", + "frcYear": "2025", + "mavenUrls": [], + "jsonUrl": "", + "javaDependencies": [ + { + "groupId": "edu.wpi.first.wpilibNewCommands", + "artifactId": "wpilibNewCommands-java", + "version": "wpilib" + } + ], + "jniDependencies": [], + "cppDependencies": [ + { + "groupId": "edu.wpi.first.wpilibNewCommands", + "artifactId": "wpilibNewCommands-cpp", + "version": "wpilib", + "libName": "wpilibNewCommands", + "headerClassifier": "headers", + "sourcesClassifier": "sources", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "linuxathena", + "linuxarm32", + "linuxarm64", + "windowsx86-64", + "windowsx86", + "linuxx86-64", + "osxuniversal" + ] + } + ] +} diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/.wpilib/wpilib_preferences.json b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/.wpilib/wpilib_preferences.json new file mode 100644 index 0000000..a5ebb07 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/.wpilib/wpilib_preferences.json @@ -0,0 +1,6 @@ +{ + "enableCppIntellisense": false, + "currentLanguage": "java", + "projectYear": "2024", + "teamNumber": 5098 +} \ No newline at end of file diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/WPILib-License.md b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/WPILib-License.md new file mode 100644 index 0000000..e7cd597 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/WPILib-License.md @@ -0,0 +1,24 @@ +Copyright (c) 2009-2024 FIRST and other WPILib contributors +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of FIRST, WPILib, nor the names of other WPILib + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY FIRST AND OTHER WPILIB CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY NONINFRINGEMENT AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL FIRST OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/build.gradle b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/build.gradle new file mode 100644 index 0000000..1e8da00 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/build.gradle @@ -0,0 +1,101 @@ +plugins { + id "java" + id "edu.wpi.first.GradleRIO" version "2024.2.1" +} + +java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 +} + +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' + } + } + } + } +} + +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 = false + +// 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() + + 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) + + 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() + + testImplementation 'org.junit.jupiter:junit-jupiter:5.10.1' + testRuntimeOnly 'org.junit.platform:junit-platform-launcher' +} + +test { + useJUnitPlatform() + systemProperty 'junit.jupiter.extensions.autodetection.enabled', 'true' +} + +// Simulation configuration (e.g. environment variables). +wpi.sim.addGui().defaultEnabled = true +wpi.sim.addDriverstation() + +// Setting up my Jar File. In this case, adding all libraries into the main jar ('fat jar') +// 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) } } + from sourceSets.main.allSource + manifest edu.wpi.first.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) + +// Configure string concat to always inline compile +tasks.withType(JavaCompile) { + options.compilerArgs.add '-XDstringConcat=inline' +} diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/gradle/wrapper/gradle-wrapper.properties b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..7015f6b --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=permwrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=permwrapper/dists diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/gradlew b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/gradlew new file mode 100644 index 0000000..1aa94a4 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/gradlew @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/gradlew.bat b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/gradlew.bat new file mode 100644 index 0000000..6689b85 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/settings.gradle b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/settings.gradle new file mode 100644 index 0000000..3e30f84 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/settings.gradle @@ -0,0 +1,30 @@ +import org.gradle.internal.os.OperatingSystem + +pluginManagement { + repositories { + mavenLocal() + gradlePluginPortal() + String frcYear = '2024' + 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 + } + } +} + +Properties props = System.getProperties(); +props.setProperty("org.gradle.internal.native.headers.unresolved.dependencies.ignore", "true"); diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/src/main/deploy/example.txt b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/src/main/deploy/example.txt new file mode 100644 index 0000000..bb82515 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/src/main/deploy/example.txt @@ -0,0 +1,3 @@ +Files placed in this directory will be deployed to the RoboRIO into the +'deploy' directory in the home folder. Use the 'Filesystem.getDeployDirectory' wpilib function +to get a proper path relative to the deploy directory. \ No newline at end of file diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/src/main/java/frc/robot/Constants.java b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/src/main/java/frc/robot/Constants.java new file mode 100644 index 0000000..c50ba05 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/src/main/java/frc/robot/Constants.java @@ -0,0 +1,19 @@ +// 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; + +/** + * The Constants class provides a convenient place for teams to hold robot-wide numerical or boolean + * constants. This class should not be used for any other purpose. All constants should be declared + * globally (i.e. public static). Do not put anything functional in this class. + * + *It is advised to statically import this class (or one of its inner classes) wherever the + * constants are needed, to reduce verbosity. + */ +public final class Constants { + public static class OperatorConstants { + public static final int kDriverControllerPort = 0; + } +} diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/src/main/java/frc/robot/Main.java b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/src/main/java/frc/robot/Main.java new file mode 100644 index 0000000..8776e5d --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/src/main/java/frc/robot/Main.java @@ -0,0 +1,25 @@ +// 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; + +/** + * Do NOT add any static variables to this class, or any initialization at all. Unless you know what + * you are doing, do not modify this file except to change the parameter class to the startRobot + * call. + */ +public final class Main { + private Main() {} + + /** + * Main initialization function. Do not perform any initialization here. + * + *
If you change your main robot class, change the parameter type. + */ + public static void main(String... args) { + RobotBase.startRobot(Robot::new); + } +} diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/src/main/java/frc/robot/Robot.java b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/src/main/java/frc/robot/Robot.java new file mode 100644 index 0000000..687a0a0 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/src/main/java/frc/robot/Robot.java @@ -0,0 +1,103 @@ +// 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.TimedRobot; +import edu.wpi.first.wpilibj2.command.Command; +import edu.wpi.first.wpilibj2.command.CommandScheduler; + +/** + * The VM is configured to automatically run this class, and to call the functions corresponding to + * each mode, as described in the TimedRobot documentation. If you change the name of this class or + * the package after creating this project, you must also update the build.gradle file in the + * project. + */ +public class Robot extends TimedRobot { + private Command m_autonomousCommand; + + private RobotContainer m_robotContainer; + + /** + * This function is run when the robot is first started up and should be used for any + * initialization code. + */ + @Override + public void robotInit() { + // Instantiate our RobotContainer. This will perform all our button bindings, and put our + // autonomous chooser on the dashboard. + m_robotContainer = new RobotContainer(); + } + + /** + * This function is called every 20 ms, no matter the mode. Use this for items like diagnostics + * that you want ran during disabled, autonomous, teleoperated and test. + * + *
This runs after the mode specific periodic functions, but before LiveWindow and + * SmartDashboard integrated updating. + */ + @Override + public void robotPeriodic() { + // Runs the Scheduler. This is responsible for polling buttons, adding newly-scheduled + // commands, running already-scheduled commands, removing finished or interrupted commands, + // and running subsystem periodic() methods. This must be called from the robot's periodic + // block in order for anything in the Command-based framework to work. + CommandScheduler.getInstance().run(); + } + + /** This function is called once each time the robot enters Disabled mode. */ + @Override + public void disabledInit() {} + + @Override + public void disabledPeriodic() {} + + /** This autonomous runs the autonomous command selected by your {@link RobotContainer} class. */ + @Override + public void autonomousInit() { + m_autonomousCommand = m_robotContainer.getAutonomousCommand(); + + // schedule the autonomous command (example) + if (m_autonomousCommand != null) { + m_autonomousCommand.schedule(); + } + } + + /** This function is called periodically during autonomous. */ + @Override + public void autonomousPeriodic() {} + + @Override + public void teleopInit() { + // This makes sure that the autonomous stops running when + // teleop starts running. If you want the autonomous to + // continue until interrupted by another command, remove + // this line or comment it out. + if (m_autonomousCommand != null) { + m_autonomousCommand.cancel(); + } + } + + /** This function is called periodically during operator control. */ + @Override + public void teleopPeriodic() {} + + @Override + public void testInit() { + // Cancels all running commands at the start of test mode. + CommandScheduler.getInstance().cancelAll(); + } + + /** This function is called periodically during test mode. */ + @Override + public void testPeriodic() {} + + /** This function is called once when the robot is first started up. */ + @Override + public void simulationInit() {} + + /** This function is called periodically whilst in simulation. */ + @Override + public void simulationPeriodic() {} +} diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/src/main/java/frc/robot/RobotContainer.java b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/src/main/java/frc/robot/RobotContainer.java new file mode 100644 index 0000000..a33249e --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/src/main/java/frc/robot/RobotContainer.java @@ -0,0 +1,63 @@ +// 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.Constants.OperatorConstants; +import frc.robot.commands.Autos; +import frc.robot.commands.ExampleCommand; +import frc.robot.subsystems.ExampleSubsystem; +import edu.wpi.first.wpilibj2.command.Command; +import edu.wpi.first.wpilibj2.command.button.CommandXboxController; +import edu.wpi.first.wpilibj2.command.button.Trigger; + +/** + * This class is where the bulk of the robot should be declared. Since Command-based is a + * "declarative" paradigm, very little robot logic should actually be handled in the {@link Robot} + * periodic methods (other than the scheduler calls). Instead, the structure of the robot (including + * subsystems, commands, and trigger mappings) should be declared here. + */ +public class RobotContainer { + // The robot's subsystems and commands are defined here... + private final ExampleSubsystem m_exampleSubsystem = new ExampleSubsystem(); + + // Replace with CommandPS4Controller or CommandJoystick if needed + private final CommandXboxController m_driverController = + new CommandXboxController(OperatorConstants.kDriverControllerPort); + + /** The container for the robot. Contains subsystems, OI devices, and commands. */ + public RobotContainer() { + // Configure the trigger bindings + configureBindings(); + } + + /** + * Use this method to define your trigger->command mappings. Triggers can be created via the + * {@link Trigger#Trigger(java.util.function.BooleanSupplier)} constructor with an arbitrary + * predicate, or via the named factories in {@link + * edu.wpi.first.wpilibj2.command.button.CommandGenericHID}'s subclasses for {@link + * CommandXboxController Xbox}/{@link edu.wpi.first.wpilibj2.command.button.CommandPS4Controller + * PS4} controllers or {@link edu.wpi.first.wpilibj2.command.button.CommandJoystick Flight + * joysticks}. + */ + private void configureBindings() { + // Schedule `ExampleCommand` when `exampleCondition` changes to `true` + new Trigger(m_exampleSubsystem::exampleCondition) + .onTrue(new ExampleCommand(m_exampleSubsystem)); + + // Schedule `exampleMethodCommand` when the Xbox controller's B button is pressed, + // cancelling on release. + m_driverController.b().whileTrue(m_exampleSubsystem.exampleMethodCommand()); + } + + /** + * Use this to pass the autonomous command to the main {@link Robot} class. + * + * @return the command to run in autonomous + */ + public Command getAutonomousCommand() { + // An example command will be run in autonomous + return Autos.exampleAuto(m_exampleSubsystem); + } +} diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/src/main/java/frc/robot/commands/Autos.java b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/src/main/java/frc/robot/commands/Autos.java new file mode 100644 index 0000000..107aad7 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/src/main/java/frc/robot/commands/Autos.java @@ -0,0 +1,20 @@ +// 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.commands; + +import frc.robot.subsystems.ExampleSubsystem; +import edu.wpi.first.wpilibj2.command.Command; +import edu.wpi.first.wpilibj2.command.Commands; + +public final class Autos { + /** Example static factory for an autonomous command. */ + public static Command exampleAuto(ExampleSubsystem subsystem) { + return Commands.sequence(subsystem.exampleMethodCommand(), new ExampleCommand(subsystem)); + } + + private Autos() { + throw new UnsupportedOperationException("This is a utility class!"); + } +} diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/src/main/java/frc/robot/commands/ExampleCommand.java b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/src/main/java/frc/robot/commands/ExampleCommand.java new file mode 100644 index 0000000..7481d3c --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/src/main/java/frc/robot/commands/ExampleCommand.java @@ -0,0 +1,43 @@ +// 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.commands; + +import frc.robot.subsystems.ExampleSubsystem; +import edu.wpi.first.wpilibj2.command.Command; + +/** An example command that uses an example subsystem. */ +public class ExampleCommand extends Command { + @SuppressWarnings({"PMD.UnusedPrivateField", "PMD.SingularField"}) + private final ExampleSubsystem m_subsystem; + + /** + * Creates a new ExampleCommand. + * + * @param subsystem The subsystem used by this command. + */ + public ExampleCommand(ExampleSubsystem subsystem) { + m_subsystem = subsystem; + // Use addRequirements() here to declare subsystem dependencies. + addRequirements(subsystem); + } + + // Called when the command is initially scheduled. + @Override + public void initialize() {} + + // Called every time the scheduler runs while the command is scheduled. + @Override + public void execute() {} + + // Called once the command ends or is interrupted. + @Override + public void end(boolean interrupted) {} + + // Returns true when the command should end. + @Override + public boolean isFinished() { + return false; + } +} diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/src/main/java/frc/robot/controllers/LogitechF310.java b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/src/main/java/frc/robot/controllers/LogitechF310.java new file mode 100644 index 0000000..74a8997 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/src/main/java/frc/robot/controllers/LogitechF310.java @@ -0,0 +1,463 @@ +package frc.controllers; + +import edu.wpi.first.wpilibj.Joystick; + +/** + * This class is used to create an LogitechF310 controller object. + *
+ * This class uses the {@code Joystick} class from the wpilibj library. + *
+ *+ * This uses a deadband that can be set if needed. This helps control drift. + * This value can be in a range of 0 to 1. The higher the value, the more the + * stick has to move to register. This value is set in the constructor and is + * set alongside the controller ID. As a note: The deadband is only applied + * to the joystick axes. + *
+ * + * @see PS4 + * @see Xbox + * + * @see edu.wpi.first.wpilibj.Joystick + */ +public class LogitechF310 { + + // Button IDs // + + /** + * The axis ID for the left joystick x. + */ + private static final int JOYSTICK_LEFT_X = 0; + + /** + * The axis ID for the left joystick y. + */ + private static final int JOYSTICK_LEFT_Y = 1; + + /** + * The axis ID for the left trigger. + */ + private static final int TRIGGER_LEFT = 2; + + /** + * The axis ID for the right trigger. + */ + private static final int TRIGGER_RIGHT = 3; + + /** + * The axis ID for the right joystick x. + */ + private static final int JOYSTICK_RIGHT_X = 4; + + /** + * The axis ID for the right joystick y. + */ + private static final int JOYSTICK_RIGHT_Y = 5; + + /** + * The button ID for the A button. + */ + private static final int BUTTON_A = 1; + + /** + * The button ID for the B button. + */ + private static final int BUTTON_B = 2; + + /** + * The button ID for the X button. + */ + private static final int BUTTON_X = 3; + + /** + * The button ID for the Y button. + */ + private static final int BUTTON_Y = 4; + + /** + * The button ID for the left bumper. + */ + private static final int BUTTON_LEFT_BUMPER = 5; + + /** + * The button ID for the right bumper. + */ + private static final int BUTTON_RIGHT_BUMPER = 6; + + /** + * The button ID for the start button. + */ + private static final int BUTTON_START = 7; + + /** + * The button ID for the back button. + */ + private static final int BUTTON_BACK = 8; + + /** + * The controller object. + * In this case, a {@code Joystick} object. + * + * @see edu.wpi.first.wpilibj.Joystick + */ + private Joystick controller; + + /** + * The deadband value. + */ + private double deadBand; + + /** + * Constructor for the LogitechF310 class. + *+ * This constructor is used to create a LogitechF310 object. + * This takes in the controller ID and the deadband value. + *
+ * + * @param id Controller ID (Port) + * @param deadBandValue Deadband value + */ + public LogitechF310(final int id, final double deadBandValue) { + controller = new Joystick(id); + deadBand = deadBandValue; + } + + // Deadband Method // + + /** + * Method for setting the deadband of the controller on the X and Y axes. + *+ * This sets a threshold the joystick must pass before registering a value. + * This value can be in a range of 0 to 1. The higher the value, + * the more the joystick has to move to register. + *
+ * + * @return Deadbanded value + * + * @param value Value to be deadbanded + */ + private double deadBand(final double value) { + return Math.abs(value) < deadBand ? 0 : value; + } + + // Joystick Methods // + + /** + * Method for returning the X value of the left joystick. + * + * @return X value of the left joystick + * + * @see LogitechF310#getRightX + * @see LogitechF310#getRightY + * @see LogitechF310#getLeftY + */ + public double getLeftX() { + return deadBand(controller.getRawAxis(JOYSTICK_LEFT_X)); + } + + /** + * Method for returning the Y value of the left joystick. + * + * @return Y value of the left joystick + * + * @see LogitechF310#getRightX + * @see LogitechF310#getRightY + * @see LogitechF310#getLeftX + */ + public double getLeftY() { + return deadBand(controller.getRawAxis(JOYSTICK_LEFT_Y)); + } + + /** + * Method for returning the X value of the right joystick. + * + * @return X value of the right joystick + * + * @see LogitechF310#getRightY + * @see LogitechF310#getLeftX + * @see LogitechF310#getLeftY + */ + public double getRightX() { + return deadBand(controller.getRawAxis(JOYSTICK_RIGHT_X)); + } + + /** + * Method for returning the Y value of the right joystick. + * + * @return Y value of the right joystick + * + * @see LogitechF310#getRightX + * @see LogitechF310#getLeftX + * @see LogitechF310#getLeftY + */ + public double getRightY() { + return deadBand(controller.getRawAxis(JOYSTICK_RIGHT_Y)); + } + + // Trigger Methods // + + /** + * Method for returning the value of the left trigger. + * + * @return Value of the left trigger + * + * @see LogitechF310#getRightTrigger + */ + public double getLeftTrigger() { + return deadBand(controller.getRawAxis(TRIGGER_LEFT)); + } + + /** + * Method for returning the value of the right trigger. + * + * @return Value of the right trigger + * + * @see LogitechF310#getLeftTrigger + */ + public double getRightTrigger() { + return deadBand(controller.getRawAxis(TRIGGER_RIGHT)); + } + + // Button Methods // + + /** + * Method for returning the value of the A button. + * + * @return Value of the A button + * + * @see LogitechF310#getBButton + * @see LogitechF310#getXButton + * @see LogitechF310#getYButton + */ + public boolean getAButton() { + return controller.getRawButton(BUTTON_A); + } + + /** + * Method for returning the value of the B button. + * + * @return Value of the B button + * + * @see LogitechF310#getAButton + * @see LogitechF310#getXButton + * @see LogitechF310#getYButton + */ + public boolean getBButton() { + return controller.getRawButton(BUTTON_B); + } + + /** + * Method for returning the value of the X button. + * + * @return Value of the X button + * + * @see LogitechF310#getAButton + * @see LogitechF310#getBButton + * @see LogitechF310#getYButton + */ + public boolean getXButton() { + return controller.getRawButton(BUTTON_X); + } + + /** + * Method for returning the value of the Y button. + * + * @return Value of the Y button + * + * @see LogitechF310#getAButton + * @see LogitechF310#getBButton + * @see LogitechF310#getXButton + */ + public boolean getYButton() { + return controller.getRawButton(BUTTON_Y); + } + + /** + * Method for returning the value of the back button. + * + * @return Value of the back button + * + * @see LogitechF310#getStartButton + */ + public boolean getBackButton() { + return controller.getRawButton(BUTTON_START); + } + + /** + * Method for returning the value of the start button. + * + * @return Value of the start button + * + * @see LogitechF310#getBackButton + */ + public boolean getStartButton() { + return controller.getRawButton(BUTTON_BACK); + } + + /** + * Method for returning the value of the left bumper. + * + * @return Value of the left bumper + * + * @see LogitechF310#getRightBumper + */ + public boolean getLeftBumper() { + return controller.getRawButton(BUTTON_LEFT_BUMPER); + } + + /** + * Method for returning the value of the right bumper. + * + * @return Value of the right bumper + * + * @see LogitechF310#getLeftBumper + */ + public boolean getRightBumper() { + return controller.getRawButton(BUTTON_RIGHT_BUMPER); + } + + // D-Pad Methods // + + public enum DPad { + /** + * Up on the D-Pad. + */ + up, + + /** + * Down on the D-Pad. + */ + down, + + /** + * Right on the D-Pad. + */ + left, + + /** + * Left on the D-Pad. + */ + right, + + /** + * Up-Right on the D-Pad. + */ + upright, + + /** + * Up-Left on the D-Pad. + */ + upleft, + + /** + * Down-Right on the D-Pad. + */ + downright, + + /** + * Down-Left on the D-Pad. + */ + downleft, + + /** + * No direction on the D-Pad. + */ + none + } + + /** + * Upright D-Pad POV value. + */ + private static final int DPAD_UPRIGHT = 45; + + /** + * Right D-Pad POV value. + */ + private static final int DPAD_RIGHT = 90; + + /** + * Downright D-Pad POV value. + */ + private static final int DPAD_DOWNRIGHT = 135; + + /** + * Down POV D-Pad value. + */ + private static final int DPAD_DOWN = 180; + + /** + * Downleft D-Pad POV value. + */ + private static final int DPAD_DOWNLEFT = 225; + + /** + * Left D-Pad POV value. + */ + private static final int DPAD_LEFT = 270; + + /** + * Upleft D-Pad POV value. + */ + private static final int DPAD_UPLEFT = 315; + + /** + * Up D-Pad POV value. + */ + private static final int DPAD_UP = 360; + + /** + * Method for returning the value of the D-Pad. + * + * @return value of the D-Pad + * + * @see LogitechF310.DPad + */ + public DPad getDPad() { + switch (controller.getPOV()) { + case 0: + return DPad.up; + case DPAD_UPRIGHT: + return DPad.upright; + case DPAD_RIGHT: + return DPad.right; + case DPAD_DOWNRIGHT: + return DPad.downright; + case DPAD_DOWN: + return DPad.down; + case DPAD_DOWNLEFT: + return DPad.downleft; + case DPAD_LEFT: + return DPad.left; + case DPAD_UPLEFT: + return DPad.upleft; + case DPAD_UP: + return DPad.up; + default: + return DPad.none; + } + } + + // Rumble Methods // + + // This controller does not have rumble functionality :( + + // General Methods // + + /** + * Method for checking if the controller is connected. + * + * @return true if the controller is connected, false if not + */ + public boolean isConnected() { + return (controller.isConnected()); + } + + /** + * Method for getting the name of the controller. + * + * @return name of the controller + */ + public String getName() { + return controller.getName(); + } +} diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/src/main/java/frc/robot/controllers/PS4.java b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/src/main/java/frc/robot/controllers/PS4.java new file mode 100644 index 0000000..cef2652 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/src/main/java/frc/robot/controllers/PS4.java @@ -0,0 +1,498 @@ +package frc.controllers; + +import edu.wpi.first.wpilibj.PS4Controller; +import edu.wpi.first.wpilibj.GenericHID.RumbleType; + +/** + * This class is used to create an PS4 controller object. + *+ * This class uses the {@code PS4Controller} class from the wpilibj library. + *
+ *+ * This uses a deadband that can be set if needed. This helps control drift. + * This value can be in a range of 0 to 1. The higher the value, the more the + * stick has to move to register. This value is set in the constructor and is + * set alongside the controller ID. As a note: The deadband is only applied + * to the joystick axes. + *
+ * + * @see LogitechF310 + * @see Xbox + * + * @see edu.wpi.first.wpilibj.PS4Controller + */ +public class PS4 { + + /** + * The controller object. + * In this case, a {@code PS4Controller} object. + * + * @see edu.wpi.first.wpilibj.PS4Controller + */ + private PS4Controller controller; + + /** + * The deadband value. + */ + private double deadBand; + + /** + * Constructor for the PS4 class. + *+ * This constructor is used to create a LogitechF310 object. + * This takes in the controller ID and the deadband value. + *
+ * + * @param id Controller ID (Port) + * @param deadBandValue Deadband value + */ + public PS4(final int id, final double deadBandValue) { + controller = new PS4Controller(id); + deadBand = deadBandValue; + } + + // Deadband Method // + + // Although this isn't really needed for newer controllers, + // it's still here just in case one might develop drift + + /** + * Method for setting the deadband of the controller on the X and Y axes. + *+ * This sets a threshold the joystick must pass before registering a value. + * This value can be in a range of 0 to 1. The higher the value, + * the more the joystick has to move to register. + *
+ * + * @return Deadbanded value + * + * @param value Value to be deadbanded + */ + private double deadBand(final double value) { + return Math.abs(value) < deadBand ? 0 : value; + } + + // Joystick Methods // + + /** + * Method for returning the X value of the left joystick. + * + * @return X value of the left joystick + * + * @see PS4#getRightX + * @see PS4#getRightY + * @see PS4#getLeftY + */ + public double getLeftX() { + return deadBand(controller.getLeftX()); + } + + /** + * Method for returning the Y value of the left joystick. + * + * @return Y value of the left joystick + * + * @see PS4#getRightX + * @see PS4#getRightY + * @see PS4#getLeftX + */ + public double getLeftY() { + return deadBand(controller.getLeftY()); + } + + /** + * Method for returning the X value of the right joystick. + * + * @return X value of the right joystick + * + * @see PS4#getLeftX + * @see PS4#getRightY + * @see PS4#getLeftY + */ + public double getRightX() { + return deadBand(controller.getRightX()); + } + + /** + * Method for returning the Y value of the right joystick. + * + * @return Y value of the right joystick + * + * @see PS4#getRightX + * @see PS4#getLeftX + * @see PS4#getLeftY + */ + public double getRightY() { + return deadBand(controller.getRightY()); + } + + // Trigger Methods // + + /** + * Method for returning the value of the left trigger. + * + * @return value of the left trigger + * + * @see PS4#getRightTrigger + */ + public double getLeftTrigger() { + return deadBand(controller.getL2Axis()); + } + + /** + * Method for returning the value of the right trigger. + * + * @return value of the right trigger + * + * @see PS4#getLeftTrigger + */ + public double getRightTrigger() { + return deadBand(controller.getR2Axis()); + } + + // Button Methods // + + /** + * Method for returning the value of the X button. + * + * @return value of the X button + * + * @see PS4#getSquareButton + * @see PS4#getCircleButton + * @see PS4#getTriangleButton + * @see PS4#getShareButton + * @see PS4#getOptionsButton + * @see PS4#getPlayStationButton + * @see PS4#getTouchpadButton + */ + public boolean getXButton() { + return controller.getCrossButton(); + } + + /** + * Method for returning the value of the Square button. + * + * @return value of the Square button + * + * @see PS4#getXButton + * @see PS4#getCircleButton + * @see PS4#getTriangleButton + * @see PS4#getShareButton + * @see PS4#getOptionsButton + * @see PS4#getPlayStationButton + * @see PS4#getTouchpadButton + */ + public boolean getSquareButton() { + return controller.getSquareButton(); + } + + /** + * Method for returning the value of the Circle button. + * + * @return value of the Circle button + * + * @see PS4#getXButton + * @see PS4#getSquareButton + * @see PS4#getTriangleButton + * @see PS4#getShareButton + * @see PS4#getOptionsButton + * @see PS4#getPlayStationButton + * @see PS4#getTouchpadButton + */ + public boolean getCircleButton() { + return controller.getCircleButton(); + } + + /** + * Method for returning the value of the Triangle button. + * + * @return value of the Triangle button + * + * @see PS4#getXButton + * @see PS4#getSquareButton + * @see PS4#getCircleButton + * @see PS4#getShareButton + * @see PS4#getOptionsButton + * @see PS4#getPlayStationButton + * @see PS4#getTouchpadButton + */ + public boolean getTriangleButton() { + return controller.getTriangleButton(); + } + + /** + * Method for returning the value of the Share button. + * + * @return value of the Share button + * + * @see PS4#getXButton + * @see PS4#getSquareButton + * @see PS4#getCircleButton + * @see PS4#getTriangleButton + * @see PS4#getOptionsButton + * @see PS4#getPlayStationButton + * @see PS4#getTouchpadButton + */ + public boolean getShareButton() { + return controller.getShareButton(); + } + + /** + * Method for returning the value of the Options button. + * + * @return value of the Options button + * + * @see PS4#getXButton + * @see PS4#getSquareButton + * @see PS4#getCircleButton + * @see PS4#getTriangleButton + * @see PS4#getShareButton + * @see PS4#getPlayStationButton + * @see PS4#getTouchpadButton + */ + public boolean getOptionsButton() { + return controller.getOptionsButton(); + } + + /** + * Method for returning the value of the PlayStation button. + * + * @return value of the PlayStation button + * + * @see PS4#getXButton + * @see PS4#getSquareButton + * @see PS4#getCircleButton + * @see PS4#getTriangleButton + * @see PS4#getShareButton + * @see PS4#getOptionsButton + * @see PS4#getTouchpadButton + */ + public boolean getPlayStationButton() { + return controller.getPSButton(); + } + + /** + * Method for returning the value of the left bumper. + * + * @return value of the left bumper + * + * @see PS4#getRightBumper + */ + public boolean getLeftBumper() { + return controller.getL1Button(); + } + + /** + * Method for returning the value of the right bumper. + * + * @return value of the right bumper + * + * @see PS4#getLeftBumper + */ + public boolean getRightBumper() { + return controller.getR1Button(); + } + + /** + * Method for returning the value of the left joystick button. + * + * @return value of the left joystick button + * + * @see PS4#getRightJoystickButton + */ + public boolean getLeftJoystickButton() { + return controller.getL3Button(); + } + + /** + * Method for returning the value of the right joystick button. + * + * @return value of the right joystick button + * + * @see PS4#getLeftJoystickButton + */ + public boolean getRightJoystickButton() { + return controller.getR3Button(); + } + + // Touchpad Methods // + + /** + * Method for returning the value of the Touchpad button. + * + * @return value of the Touchpad button + * + * @see PS4#getXButton + * @see PS4#getSquareButton + * @see PS4#getCircleButton + * @see PS4#getTriangleButton + * @see PS4#getShareButton + * @see PS4#getOptionsButton + * @see PS4#getPlayStationButton + */ + public boolean getTouchpadButton() { + return controller.getTouchpad(); + } + + // There is a 'touchpad' that uses an event loop + // but for the purpose of this class, it is not needed + // It might be added in a future version if there becomes a need for it + // If you have a need for it or have added it yourself, + // Submit a pull request or submit an issue on the GitHub repository + // https://github.com/J-The-Fox/FRC-Team-5098 + + // D-Pad Methods // + + public enum DPad { + /** + * Up on the D-Pad. + */ + up, + + /** + * Down on the D-Pad. + */ + down, + + /** + * Right on the D-Pad. + */ + left, + + /** + * Left on the D-Pad. + */ + right, + + /** + * Up-Right on the D-Pad. + */ + upright, + + /** + * Up-Left on the D-Pad. + */ + upleft, + + /** + * Down-Right on the D-Pad. + */ + downright, + + /** + * Down-Left on the D-Pad. + */ + downleft, + + /** + * No direction on the D-Pad. + */ + none + } + + /** + * Upright D-Pad POV value. + */ + private static final int DPAD_UPRIGHT = 45; + + /** + * Right D-Pad POV value. + */ + private static final int DPAD_RIGHT = 90; + + /** + * Downright D-Pad POV value. + */ + private static final int DPAD_DOWNRIGHT = 135; + + /** + * Down POV D-Pad value. + */ + private static final int DPAD_DOWN = 180; + + /** + * Downleft D-Pad POV value. + */ + private static final int DPAD_DOWNLEFT = 225; + + /** + * Left D-Pad POV value. + */ + private static final int DPAD_LEFT = 270; + + /** + * Upleft D-Pad POV value. + */ + private static final int DPAD_UPLEFT = 315; + + /** + * Up D-Pad POV value. + */ + private static final int DPAD_UP = 360; + + /** + * Method for returning the value of the D-Pad. + * + * @return value of the D-Pad + * + * @see PS4.DPad + */ + public DPad getDPad() { + switch (controller.getPOV()) { + case 0: + return DPad.up; + case DPAD_UPRIGHT: + return DPad.upright; + case DPAD_RIGHT: + return DPad.right; + case DPAD_DOWNRIGHT: + return DPad.downright; + case DPAD_DOWN: + return DPad.down; + case DPAD_DOWNLEFT: + return DPad.downleft; + case DPAD_LEFT: + return DPad.left; + case DPAD_UPLEFT: + return DPad.upleft; + case DPAD_UP: + return DPad.up; + default: + return DPad.none; + } + } + + // Rumble Methods // + + /** + * Method for setting the rumble of the controller. + * + * @param type type of rumble to set + * @param value value to set the rumble to + * + * @see edu.wpi.first.wpilibj.GenericHID.RumbleType + */ + public void setRumble(final RumbleType type, final double value) { + controller.setRumble(type, value); + } + + // General Methods // + + /** + * Method for checking if the controller is connected. + * + * @return true if the controller is connected, false if not + */ + public boolean isConnected() { + return (controller.isConnected()); + } + + /** + * Method for getting the name of the controller. + * + * @return name of the controller + */ + public String getName() { + return controller.getName(); + } +} diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/src/main/java/frc/robot/controllers/Xbox.java b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/src/main/java/frc/robot/controllers/Xbox.java new file mode 100644 index 0000000..c8cc131 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/src/main/java/frc/robot/controllers/Xbox.java @@ -0,0 +1,425 @@ +package frc.controllers; + +import edu.wpi.first.wpilibj.XboxController; +import edu.wpi.first.wpilibj.GenericHID.RumbleType; + +/** + * This class is used to create an Xbox controller object. + *+ * This class uses the {@code XboxController} class from the wpilibj library. + *
+ *+ * This uses a deadband that can be set if needed. This helps control drift. + * This value can be in a range of 0 to 1. The higher the value, the more the + * stick has to move to register. This value is set in the constructor and is + * set alongside the controller ID. As a note: The deadband is only applied + * to the joystick axes. + *
+ * + * @see LogitechF310 + * @see PS4 + * + * @see edu.wpi.first.wpilibj.XboxController + */ +public class Xbox { + + /** + * The controller object. + * In this case, a {@code XboxController} object. + */ + private XboxController controller; + + /** + * The deadband value. + */ + private double deadBand; + + /** + * Constructor for the Xbox class. + *+ * This constructor is used to create a LogitechF310 object. + * This takes in the controller ID and the deadband value. + *
+ * + * @param id Controller ID (Port) + * @param deadBandValue Deadband value + */ + public Xbox(final int id, final double deadBandValue) { + controller = new XboxController(id); + deadBand = deadBandValue; + } + + // Deadband Method // + + // Although this isn't really needed for newer controllers, + // it's still here just in case one might develop drift + + /** + * Method for setting the deadband of the controller on the X and Y axes. + *+ * This sets a threshold the joystick must pass before registering a value. + * This value can be in a range of 0 to 1. The higher the value, + * the more the joystick has to move to register. + *
+ * + * @return Deadbanded value + * + * @param value Value to be deadbanded + */ + private double deadBand(final double value) { + return Math.abs(value) < deadBand ? 0 : value; + } + + // Joystick Methods // + + /** + * Method for returning the X value of the left joystick. + * + * @return X value of the left joystick + * + * @see Xbox#getRightX + * @see Xbox#getRightY + * @see Xbox#getLeftY + */ + public double getLeftX() { + return deadBand(controller.getLeftX()); + } + + /** + * Method for returning the Y value of the left joystick. + * + * @return Y value of the left joystick + * + * @see Xbox#getRightX + * @see Xbox#getRightY + * @see Xbox#getLeftX + */ + public double getLeftY() { + return deadBand(controller.getLeftY()); + } + + /** + * Method for returning the X value of the right joystick. + * + * @return X value of the right joystick + * + * @see Xbox#getRightY + * @see Xbox#getLeftX + * @see Xbox#getLeftY + */ + public double getRightX() { + return deadBand(controller.getRightX()); + } + + /** + * Method for returning the Y value of the right joystick. + * + * @return Y value of the right joystick + * + * @see Xbox#getRightX + * @see Xbox#getLeftX + * @see Xbox#getLeftY + */ + public double getRightY() { + return deadBand(controller.getRightY()); + } + + // Trigger Methods // + + /** + * Method for returning the value of the left trigger. + * + * @return value of the left trigger + * + * @see Xbox#getRightTrigger + */ + public double getLeftTrigger() { + return controller.getLeftTriggerAxis(); + } + + /** + * Method for returning the value of the right trigger. + * + * @return value of the right trigger + * + * @see Xbox#getLeftTrigger + */ + public double getRightTrigger() { + return controller.getRightTriggerAxis(); + } + + // Button Methods // + + /** + * Method for returning the value of the A button. + * + * @return value of the A button + * + * @see Xbox#getBButton + * @see Xbox#getXButton + * @see Xbox#getYButton + */ + public boolean getAButton() { + return controller.getAButton(); + } + + /** + * Method for returning the value of the B button. + * + * @return value of the B button + * + * @see Xbox#getAButton + * @see Xbox#getXButton + * @see Xbox#getYButton + */ + public boolean getBButton() { + return controller.getBButton(); + } + + /** + * Method for returning the value of the X button. + * + * @return value of the X button + * + * @see Xbox#getAButton + * @see Xbox#getBButton + * @see Xbox#getYButton + */ + public boolean getXButton() { + return controller.getXButton(); + } + + /** + * Method for returning the value of the Y button. + * + * @return value of the Y button + * + * @see Xbox#getAButton + * @see Xbox#getBButton + * @see Xbox#getXButton + */ + public boolean getYButton() { + return controller.getYButton(); + } + + /** + * Method for returning the value of the start button. + * + * @return value of the start button + * + * @see Xbox#getBackButton + */ + public boolean getStartButton() { + return controller.getStartButton(); + } + + /** + * Method for returning the value of the back button. + * + * @return value of the back button + * + * @see Xbox#getStartButton + */ + public boolean getBackButton() { + return controller.getBackButton(); + } + + /** + * Method for returning the value of the left bumper. + * + * @return value of the left bumper + * + * @see Xbox#getRightBumper + */ + public boolean getLeftBumper() { + return controller.getLeftBumper(); + } + + /** + * Method for returning the value of the right bumper. + * + * @return value of the right bumper + * + * @see Xbox#getLeftBumper + */ + public boolean getRightBumper() { + return controller.getRightBumper(); + } + + /** + * Method for returning the value of the left stick button. + * + * @return value of the left stick button + * + * @see Xbox#getRightStickButton + */ + public boolean getLeftStickButton() { + return controller.getLeftStickButton(); + } + + /** + * Method for returning the value of the right stick button. + * + * @return value of the right stick button + * + * @see Xbox#getLeftStickButton + */ + public boolean getRightStickButton() { + return controller.getRightStickButton(); + } + + // D-Pad Methods // + + public enum DPad { + /** + * Up on the D-Pad. + */ + up, + + /** + * Down on the D-Pad. + */ + down, + + /** + * Right on the D-Pad. + */ + left, + + /** + * Left on the D-Pad. + */ + right, + + /** + * Up-Right on the D-Pad. + */ + upright, + + /** + * Up-Left on the D-Pad. + */ + upleft, + + /** + * Down-Right on the D-Pad. + */ + downright, + + /** + * Down-Left on the D-Pad. + */ + downleft, + + /** + * No direction on the D-Pad. + */ + none + } + + /** + * Upright D-Pad POV value. + */ + private static final int DPAD_UPRIGHT = 45; + + /** + * Right D-Pad POV value. + */ + private static final int DPAD_RIGHT = 90; + + /** + * Downright D-Pad POV value. + */ + private static final int DPAD_DOWNRIGHT = 135; + + /** + * Down POV D-Pad value. + */ + private static final int DPAD_DOWN = 180; + + /** + * Downleft D-Pad POV value. + */ + private static final int DPAD_DOWNLEFT = 225; + + /** + * Left D-Pad POV value. + */ + private static final int DPAD_LEFT = 270; + + /** + * Upleft D-Pad POV value. + */ + private static final int DPAD_UPLEFT = 315; + + /** + * Up D-Pad POV value. + */ + private static final int DPAD_UP = 360; + + /** + * Method for returning the value of the D-Pad. + * + * @return value of the D-Pad + * + * @see Xbox.DPad + */ + public DPad getDPad() { + switch (controller.getPOV()) { + case 0: + return DPad.up; + case DPAD_UPRIGHT: + return DPad.upright; + case DPAD_RIGHT: + return DPad.right; + case DPAD_DOWNRIGHT: + return DPad.downright; + case DPAD_DOWN: + return DPad.down; + case DPAD_DOWNLEFT: + return DPad.downleft; + case DPAD_LEFT: + return DPad.left; + case DPAD_UPLEFT: + return DPad.upleft; + case DPAD_UP: + return DPad.up; + default: + return DPad.none; + } + } + + // Rumble Methods // + + /** + * Method for setting the rumble of the controller. + * + * @param type type of rumble to set + * @param value value to set the rumble to + * + * @see edu.wpi.first.wpilibj.GenericHID.RumbleType + */ + public void setRumble(final RumbleType type, final double value) { + controller.setRumble(type, value); + } + + // General Methods // + + /** + * Method for checking if the controller is connected. + * + * @return true if the controller is connected, false if not + */ + public boolean isConnected() { + return (controller.isConnected()); + } + + /** + * Method for getting the name of the controller. + * + * @return name of the controller + */ + public String getName() { + return controller.getName(); + } +} diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/src/main/java/frc/robot/controllers/package-info.java b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/src/main/java/frc/robot/controllers/package-info.java new file mode 100644 index 0000000..80793a8 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/src/main/java/frc/robot/controllers/package-info.java @@ -0,0 +1,7 @@ +/** + * Holds controller classes + *+ * This can be used to hold both custom and pre-made controller classes. + *
+ */ +package frc.controllers; diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/src/main/java/frc/robot/subsystems/ExampleSubsystem.java b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/src/main/java/frc/robot/subsystems/ExampleSubsystem.java new file mode 100644 index 0000000..39c2a44 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/src/main/java/frc/robot/subsystems/ExampleSubsystem.java @@ -0,0 +1,48 @@ +// 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.subsystems; + +import edu.wpi.first.wpilibj2.command.Command; +import edu.wpi.first.wpilibj2.command.SubsystemBase; + +public class ExampleSubsystem extends SubsystemBase { + /** Creates a new ExampleSubsystem. */ + public ExampleSubsystem() {} + + /** + * Example command factory method. + * + * @return a command + */ + public Command exampleMethodCommand() { + // Inline construction of command goes here. + // Subsystem::RunOnce implicitly requires `this` subsystem. + return runOnce(() + -> { + /* one-time action goes here */ + }); + } + + /** + * An example method querying a boolean state of the subsystem (for example, a + * digital sensor). + * + * @return value of some boolean subsystem state, such as a digital sensor. + */ + public boolean exampleCondition() { + // Query some boolean state, such as a digital sensor. + return false; + } + + @Override + public void periodic() { + // This method will be called once per scheduler run + } + + @Override + public void simulationPeriodic() { + // This method will be called once per scheduler run during simulation + } +} diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/vendordeps/Phoenix5.json b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/vendordeps/Phoenix5.json new file mode 100644 index 0000000..d0fade6 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/vendordeps/Phoenix5.json @@ -0,0 +1,151 @@ +{ + "fileName": "Phoenix5.json", + "name": "CTRE-Phoenix (v5)", + "version": "5.32.0-beta-5", + "frcYear": 2024, + "uuid": "ab676553-b602-441f-a38d-f1296eff6537", + "mavenUrls": [ + "https://maven.ctr-electronics.com/release/" + ], + "jsonUrl": "https://maven.ctr-electronics.com/release/com/ctre/phoenix/Phoenix5-frc2024-beta-latest.json", + "requires": [ + { + "uuid": "e995de00-2c64-4df5-8831-c1441420ff19", + "errorMessage": "Phoenix 5 requires low-level libraries from Phoenix 6. Please add the Phoenix 6 vendordep before adding Phoenix 5.", + "offlineFileName": "Phoenix6.json", + "onlineUrl": "https://maven.ctr-electronics.com/release/com/ctre/phoenix6/latest/Phoenix6-frc2024-beta-latest.json" + } + ], + "javaDependencies": [ + { + "groupId": "com.ctre.phoenix", + "artifactId": "api-java", + "version": "5.32.0-beta-5" + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "wpiapi-java", + "version": "5.32.0-beta-5" + } + ], + "jniDependencies": [ + { + "groupId": "com.ctre.phoenix", + "artifactId": "cci", + "version": "5.32.0-beta-5", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxathena" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix.sim", + "artifactId": "cci-sim", + "version": "5.32.0-beta-5", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + } + ], + "cppDependencies": [ + { + "groupId": "com.ctre.phoenix", + "artifactId": "wpiapi-cpp", + "version": "5.32.0-beta-5", + "libName": "CTRE_Phoenix_WPI", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxathena" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "api-cpp", + "version": "5.32.0-beta-5", + "libName": "CTRE_Phoenix", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxathena" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "cci", + "version": "5.32.0-beta-5", + "libName": "CTRE_PhoenixCCI", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxathena" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix.sim", + "artifactId": "wpiapi-cpp-sim", + "version": "5.32.0-beta-5", + "libName": "CTRE_Phoenix_WPISim", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix.sim", + "artifactId": "api-cpp-sim", + "version": "5.32.0-beta-5", + "libName": "CTRE_PhoenixSim", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix.sim", + "artifactId": "cci-sim", + "version": "5.32.0-beta-5", + "libName": "CTRE_PhoenixCCISim", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + } + ] +} \ No newline at end of file diff --git a/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/vendordeps/WPILibNewCommands.json b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/vendordeps/WPILibNewCommands.json new file mode 100644 index 0000000..67bf389 --- /dev/null +++ b/2024-2025/FreshmanProjectBots/Henrys_Command_Robot_Test/vendordeps/WPILibNewCommands.json @@ -0,0 +1,38 @@ +{ + "fileName": "WPILibNewCommands.json", + "name": "WPILib-New-Commands", + "version": "1.0.0", + "uuid": "111e20f7-815e-48f8-9dd6-e675ce75b266", + "frcYear": "2024", + "mavenUrls": [], + "jsonUrl": "", + "javaDependencies": [ + { + "groupId": "edu.wpi.first.wpilibNewCommands", + "artifactId": "wpilibNewCommands-java", + "version": "wpilib" + } + ], + "jniDependencies": [], + "cppDependencies": [ + { + "groupId": "edu.wpi.first.wpilibNewCommands", + "artifactId": "wpilibNewCommands-cpp", + "version": "wpilib", + "libName": "wpilibNewCommands", + "headerClassifier": "headers", + "sourcesClassifier": "sources", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "linuxathena", + "linuxarm32", + "linuxarm64", + "windowsx86-64", + "windowsx86", + "linuxx86-64", + "osxuniversal" + ] + } + ] +} diff --git a/Learning_Materials/Beginner_Level/Course_Intro.txt b/2024-2025/Learning_Materials/Beginner_Level/Course_Intro.txt similarity index 100% rename from Learning_Materials/Beginner_Level/Course_Intro.txt rename to 2024-2025/Learning_Materials/Beginner_Level/Course_Intro.txt diff --git a/Learning_Materials/Beginner_Level/Java/B1DataTypes.java b/2024-2025/Learning_Materials/Beginner_Level/Java/B1DataTypes.java similarity index 100% rename from Learning_Materials/Beginner_Level/Java/B1DataTypes.java rename to 2024-2025/Learning_Materials/Beginner_Level/Java/B1DataTypes.java diff --git a/Learning_Materials/Beginner_Level/Java/B2Operators.java b/2024-2025/Learning_Materials/Beginner_Level/Java/B2Operators.java similarity index 100% rename from Learning_Materials/Beginner_Level/Java/B2Operators.java rename to 2024-2025/Learning_Materials/Beginner_Level/Java/B2Operators.java diff --git a/Learning_Materials/Beginner_Level/Java/B3IfElseStatement.java b/2024-2025/Learning_Materials/Beginner_Level/Java/B3IfElseStatement.java similarity index 100% rename from Learning_Materials/Beginner_Level/Java/B3IfElseStatement.java rename to 2024-2025/Learning_Materials/Beginner_Level/Java/B3IfElseStatement.java diff --git a/Learning_Materials/Beginner_Level/Java/B4CheckIn.java b/2024-2025/Learning_Materials/Beginner_Level/Java/B4CheckIn.java similarity index 100% rename from Learning_Materials/Beginner_Level/Java/B4CheckIn.java rename to 2024-2025/Learning_Materials/Beginner_Level/Java/B4CheckIn.java diff --git a/Learning_Materials/Beginner_Level/Java/B5Functions.java b/2024-2025/Learning_Materials/Beginner_Level/Java/B5Functions.java similarity index 100% rename from Learning_Materials/Beginner_Level/Java/B5Functions.java rename to 2024-2025/Learning_Materials/Beginner_Level/Java/B5Functions.java diff --git a/Learning_Materials/Beginner_Level/Java/B6Scope.java b/2024-2025/Learning_Materials/Beginner_Level/Java/B6Scope.java similarity index 100% rename from Learning_Materials/Beginner_Level/Java/B6Scope.java rename to 2024-2025/Learning_Materials/Beginner_Level/Java/B6Scope.java diff --git a/Learning_Materials/Beginner_Level/Java/B7ClassesAndObjects/B71ClassesAndObjects.java b/2024-2025/Learning_Materials/Beginner_Level/Java/B7ClassesAndObjects/B71ClassesAndObjects.java similarity index 100% rename from Learning_Materials/Beginner_Level/Java/B7ClassesAndObjects/B71ClassesAndObjects.java rename to 2024-2025/Learning_Materials/Beginner_Level/Java/B7ClassesAndObjects/B71ClassesAndObjects.java diff --git a/Learning_Materials/Beginner_Level/Java/B7ClassesAndObjects/B72BlueprintForHouse.java b/2024-2025/Learning_Materials/Beginner_Level/Java/B7ClassesAndObjects/B72BlueprintForHouse.java similarity index 100% rename from Learning_Materials/Beginner_Level/Java/B7ClassesAndObjects/B72BlueprintForHouse.java rename to 2024-2025/Learning_Materials/Beginner_Level/Java/B7ClassesAndObjects/B72BlueprintForHouse.java diff --git a/Learning_Materials/Beginner_Level/Java/B7ClassesAndObjects/B73RevisedBlueprintForHouse.java b/2024-2025/Learning_Materials/Beginner_Level/Java/B7ClassesAndObjects/B73RevisedBlueprintForHouse.java similarity index 100% rename from Learning_Materials/Beginner_Level/Java/B7ClassesAndObjects/B73RevisedBlueprintForHouse.java rename to 2024-2025/Learning_Materials/Beginner_Level/Java/B7ClassesAndObjects/B73RevisedBlueprintForHouse.java diff --git a/Learning_Materials/Beginner_Level/Java/B7ClassesAndObjects/B74AnotherRevisedBlueprint.java b/2024-2025/Learning_Materials/Beginner_Level/Java/B7ClassesAndObjects/B74AnotherRevisedBlueprint.java similarity index 100% rename from Learning_Materials/Beginner_Level/Java/B7ClassesAndObjects/B74AnotherRevisedBlueprint.java rename to 2024-2025/Learning_Materials/Beginner_Level/Java/B7ClassesAndObjects/B74AnotherRevisedBlueprint.java diff --git a/Learning_Materials/Beginner_Level/Java/B8FinalCheckIn.java b/2024-2025/Learning_Materials/Beginner_Level/Java/B8FinalCheckIn.java similarity index 100% rename from Learning_Materials/Beginner_Level/Java/B8FinalCheckIn.java rename to 2024-2025/Learning_Materials/Beginner_Level/Java/B8FinalCheckIn.java diff --git a/Learning_Materials/Beginner_Level/Python/B1DataTypes.py b/2024-2025/Learning_Materials/Beginner_Level/Python/B1DataTypes.py similarity index 100% rename from Learning_Materials/Beginner_Level/Python/B1DataTypes.py rename to 2024-2025/Learning_Materials/Beginner_Level/Python/B1DataTypes.py diff --git a/Learning_Materials/Beginner_Level/Python/B2Operators.py b/2024-2025/Learning_Materials/Beginner_Level/Python/B2Operators.py similarity index 100% rename from Learning_Materials/Beginner_Level/Python/B2Operators.py rename to 2024-2025/Learning_Materials/Beginner_Level/Python/B2Operators.py diff --git a/Learning_Materials/Beginner_Level/Python/B3IfElseStatement.py b/2024-2025/Learning_Materials/Beginner_Level/Python/B3IfElseStatement.py similarity index 100% rename from Learning_Materials/Beginner_Level/Python/B3IfElseStatement.py rename to 2024-2025/Learning_Materials/Beginner_Level/Python/B3IfElseStatement.py diff --git a/Learning_Materials/Beginner_Level/Python/B4CheckIn.py b/2024-2025/Learning_Materials/Beginner_Level/Python/B4CheckIn.py similarity index 100% rename from Learning_Materials/Beginner_Level/Python/B4CheckIn.py rename to 2024-2025/Learning_Materials/Beginner_Level/Python/B4CheckIn.py diff --git a/Learning_Materials/Beginner_Level/Python/B5Functions.py b/2024-2025/Learning_Materials/Beginner_Level/Python/B5Functions.py similarity index 100% rename from Learning_Materials/Beginner_Level/Python/B5Functions.py rename to 2024-2025/Learning_Materials/Beginner_Level/Python/B5Functions.py diff --git a/Learning_Materials/Beginner_Level/Python/B6Scope.py b/2024-2025/Learning_Materials/Beginner_Level/Python/B6Scope.py similarity index 100% rename from Learning_Materials/Beginner_Level/Python/B6Scope.py rename to 2024-2025/Learning_Materials/Beginner_Level/Python/B6Scope.py diff --git a/Learning_Materials/Beginner_Level/Python/B7ClassesAndObjects.py b/2024-2025/Learning_Materials/Beginner_Level/Python/B7ClassesAndObjects.py similarity index 100% rename from Learning_Materials/Beginner_Level/Python/B7ClassesAndObjects.py rename to 2024-2025/Learning_Materials/Beginner_Level/Python/B7ClassesAndObjects.py diff --git a/Learning_Materials/Beginner_Level/Python/B8FinalCheckIn.py b/2024-2025/Learning_Materials/Beginner_Level/Python/B8FinalCheckIn.py similarity index 100% rename from Learning_Materials/Beginner_Level/Python/B8FinalCheckIn.py rename to 2024-2025/Learning_Materials/Beginner_Level/Python/B8FinalCheckIn.py diff --git a/Learning_Materials/Intermediate_Level/Intermediate_Intro.txt b/2024-2025/Learning_Materials/Intermediate_Level/Intermediate_Intro.txt similarity index 100% rename from Learning_Materials/Intermediate_Level/Intermediate_Intro.txt rename to 2024-2025/Learning_Materials/Intermediate_Level/Intermediate_Intro.txt diff --git a/Learning_Materials/Intermediate_Level/Java/I0JavaCheatsheet.java b/2024-2025/Learning_Materials/Intermediate_Level/Java/I0JavaCheatsheet.java similarity index 100% rename from Learning_Materials/Intermediate_Level/Java/I0JavaCheatsheet.java rename to 2024-2025/Learning_Materials/Intermediate_Level/Java/I0JavaCheatsheet.java diff --git a/Learning_Materials/Intermediate_Level/Java/I1ConvertingDatatypes.java b/2024-2025/Learning_Materials/Intermediate_Level/Java/I1ConvertingDatatypes.java similarity index 100% rename from Learning_Materials/Intermediate_Level/Java/I1ConvertingDatatypes.java rename to 2024-2025/Learning_Materials/Intermediate_Level/Java/I1ConvertingDatatypes.java diff --git a/Learning_Materials/Intermediate_Level/Java/I2Arrays.java b/2024-2025/Learning_Materials/Intermediate_Level/Java/I2Arrays.java similarity index 100% rename from Learning_Materials/Intermediate_Level/Java/I2Arrays.java rename to 2024-2025/Learning_Materials/Intermediate_Level/Java/I2Arrays.java diff --git a/Learning_Materials/Intermediate_Level/Java/I3Loops.java b/2024-2025/Learning_Materials/Intermediate_Level/Java/I3Loops.java similarity index 100% rename from Learning_Materials/Intermediate_Level/Java/I3Loops.java rename to 2024-2025/Learning_Materials/Intermediate_Level/Java/I3Loops.java diff --git a/Learning_Materials/Intermediate_Level/Java/I4CheckIn.java b/2024-2025/Learning_Materials/Intermediate_Level/Java/I4CheckIn.java similarity index 100% rename from Learning_Materials/Intermediate_Level/Java/I4CheckIn.java rename to 2024-2025/Learning_Materials/Intermediate_Level/Java/I4CheckIn.java diff --git a/Learning_Materials/Intermediate_Level/Java/I5Enums.java b/2024-2025/Learning_Materials/Intermediate_Level/Java/I5Enums.java similarity index 100% rename from Learning_Materials/Intermediate_Level/Java/I5Enums.java rename to 2024-2025/Learning_Materials/Intermediate_Level/Java/I5Enums.java diff --git a/Learning_Materials/Intermediate_Level/Python/I1ConvertingDatatypes.py b/2024-2025/Learning_Materials/Intermediate_Level/Python/I1ConvertingDatatypes.py similarity index 100% rename from Learning_Materials/Intermediate_Level/Python/I1ConvertingDatatypes.py rename to 2024-2025/Learning_Materials/Intermediate_Level/Python/I1ConvertingDatatypes.py diff --git a/Learning_Materials/Intermediate_Level/Python/I2Lists.py b/2024-2025/Learning_Materials/Intermediate_Level/Python/I2Lists.py similarity index 100% rename from Learning_Materials/Intermediate_Level/Python/I2Lists.py rename to 2024-2025/Learning_Materials/Intermediate_Level/Python/I2Lists.py diff --git a/Learning_Materials/Robot_Level/Robot_Intro.txt b/2024-2025/Learning_Materials/Robot_Level/Robot_Intro.txt similarity index 100% rename from Learning_Materials/Robot_Level/Robot_Intro.txt rename to 2024-2025/Learning_Materials/Robot_Level/Robot_Intro.txt diff --git a/2024-2025/Tests/main-bot/.wpilib/wpilib_preferences.json b/2024-2025/Tests/main-bot/.wpilib/wpilib_preferences.json new file mode 100644 index 0000000..a5ebb07 --- /dev/null +++ b/2024-2025/Tests/main-bot/.wpilib/wpilib_preferences.json @@ -0,0 +1,6 @@ +{ + "enableCppIntellisense": false, + "currentLanguage": "java", + "projectYear": "2024", + "teamNumber": 5098 +} \ No newline at end of file diff --git a/2024-2025/Tests/main-bot/WPILib-License.md b/2024-2025/Tests/main-bot/WPILib-License.md new file mode 100644 index 0000000..e7cd597 --- /dev/null +++ b/2024-2025/Tests/main-bot/WPILib-License.md @@ -0,0 +1,24 @@ +Copyright (c) 2009-2024 FIRST and other WPILib contributors +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of FIRST, WPILib, nor the names of other WPILib + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY FIRST AND OTHER WPILIB CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY NONINFRINGEMENT AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL FIRST OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/2024-2025/Tests/main-bot/build.gradle b/2024-2025/Tests/main-bot/build.gradle new file mode 100644 index 0000000..1e8da00 --- /dev/null +++ b/2024-2025/Tests/main-bot/build.gradle @@ -0,0 +1,101 @@ +plugins { + id "java" + id "edu.wpi.first.GradleRIO" version "2024.2.1" +} + +java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 +} + +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' + } + } + } + } +} + +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 = false + +// 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() + + 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) + + 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() + + testImplementation 'org.junit.jupiter:junit-jupiter:5.10.1' + testRuntimeOnly 'org.junit.platform:junit-platform-launcher' +} + +test { + useJUnitPlatform() + systemProperty 'junit.jupiter.extensions.autodetection.enabled', 'true' +} + +// Simulation configuration (e.g. environment variables). +wpi.sim.addGui().defaultEnabled = true +wpi.sim.addDriverstation() + +// Setting up my Jar File. In this case, adding all libraries into the main jar ('fat jar') +// 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) } } + from sourceSets.main.allSource + manifest edu.wpi.first.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) + +// Configure string concat to always inline compile +tasks.withType(JavaCompile) { + options.compilerArgs.add '-XDstringConcat=inline' +} diff --git a/2024-2025/Tests/main-bot/gradle/wrapper/gradle-wrapper.properties b/2024-2025/Tests/main-bot/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..7015f6b --- /dev/null +++ b/2024-2025/Tests/main-bot/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=permwrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=permwrapper/dists diff --git a/2024-2025/Tests/main-bot/gradlew b/2024-2025/Tests/main-bot/gradlew new file mode 100644 index 0000000..1aa94a4 --- /dev/null +++ b/2024-2025/Tests/main-bot/gradlew @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/2024-2025/Tests/main-bot/gradlew.bat b/2024-2025/Tests/main-bot/gradlew.bat new file mode 100644 index 0000000..6689b85 --- /dev/null +++ b/2024-2025/Tests/main-bot/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/2024-2025/Tests/main-bot/settings.gradle b/2024-2025/Tests/main-bot/settings.gradle new file mode 100644 index 0000000..3e30f84 --- /dev/null +++ b/2024-2025/Tests/main-bot/settings.gradle @@ -0,0 +1,30 @@ +import org.gradle.internal.os.OperatingSystem + +pluginManagement { + repositories { + mavenLocal() + gradlePluginPortal() + String frcYear = '2024' + 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 + } + } +} + +Properties props = System.getProperties(); +props.setProperty("org.gradle.internal.native.headers.unresolved.dependencies.ignore", "true"); diff --git a/2024-2025/Tests/main-bot/src/main/deploy/example.txt b/2024-2025/Tests/main-bot/src/main/deploy/example.txt new file mode 100644 index 0000000..bb82515 --- /dev/null +++ b/2024-2025/Tests/main-bot/src/main/deploy/example.txt @@ -0,0 +1,3 @@ +Files placed in this directory will be deployed to the RoboRIO into the +'deploy' directory in the home folder. Use the 'Filesystem.getDeployDirectory' wpilib function +to get a proper path relative to the deploy directory. \ No newline at end of file diff --git a/2024-2025/Tests/main-bot/src/main/java/frc/robot/Main.java b/2024-2025/Tests/main-bot/src/main/java/frc/robot/Main.java new file mode 100644 index 0000000..8776e5d --- /dev/null +++ b/2024-2025/Tests/main-bot/src/main/java/frc/robot/Main.java @@ -0,0 +1,25 @@ +// 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; + +/** + * Do NOT add any static variables to this class, or any initialization at all. Unless you know what + * you are doing, do not modify this file except to change the parameter class to the startRobot + * call. + */ +public final class Main { + private Main() {} + + /** + * Main initialization function. Do not perform any initialization here. + * + *If you change your main robot class, change the parameter type. + */ + public static void main(String... args) { + RobotBase.startRobot(Robot::new); + } +} diff --git a/2024-2025/Tests/main-bot/src/main/java/frc/robot/Robot.java b/2024-2025/Tests/main-bot/src/main/java/frc/robot/Robot.java new file mode 100644 index 0000000..3254294 --- /dev/null +++ b/2024-2025/Tests/main-bot/src/main/java/frc/robot/Robot.java @@ -0,0 +1,72 @@ +// 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.TimesliceRobot; +import edu.wpi.first.wpilibj.livewindow.LiveWindow; + +/** + * The VM is configured to automatically run this class, and to call the + * functions corresponding to each mode, as described in the TimesliceRobot + * documentation. If you change the name of this class or the package after + * creating this project, you must also update the build.gradle file in the + * project. + */ +public class Robot extends TimesliceRobot { + + /** Robot constructor. */ + public Robot() { + // Run robot periodic() functions for 5 ms, and run controllers every 10 ms + super(0.005, 0.01); + + // LiveWindow causes drastic overruns in robot periodic functions that will + // interfere with controllers + LiveWindow.disableAllTelemetry(); + + // Runs for 2 ms after robot periodic functions + schedule(() -> {}, 0.002); + + // Runs for 2 ms after first controller function + schedule(() -> {}, 0.002); + + // Total usage: + // 5 ms (robot) + 2 ms (controller 1) + 2 ms (controller 2) = 9 ms + // 9 ms / 10 ms -> 90% allocated + } + + /** + * This function is run when the robot is first started up and should be used + * for any initialization code. + */ + @Override + public void robotInit() {} + + @Override + public void robotPeriodic() {} + + @Override + public void autonomousInit() {} + + @Override + public void autonomousPeriodic() {} + + @Override + public void teleopInit() {} + + @Override + public void teleopPeriodic() {} + + @Override + public void disabledInit() {} + + @Override + public void disabledPeriodic() {} + + @Override + public void testInit() {} + + @Override + public void testPeriodic() {} +} diff --git a/2024-2025/Tests/main-bot/vendordeps/WPILibNewCommands.json b/2024-2025/Tests/main-bot/vendordeps/WPILibNewCommands.json new file mode 100644 index 0000000..67bf389 --- /dev/null +++ b/2024-2025/Tests/main-bot/vendordeps/WPILibNewCommands.json @@ -0,0 +1,38 @@ +{ + "fileName": "WPILibNewCommands.json", + "name": "WPILib-New-Commands", + "version": "1.0.0", + "uuid": "111e20f7-815e-48f8-9dd6-e675ce75b266", + "frcYear": "2024", + "mavenUrls": [], + "jsonUrl": "", + "javaDependencies": [ + { + "groupId": "edu.wpi.first.wpilibNewCommands", + "artifactId": "wpilibNewCommands-java", + "version": "wpilib" + } + ], + "jniDependencies": [], + "cppDependencies": [ + { + "groupId": "edu.wpi.first.wpilibNewCommands", + "artifactId": "wpilibNewCommands-cpp", + "version": "wpilib", + "libName": "wpilibNewCommands", + "headerClassifier": "headers", + "sourcesClassifier": "sources", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "linuxathena", + "linuxarm32", + "linuxarm64", + "windowsx86-64", + "windowsx86", + "linuxx86-64", + "osxuniversal" + ] + } + ] +} diff --git a/2024-2025/Win-Nguyen/Win-Nguyen-2024/.wpilib/wpilib_preferences.json b/2024-2025/Win-Nguyen/Win-Nguyen-2024/.wpilib/wpilib_preferences.json new file mode 100644 index 0000000..a5ebb07 --- /dev/null +++ b/2024-2025/Win-Nguyen/Win-Nguyen-2024/.wpilib/wpilib_preferences.json @@ -0,0 +1,6 @@ +{ + "enableCppIntellisense": false, + "currentLanguage": "java", + "projectYear": "2024", + "teamNumber": 5098 +} \ No newline at end of file diff --git a/2024-2025/Win-Nguyen/Win-Nguyen-2024/WPILib-License.md b/2024-2025/Win-Nguyen/Win-Nguyen-2024/WPILib-License.md new file mode 100644 index 0000000..e7cd597 --- /dev/null +++ b/2024-2025/Win-Nguyen/Win-Nguyen-2024/WPILib-License.md @@ -0,0 +1,24 @@ +Copyright (c) 2009-2024 FIRST and other WPILib contributors +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of FIRST, WPILib, nor the names of other WPILib + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY FIRST AND OTHER WPILIB CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY NONINFRINGEMENT AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL FIRST OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/2024-2025/Win-Nguyen/Win-Nguyen-2024/build.gradle b/2024-2025/Win-Nguyen/Win-Nguyen-2024/build.gradle new file mode 100644 index 0000000..1e8da00 --- /dev/null +++ b/2024-2025/Win-Nguyen/Win-Nguyen-2024/build.gradle @@ -0,0 +1,101 @@ +plugins { + id "java" + id "edu.wpi.first.GradleRIO" version "2024.2.1" +} + +java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 +} + +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' + } + } + } + } +} + +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 = false + +// 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() + + 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) + + 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() + + testImplementation 'org.junit.jupiter:junit-jupiter:5.10.1' + testRuntimeOnly 'org.junit.platform:junit-platform-launcher' +} + +test { + useJUnitPlatform() + systemProperty 'junit.jupiter.extensions.autodetection.enabled', 'true' +} + +// Simulation configuration (e.g. environment variables). +wpi.sim.addGui().defaultEnabled = true +wpi.sim.addDriverstation() + +// Setting up my Jar File. In this case, adding all libraries into the main jar ('fat jar') +// 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) } } + from sourceSets.main.allSource + manifest edu.wpi.first.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) + +// Configure string concat to always inline compile +tasks.withType(JavaCompile) { + options.compilerArgs.add '-XDstringConcat=inline' +} diff --git a/2024-2025/Win-Nguyen/Win-Nguyen-2024/gradle/wrapper/gradle-wrapper.properties b/2024-2025/Win-Nguyen/Win-Nguyen-2024/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..7015f6b --- /dev/null +++ b/2024-2025/Win-Nguyen/Win-Nguyen-2024/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=permwrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=permwrapper/dists diff --git a/2024-2025/Win-Nguyen/Win-Nguyen-2024/gradlew b/2024-2025/Win-Nguyen/Win-Nguyen-2024/gradlew new file mode 100644 index 0000000..1aa94a4 --- /dev/null +++ b/2024-2025/Win-Nguyen/Win-Nguyen-2024/gradlew @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/2024-2025/Win-Nguyen/Win-Nguyen-2024/gradlew.bat b/2024-2025/Win-Nguyen/Win-Nguyen-2024/gradlew.bat new file mode 100644 index 0000000..6689b85 --- /dev/null +++ b/2024-2025/Win-Nguyen/Win-Nguyen-2024/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/2024-2025/Win-Nguyen/Win-Nguyen-2024/settings.gradle b/2024-2025/Win-Nguyen/Win-Nguyen-2024/settings.gradle new file mode 100644 index 0000000..3e30f84 --- /dev/null +++ b/2024-2025/Win-Nguyen/Win-Nguyen-2024/settings.gradle @@ -0,0 +1,30 @@ +import org.gradle.internal.os.OperatingSystem + +pluginManagement { + repositories { + mavenLocal() + gradlePluginPortal() + String frcYear = '2024' + 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 + } + } +} + +Properties props = System.getProperties(); +props.setProperty("org.gradle.internal.native.headers.unresolved.dependencies.ignore", "true"); diff --git a/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/deploy/example.txt b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/deploy/example.txt new file mode 100644 index 0000000..bb82515 --- /dev/null +++ b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/deploy/example.txt @@ -0,0 +1,3 @@ +Files placed in this directory will be deployed to the RoboRIO into the +'deploy' directory in the home folder. Use the 'Filesystem.getDeployDirectory' wpilib function +to get a proper path relative to the deploy directory. \ No newline at end of file diff --git a/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/deploy/pathplanner/navgrid.json b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/deploy/pathplanner/navgrid.json new file mode 100644 index 0000000..bab0da9 --- /dev/null +++ b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/deploy/pathplanner/navgrid.json @@ -0,0 +1 @@ +{"field_size":{"x":16.54,"y":8.21},"nodeSizeMeters":0.3,"grid":[[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true],[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true],[true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true,true,true,true,true],[true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true,true,true],[true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true],[true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true],[true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true],[true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true],[true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true],[true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true],[true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true],[true,true,false,false,false,false,false,false,false,false,true,true,true,false,false,false,false,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true,false,false,false,false,true,true,true,false,false,false,false,false,false,false,false,false,true,true],[true,true,false,false,false,false,false,false,false,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true,true,true,false,false,false,false,false,false,false,false,true,true],[true,true,false,false,false,false,false,false,false,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true,true,true,false,false,false,false,false,false,false,true,true,true],[true,true,true,false,false,false,false,false,false,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true,true,true,false,false,false,false,false,false,true,true,true,true],[true,true,true,true,false,false,false,false,false,false,true,true,true,false,false,false,false,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true,false,false,false,false,true,true,true,false,false,false,false,false,false,true,true,true,true,true],[true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,true,true,true,true,true,true],[true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,true,true,true,true,true,true],[true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,true,true,true,true,true,true],[true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true,true,true,true],[true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true,true,true,true],[true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true,true,true],[true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true,true],[true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true],[true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true],[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true],[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true],[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true]]} \ No newline at end of file diff --git a/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/deploy/pathplanner/paths/newpath.path b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/deploy/pathplanner/paths/newpath.path new file mode 100644 index 0000000..f7fb046 --- /dev/null +++ b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/deploy/pathplanner/paths/newpath.path @@ -0,0 +1,49 @@ +{ + "version": 1.0, + "waypoints": [ + { + "anchor": { + "x": 0.0, + "y": 0.0 + }, + "prevControl": null, + "nextControl": { + "x": 1.0, + "y": 0.0 + }, + "isLocked": false, + "linkedName": null + }, + { + "anchor": { + "x": 1.0, + "y": 0.0 + }, + "prevControl": { + "x": 0.0, + "y": 0.0 + }, + "nextControl": null, + "isLocked": false, + "linkedName": null + } + ], + "rotationTargets": [], + "constraintZones": [], + "eventMarkers": [], + "globalConstraints": { + "maxVelocity": 3.0, + "maxAcceleration": 3.0, + "maxAngularVelocity": 540.0, + "maxAngularAcceleration": 720.0 + }, + "goalEndState": { + "velocity": 0, + "rotation": 0.0, + "rotateFast": false + }, + "reversed": false, + "folder": null, + "previewStartingState": null, + "useDefaultConstraints": false +} \ No newline at end of file diff --git a/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/deploy/robot_settings.json b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/deploy/robot_settings.json new file mode 100644 index 0000000..5e10b2f --- /dev/null +++ b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/deploy/robot_settings.json @@ -0,0 +1,33 @@ +{ + "controllerID": 0, + "swerveDrive": { + "frontLeft": { + "driveID": 1, + "turnID": 2, + "encoderID": 10, + "posY": -0.23, + "posX": 0.36 + }, + "frontRight": { + "driveID": 7, + "turnID": 8, + "encoderID": 12, + "posY": 0.23, + "posX": 0.36 + }, + "backLeft": { + "driveID": 3, + "turnID": 4, + "encoderID": 11, + "posY": -0.23, + "posX": -0.36 + }, + "backRight": { + "driveID": 5, + "turnID": 6, + "encoderID": 9, + "posY": 0.23, + "posX": -0.36 + } + } +} \ No newline at end of file diff --git a/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/CommonData.java b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/CommonData.java new file mode 100644 index 0000000..7d7148b --- /dev/null +++ b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/CommonData.java @@ -0,0 +1,214 @@ +package frc; + +// import frc.robot.Utility; + +/** +* Data used by other classes. +*
+* This is used to store data that needs to be accessed by multiple classes. +*
+*/ +public final class CommonData { + + // Swerve Drive Variables // + + /** + * desiredTurn is the desired angle of the robot. + */ + private static double desiredTurn; + + /** + * forwardSpeed is the desired forward and backward speed of the robot. + */ + private static double forwardSpeed; + + /** + * sideSpeed is the desired left and right speed of the robot. + */ + private static double sideSpeed; + + /** + * battenDownTheHatches is used to control the defensive stance. + */ + private static boolean battenDownTheHatches; + + // NavX Variables // + + /** + * calibrate is used to determine if the NavX should be calibrated. + */ + private static boolean calibrate; + + // Autonomous Varaibles // + + /** + * counter is used in the state machine to see what state the robot is in. + */ + private static int counter; + + private static boolean followPath; + + // private static boolean shuffleBoardPID; + + // /* + // * Would like to convert to ENUM at some point with (FL, FR, Bl, BR) - Henry + // * Used to determine which turn motor the PID settings will be tuning + // */ + // private static String tuningMotor; + + // private static boolean[] tuningMotorArray = {true, false, false, false}; + + // Constructor // + // This is set to private as this is a utility class and + // should not be instantiated + private CommonData() { + throw new UnsupportedOperationException( + "This is a utility class and cannot be instantiated"); + } + + // Accesor Methods // + + /** + * Method for returning desiredTurn. + *s + * @return desiredTurn + */ + public static double getDesiredTurn() { + return desiredTurn; + } + + /** + * Method for setting the desiredTurn. + * + * @param value value to set desiredTurn + */ + public static void setDesiredTurn(final double value) { + desiredTurn = value; + } + + /** + * Method for returning forwardSpeed. + * + * @return forwardSpeed + */ + public static double getForwardSpeed() { + return forwardSpeed; + } + + /** + * Method for setting forwardSpeed. + * + * @param value value to set forwardSpeed + */ + public static void setForwardSpeed(final double value) { + forwardSpeed = value; + } + + /** + * Method for returning sideSpeed. + * + * @return sideSpeed + */ + public static double getSideSpeed() { + return sideSpeed; + } + + /** + * Method for setting sideSpeed. + * + * @param value value to set sideSpeed + */ + public static void setSideSpeed(final double value) { + sideSpeed = value; + } + + public static void setFollowPath(final boolean value){ + followPath = value; + } + + public static boolean getFollowPath(){ + return followPath; + } + + /** + * Method for returning battenDownTheHatches. + * + * @return battenDownTheHatches + */ + public static boolean getBattenDownTheHatches() { + return battenDownTheHatches; + } + + /** + * Method for setting battenDownTheHatches. + * + * @param value value to set battenDownTheHatches + */ + public static void setBattenDownTheHatches(final boolean value) { + battenDownTheHatches = value; + } + + /** + * Method for returning calibrate. + * + * @return calibrate + */ + public static boolean getCalibrate() { + return calibrate; + } + + /** + * Method for setting calibrate. + * + * @param value value to set calibrate + */ + public static void setCalibrate(final boolean value) { + calibrate = value; + } + + /** + * Method for returning counter. + * + * @return counter + */ + public static int getCounter() { + return counter; + } + + /** + * Method for setting counter. + * + * @param value value to set counter + */ + public static void setCounter(final int value) { + counter = value; + } + + /** + * Method for displaying the PID values + * + */ + // public static boolean getShuffleBoardPID() { + // return shuffleBoardPID; + // } + /** + * Motor you are tuning + */ + // public static String setTuningMotor(String newTuningMotor) { //used to set turning motor in common data + // // If statement to make sure the chosen tuning motor is one of the four available + // if (newTuningMotor.equals("FL") || newTuningMotor.equals("FR") || newTuningMotor.equals("BL") || newTuningMotor.equals("BR")){ + // tuningMotor = newTuningMotor; + // return tuningMotor; + // } else { + // // need to add some debug statement + // Utility.printLn("That's not a tuning motor :("); + // return tuningMotor; + // } + // } + // public static String getTuningMotor() { + // return tuningMotor; + // } + // public static Boolean getTuningMotorArray() { + + // } +} diff --git a/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/components/IComponent.java b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/components/IComponent.java new file mode 100644 index 0000000..2f57cf7 --- /dev/null +++ b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/components/IComponent.java @@ -0,0 +1,18 @@ +package frc.components; + +/** + * Interface for components. + */ +public interface IComponent { + + // This is an interface. + // If a class implements any interface, + // it must have all of the methods in that interface. + // The methods defined in an interface are abstract, + // meaning they have no body. + + /** + * Method for updating the component. + */ + void update(); +} diff --git a/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/components/SwerveDrive.java b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/components/SwerveDrive.java new file mode 100644 index 0000000..145dcb7 --- /dev/null +++ b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/components/SwerveDrive.java @@ -0,0 +1,238 @@ +package frc.components; + +import com.kauailabs.navx.frc.AHRS; +import com.pathplanner.lib.controllers.PPHolonomicDriveController; +import com.pathplanner.lib.path.PathPlannerPath; +import com.pathplanner.lib.path.PathPlannerTrajectory; +import com.pathplanner.lib.util.PIDConstants; +import edu.wpi.first.math.estimator.SwerveDrivePoseEstimator; +import edu.wpi.first.math.geometry.Pose2d; +import edu.wpi.first.math.geometry.Rotation2d; +import edu.wpi.first.math.kinematics.ChassisSpeeds; +import edu.wpi.first.math.kinematics.SwerveDriveKinematics; +import edu.wpi.first.math.kinematics.SwerveModulePosition; +import edu.wpi.first.wpilibj.SPI; +import edu.wpi.first.wpilibj.Timer; +import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; +import frc.CommonData; +import frc.robot.Settings; +import frc.robot.Utility; + +// NOTE: All things commented out are not used. (At least not currently) + +/** + * + */ +public class SwerveDrive implements IComponent { + + /** + * Overall Equation: + * + * Motor roations per second: + * Motor rotations per minute / 60 + * + * Wheel rotations per second: + * Motor rotations per second / gear ratio + * + * Wheel radius (in ft): + * Wheel diameter (in ft) / 2 + * or + * Wheel radius (in inches) / 12 + * + * Wheel circumference (in ft): + * Wheel radius (in ft) * 2 * pi + * + * Speed (in ft/s): + * Wheel rotations per second * wheel circumference (in ft) + * + * Total Equation: + * (Motor rotations per minute / 60) / gear ratio * wheel circumference + * (in ft) + */ + + /** + * The maximum rotation of the robot. + */ + private final static double MAX_ROTATION = + (SwerveWheel.MAX_SPEED * 2 * Math.PI) / 2.7389195456 / 2; + + // The 2.7389195456 value still needs to be documented + + /** + * The offset of the yaw. + */ + double yawOffset = 0; + + /** + * The constructor for the SwerveDrive class. + * @param settings The settings for the swerve drive. + */ + public SwerveDrive(final Settings.SwerveDrive settings) { + swerveWheels = new SwerveWheel[] {new SwerveWheel(settings.frontLeft), + new SwerveWheel(settings.frontRight), + new SwerveWheel(settings.backLeft), + new SwerveWheel(settings.backRight)}; + + kinematics = new SwerveDriveKinematics( + swerveWheels[0].getSwervePos(), swerveWheels[1].getSwervePos(), + swerveWheels[2].getSwervePos(), swerveWheels[3].getSwervePos()); + + var path = PathPlannerPath.fromPathFile("newpath"); + traj = path.getTrajectory(new ChassisSpeeds(0, 0, 0), new Rotation2d(0)); + + odometry = new SwerveDrivePoseEstimator( + kinematics, Rotation2d.fromDegrees(360.0 - ahrs.getYaw()), + new SwerveModulePosition[] { + swerveWheels[0].getOdometryPosition(), + swerveWheels[1].getOdometryPosition(), + swerveWheels[2].getOdometryPosition(), + swerveWheels[3].getOdometryPosition(), + }, + new Pose2d(0, 0, new Rotation2d(0))); + + // limelightPoses[0] = new LimelightPose("limelight-back"); + // limelightPoses[1] = new LimelightPose("limelight-right"); + // limelightPoses[2] = new LimelightPose("limelight-left"); + + controller = new PPHolonomicDriveController( + new PIDConstants(0.5, 0, 0), new PIDConstants(0.05, 0, 0), + SwerveWheel.MAX_SPEED, 0.42720018726587655839358241631199); + } + + SwerveWheel[] swerveWheels; + + double leftOrRight; + double forwardOrBack; // This is the forward or back speed + + PathPlannerTrajectory traj; + PPHolonomicDriveController controller; + + private AHRS ahrs = new AHRS(SPI.Port.kMXP); + + Timer timer; + + private SwerveDriveKinematics kinematics; + private SwerveDrivePoseEstimator odometry; + + // LimelightPose[] limelightPoses = new LimelightPose[3]; + + Pose2d getCurrentPose() { return odometry.getEstimatedPosition(); } + + public void update() { + + // Put the wheels in their "X" position + // TODO: Add the common data value and finish implementing the code + // if (CommonData.getDefense) { + // } + + // Calabrate The NavX + if (CommonData.getCalibrate()) { + CommonData.setCalibrate(false); + // Reset the NavX. + ahrs.reset(); + // Reset the yaw offset after calibration. + yawOffset = ahrs.getYaw(); + } else { + odometry.update(Rotation2d.fromDegrees(360.0 - ahrs.getYaw()), + new SwerveModulePosition[] { + swerveWheels[0].getOdometryPosition(), + swerveWheels[1].getOdometryPosition(), + swerveWheels[2].getOdometryPosition(), + swerveWheels[3].getOdometryPosition(), + }); + } + + SmartDashboard.putNumber("Yaw offset", yawOffset); + + // Optional+ * 60 is used to convert from minutes to seconds. + *
+ */ + public final static double MAX_SPEED = + MAXIMUM_WHEEL_RPM * WHEEL_CIRCUMFERENCE / 60; + + TalonFX turnMotor; + TalonFX driveMotor; + CANcoder encoder; + + // 0.238125 Meters + // 0.365125 Meters + + Translation2d modulePos; + + double defensiveAngle; + + public SwerveWheel(Settings.SwerveDrive.Wheel settings) { + turnMotor = new TalonFX(settings.turnID); + driveMotor = new TalonFX(settings.driveID); + encoder = new CANcoder(settings.encoderID); + + modulePos = new Translation2d(settings.posX, settings.posY); + } + + public void set(SwerveModuleState swerveModuleState) { + // swerveModuleState = SwerveModuleState.optimize(swerveModuleState, + // Rotation2d.fromDegrees(turnMotor.getSelectedSensorPosition() + // / 11.3777778)); + swerveModuleState = SwerveModuleState.optimize( + swerveModuleState, + Rotation2d.fromDegrees( + encoder.getAbsolutePosition().getValueAsDouble() * 360)); + + // final double desiredTurnPos = swerveModuleState.angle.getDegrees() + // * 11.3777778; // conversion from degrees to native encoder value + final double desiredTurnPos = + swerveModuleState.angle.getDegrees() / + 360; // conversion from degrees to native encoder value + + // turnMotor.set(ControlMode.Position, desiredTurnPos); + turnMotor.setControl(new PositionDutyCycle(desiredTurnPos)); + + // driveMotor.set(ControlMode.PercentOutput, + // swerveModuleState.speedMetersPerSecond / maximumSpeed); + driveMotor.setControl( + new DutyCycleOut(swerveModuleState.speedMetersPerSecond / MAX_SPEED)); + // Using Velocity Can Be Used For Better Control But Percent Output Is + // Better Used For Practice + } + + public void defense() { + // turnMotor.set(ControlMode.Position, defensiveAngle * 11.77777777); + // driveMotor.set(ControlMode.PercentOutput, 0); + } + + public SwerveModulePosition getOdometryPosition() { + return new SwerveModulePosition( + driveMotor.getPosition().getValueAsDouble() / DRIVE_GEAR_RATIO * + WHEEL_CIRCUMFERENCE, + Rotation2d.fromRotations( + encoder.getAbsolutePosition().getValueAsDouble())); + } + + public TalonFX getTurnMotor() { return turnMotor; } + + public TalonFX getDriveMotor() { return driveMotor; } + + public Translation2d getSwervePos() { return modulePos; } + // public TalonFXConfigurator findConfig() { + // TalonFXConfigurator testValue = turnMotor.getConfigurator(); + // testValue. + // return turnMotor.getConfigurator(); + // } + + // public void battenDownTheHatches() + // { + // set(defensiveAngle, 0, 0); + // } +} diff --git a/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/components/autonomous/Autonomous.java b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/components/autonomous/Autonomous.java new file mode 100644 index 0000000..814b3c7 --- /dev/null +++ b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/components/autonomous/Autonomous.java @@ -0,0 +1,58 @@ +package frc.components.autonomous; + +import java.io.IOException; + +import edu.wpi.first.math.controller.HolonomicDriveController; +import edu.wpi.first.math.controller.PIDController; +import edu.wpi.first.math.controller.ProfiledPIDController; +import edu.wpi.first.math.trajectory.Trajectory; +import edu.wpi.first.math.trajectory.TrajectoryUtil; +import edu.wpi.first.wpilibj.DriverStation; +import edu.wpi.first.wpilibj.Filesystem; +import frc.components.IComponent; +import frc.state_machine.StateMachine; + +/** + * Autonomous component. + *+ * This class is used for autonomous mode. + * It sets up a state machine and excutes the states contained. + *
+ *+ * If you want to add a new state, see the constructor. + * {@link frc.components.autonomous.Autonomous#Autonomous()} + *
+ * This class implements the + * {@link frc.components.IComponent IComponent} interface. + *
+ * + * @see frc.state_machine.StateMachine + */ +public final class Autonomous implements IComponent { + + /** + * Autonomous constructor. + *+ * This is where new states are added to the state machine. + * Any state added here will be run during autonomous in + * the order they are added. + *
+ *+ * You can add states by using the following code: + * + *
+ * stateMachine.addState(new StateName()); + *+ * + * Any added states must also exist in this directory as separate + * classes. + * + * + * @see frc.components.autonomous.DriveState1 + */ + public Autonomous() {} + + @Override + public void update() { + } +} diff --git a/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/components/package-info.java b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/components/package-info.java new file mode 100644 index 0000000..74893cd --- /dev/null +++ b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/components/package-info.java @@ -0,0 +1,7 @@ +/** + * Package used to organize all of the components of the robot. + *
+ * These components can include the drivetrain, an arm, an intake, etc. + *
+ */ +package frc.components; diff --git a/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/controllers/LogitechF310.java b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/controllers/LogitechF310.java new file mode 100644 index 0000000..74a8997 --- /dev/null +++ b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/controllers/LogitechF310.java @@ -0,0 +1,463 @@ +package frc.controllers; + +import edu.wpi.first.wpilibj.Joystick; + +/** + * This class is used to create an LogitechF310 controller object. + *+ * This class uses the {@code Joystick} class from the wpilibj library. + *
+ *+ * This uses a deadband that can be set if needed. This helps control drift. + * This value can be in a range of 0 to 1. The higher the value, the more the + * stick has to move to register. This value is set in the constructor and is + * set alongside the controller ID. As a note: The deadband is only applied + * to the joystick axes. + *
+ * + * @see PS4 + * @see Xbox + * + * @see edu.wpi.first.wpilibj.Joystick + */ +public class LogitechF310 { + + // Button IDs // + + /** + * The axis ID for the left joystick x. + */ + private static final int JOYSTICK_LEFT_X = 0; + + /** + * The axis ID for the left joystick y. + */ + private static final int JOYSTICK_LEFT_Y = 1; + + /** + * The axis ID for the left trigger. + */ + private static final int TRIGGER_LEFT = 2; + + /** + * The axis ID for the right trigger. + */ + private static final int TRIGGER_RIGHT = 3; + + /** + * The axis ID for the right joystick x. + */ + private static final int JOYSTICK_RIGHT_X = 4; + + /** + * The axis ID for the right joystick y. + */ + private static final int JOYSTICK_RIGHT_Y = 5; + + /** + * The button ID for the A button. + */ + private static final int BUTTON_A = 1; + + /** + * The button ID for the B button. + */ + private static final int BUTTON_B = 2; + + /** + * The button ID for the X button. + */ + private static final int BUTTON_X = 3; + + /** + * The button ID for the Y button. + */ + private static final int BUTTON_Y = 4; + + /** + * The button ID for the left bumper. + */ + private static final int BUTTON_LEFT_BUMPER = 5; + + /** + * The button ID for the right bumper. + */ + private static final int BUTTON_RIGHT_BUMPER = 6; + + /** + * The button ID for the start button. + */ + private static final int BUTTON_START = 7; + + /** + * The button ID for the back button. + */ + private static final int BUTTON_BACK = 8; + + /** + * The controller object. + * In this case, a {@code Joystick} object. + * + * @see edu.wpi.first.wpilibj.Joystick + */ + private Joystick controller; + + /** + * The deadband value. + */ + private double deadBand; + + /** + * Constructor for the LogitechF310 class. + *+ * This constructor is used to create a LogitechF310 object. + * This takes in the controller ID and the deadband value. + *
+ * + * @param id Controller ID (Port) + * @param deadBandValue Deadband value + */ + public LogitechF310(final int id, final double deadBandValue) { + controller = new Joystick(id); + deadBand = deadBandValue; + } + + // Deadband Method // + + /** + * Method for setting the deadband of the controller on the X and Y axes. + *+ * This sets a threshold the joystick must pass before registering a value. + * This value can be in a range of 0 to 1. The higher the value, + * the more the joystick has to move to register. + *
+ * + * @return Deadbanded value + * + * @param value Value to be deadbanded + */ + private double deadBand(final double value) { + return Math.abs(value) < deadBand ? 0 : value; + } + + // Joystick Methods // + + /** + * Method for returning the X value of the left joystick. + * + * @return X value of the left joystick + * + * @see LogitechF310#getRightX + * @see LogitechF310#getRightY + * @see LogitechF310#getLeftY + */ + public double getLeftX() { + return deadBand(controller.getRawAxis(JOYSTICK_LEFT_X)); + } + + /** + * Method for returning the Y value of the left joystick. + * + * @return Y value of the left joystick + * + * @see LogitechF310#getRightX + * @see LogitechF310#getRightY + * @see LogitechF310#getLeftX + */ + public double getLeftY() { + return deadBand(controller.getRawAxis(JOYSTICK_LEFT_Y)); + } + + /** + * Method for returning the X value of the right joystick. + * + * @return X value of the right joystick + * + * @see LogitechF310#getRightY + * @see LogitechF310#getLeftX + * @see LogitechF310#getLeftY + */ + public double getRightX() { + return deadBand(controller.getRawAxis(JOYSTICK_RIGHT_X)); + } + + /** + * Method for returning the Y value of the right joystick. + * + * @return Y value of the right joystick + * + * @see LogitechF310#getRightX + * @see LogitechF310#getLeftX + * @see LogitechF310#getLeftY + */ + public double getRightY() { + return deadBand(controller.getRawAxis(JOYSTICK_RIGHT_Y)); + } + + // Trigger Methods // + + /** + * Method for returning the value of the left trigger. + * + * @return Value of the left trigger + * + * @see LogitechF310#getRightTrigger + */ + public double getLeftTrigger() { + return deadBand(controller.getRawAxis(TRIGGER_LEFT)); + } + + /** + * Method for returning the value of the right trigger. + * + * @return Value of the right trigger + * + * @see LogitechF310#getLeftTrigger + */ + public double getRightTrigger() { + return deadBand(controller.getRawAxis(TRIGGER_RIGHT)); + } + + // Button Methods // + + /** + * Method for returning the value of the A button. + * + * @return Value of the A button + * + * @see LogitechF310#getBButton + * @see LogitechF310#getXButton + * @see LogitechF310#getYButton + */ + public boolean getAButton() { + return controller.getRawButton(BUTTON_A); + } + + /** + * Method for returning the value of the B button. + * + * @return Value of the B button + * + * @see LogitechF310#getAButton + * @see LogitechF310#getXButton + * @see LogitechF310#getYButton + */ + public boolean getBButton() { + return controller.getRawButton(BUTTON_B); + } + + /** + * Method for returning the value of the X button. + * + * @return Value of the X button + * + * @see LogitechF310#getAButton + * @see LogitechF310#getBButton + * @see LogitechF310#getYButton + */ + public boolean getXButton() { + return controller.getRawButton(BUTTON_X); + } + + /** + * Method for returning the value of the Y button. + * + * @return Value of the Y button + * + * @see LogitechF310#getAButton + * @see LogitechF310#getBButton + * @see LogitechF310#getXButton + */ + public boolean getYButton() { + return controller.getRawButton(BUTTON_Y); + } + + /** + * Method for returning the value of the back button. + * + * @return Value of the back button + * + * @see LogitechF310#getStartButton + */ + public boolean getBackButton() { + return controller.getRawButton(BUTTON_START); + } + + /** + * Method for returning the value of the start button. + * + * @return Value of the start button + * + * @see LogitechF310#getBackButton + */ + public boolean getStartButton() { + return controller.getRawButton(BUTTON_BACK); + } + + /** + * Method for returning the value of the left bumper. + * + * @return Value of the left bumper + * + * @see LogitechF310#getRightBumper + */ + public boolean getLeftBumper() { + return controller.getRawButton(BUTTON_LEFT_BUMPER); + } + + /** + * Method for returning the value of the right bumper. + * + * @return Value of the right bumper + * + * @see LogitechF310#getLeftBumper + */ + public boolean getRightBumper() { + return controller.getRawButton(BUTTON_RIGHT_BUMPER); + } + + // D-Pad Methods // + + public enum DPad { + /** + * Up on the D-Pad. + */ + up, + + /** + * Down on the D-Pad. + */ + down, + + /** + * Right on the D-Pad. + */ + left, + + /** + * Left on the D-Pad. + */ + right, + + /** + * Up-Right on the D-Pad. + */ + upright, + + /** + * Up-Left on the D-Pad. + */ + upleft, + + /** + * Down-Right on the D-Pad. + */ + downright, + + /** + * Down-Left on the D-Pad. + */ + downleft, + + /** + * No direction on the D-Pad. + */ + none + } + + /** + * Upright D-Pad POV value. + */ + private static final int DPAD_UPRIGHT = 45; + + /** + * Right D-Pad POV value. + */ + private static final int DPAD_RIGHT = 90; + + /** + * Downright D-Pad POV value. + */ + private static final int DPAD_DOWNRIGHT = 135; + + /** + * Down POV D-Pad value. + */ + private static final int DPAD_DOWN = 180; + + /** + * Downleft D-Pad POV value. + */ + private static final int DPAD_DOWNLEFT = 225; + + /** + * Left D-Pad POV value. + */ + private static final int DPAD_LEFT = 270; + + /** + * Upleft D-Pad POV value. + */ + private static final int DPAD_UPLEFT = 315; + + /** + * Up D-Pad POV value. + */ + private static final int DPAD_UP = 360; + + /** + * Method for returning the value of the D-Pad. + * + * @return value of the D-Pad + * + * @see LogitechF310.DPad + */ + public DPad getDPad() { + switch (controller.getPOV()) { + case 0: + return DPad.up; + case DPAD_UPRIGHT: + return DPad.upright; + case DPAD_RIGHT: + return DPad.right; + case DPAD_DOWNRIGHT: + return DPad.downright; + case DPAD_DOWN: + return DPad.down; + case DPAD_DOWNLEFT: + return DPad.downleft; + case DPAD_LEFT: + return DPad.left; + case DPAD_UPLEFT: + return DPad.upleft; + case DPAD_UP: + return DPad.up; + default: + return DPad.none; + } + } + + // Rumble Methods // + + // This controller does not have rumble functionality :( + + // General Methods // + + /** + * Method for checking if the controller is connected. + * + * @return true if the controller is connected, false if not + */ + public boolean isConnected() { + return (controller.isConnected()); + } + + /** + * Method for getting the name of the controller. + * + * @return name of the controller + */ + public String getName() { + return controller.getName(); + } +} diff --git a/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/controllers/PS4.java b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/controllers/PS4.java new file mode 100644 index 0000000..cef2652 --- /dev/null +++ b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/controllers/PS4.java @@ -0,0 +1,498 @@ +package frc.controllers; + +import edu.wpi.first.wpilibj.PS4Controller; +import edu.wpi.first.wpilibj.GenericHID.RumbleType; + +/** + * This class is used to create an PS4 controller object. + *+ * This class uses the {@code PS4Controller} class from the wpilibj library. + *
+ *+ * This uses a deadband that can be set if needed. This helps control drift. + * This value can be in a range of 0 to 1. The higher the value, the more the + * stick has to move to register. This value is set in the constructor and is + * set alongside the controller ID. As a note: The deadband is only applied + * to the joystick axes. + *
+ * + * @see LogitechF310 + * @see Xbox + * + * @see edu.wpi.first.wpilibj.PS4Controller + */ +public class PS4 { + + /** + * The controller object. + * In this case, a {@code PS4Controller} object. + * + * @see edu.wpi.first.wpilibj.PS4Controller + */ + private PS4Controller controller; + + /** + * The deadband value. + */ + private double deadBand; + + /** + * Constructor for the PS4 class. + *+ * This constructor is used to create a LogitechF310 object. + * This takes in the controller ID and the deadband value. + *
+ * + * @param id Controller ID (Port) + * @param deadBandValue Deadband value + */ + public PS4(final int id, final double deadBandValue) { + controller = new PS4Controller(id); + deadBand = deadBandValue; + } + + // Deadband Method // + + // Although this isn't really needed for newer controllers, + // it's still here just in case one might develop drift + + /** + * Method for setting the deadband of the controller on the X and Y axes. + *+ * This sets a threshold the joystick must pass before registering a value. + * This value can be in a range of 0 to 1. The higher the value, + * the more the joystick has to move to register. + *
+ * + * @return Deadbanded value + * + * @param value Value to be deadbanded + */ + private double deadBand(final double value) { + return Math.abs(value) < deadBand ? 0 : value; + } + + // Joystick Methods // + + /** + * Method for returning the X value of the left joystick. + * + * @return X value of the left joystick + * + * @see PS4#getRightX + * @see PS4#getRightY + * @see PS4#getLeftY + */ + public double getLeftX() { + return deadBand(controller.getLeftX()); + } + + /** + * Method for returning the Y value of the left joystick. + * + * @return Y value of the left joystick + * + * @see PS4#getRightX + * @see PS4#getRightY + * @see PS4#getLeftX + */ + public double getLeftY() { + return deadBand(controller.getLeftY()); + } + + /** + * Method for returning the X value of the right joystick. + * + * @return X value of the right joystick + * + * @see PS4#getLeftX + * @see PS4#getRightY + * @see PS4#getLeftY + */ + public double getRightX() { + return deadBand(controller.getRightX()); + } + + /** + * Method for returning the Y value of the right joystick. + * + * @return Y value of the right joystick + * + * @see PS4#getRightX + * @see PS4#getLeftX + * @see PS4#getLeftY + */ + public double getRightY() { + return deadBand(controller.getRightY()); + } + + // Trigger Methods // + + /** + * Method for returning the value of the left trigger. + * + * @return value of the left trigger + * + * @see PS4#getRightTrigger + */ + public double getLeftTrigger() { + return deadBand(controller.getL2Axis()); + } + + /** + * Method for returning the value of the right trigger. + * + * @return value of the right trigger + * + * @see PS4#getLeftTrigger + */ + public double getRightTrigger() { + return deadBand(controller.getR2Axis()); + } + + // Button Methods // + + /** + * Method for returning the value of the X button. + * + * @return value of the X button + * + * @see PS4#getSquareButton + * @see PS4#getCircleButton + * @see PS4#getTriangleButton + * @see PS4#getShareButton + * @see PS4#getOptionsButton + * @see PS4#getPlayStationButton + * @see PS4#getTouchpadButton + */ + public boolean getXButton() { + return controller.getCrossButton(); + } + + /** + * Method for returning the value of the Square button. + * + * @return value of the Square button + * + * @see PS4#getXButton + * @see PS4#getCircleButton + * @see PS4#getTriangleButton + * @see PS4#getShareButton + * @see PS4#getOptionsButton + * @see PS4#getPlayStationButton + * @see PS4#getTouchpadButton + */ + public boolean getSquareButton() { + return controller.getSquareButton(); + } + + /** + * Method for returning the value of the Circle button. + * + * @return value of the Circle button + * + * @see PS4#getXButton + * @see PS4#getSquareButton + * @see PS4#getTriangleButton + * @see PS4#getShareButton + * @see PS4#getOptionsButton + * @see PS4#getPlayStationButton + * @see PS4#getTouchpadButton + */ + public boolean getCircleButton() { + return controller.getCircleButton(); + } + + /** + * Method for returning the value of the Triangle button. + * + * @return value of the Triangle button + * + * @see PS4#getXButton + * @see PS4#getSquareButton + * @see PS4#getCircleButton + * @see PS4#getShareButton + * @see PS4#getOptionsButton + * @see PS4#getPlayStationButton + * @see PS4#getTouchpadButton + */ + public boolean getTriangleButton() { + return controller.getTriangleButton(); + } + + /** + * Method for returning the value of the Share button. + * + * @return value of the Share button + * + * @see PS4#getXButton + * @see PS4#getSquareButton + * @see PS4#getCircleButton + * @see PS4#getTriangleButton + * @see PS4#getOptionsButton + * @see PS4#getPlayStationButton + * @see PS4#getTouchpadButton + */ + public boolean getShareButton() { + return controller.getShareButton(); + } + + /** + * Method for returning the value of the Options button. + * + * @return value of the Options button + * + * @see PS4#getXButton + * @see PS4#getSquareButton + * @see PS4#getCircleButton + * @see PS4#getTriangleButton + * @see PS4#getShareButton + * @see PS4#getPlayStationButton + * @see PS4#getTouchpadButton + */ + public boolean getOptionsButton() { + return controller.getOptionsButton(); + } + + /** + * Method for returning the value of the PlayStation button. + * + * @return value of the PlayStation button + * + * @see PS4#getXButton + * @see PS4#getSquareButton + * @see PS4#getCircleButton + * @see PS4#getTriangleButton + * @see PS4#getShareButton + * @see PS4#getOptionsButton + * @see PS4#getTouchpadButton + */ + public boolean getPlayStationButton() { + return controller.getPSButton(); + } + + /** + * Method for returning the value of the left bumper. + * + * @return value of the left bumper + * + * @see PS4#getRightBumper + */ + public boolean getLeftBumper() { + return controller.getL1Button(); + } + + /** + * Method for returning the value of the right bumper. + * + * @return value of the right bumper + * + * @see PS4#getLeftBumper + */ + public boolean getRightBumper() { + return controller.getR1Button(); + } + + /** + * Method for returning the value of the left joystick button. + * + * @return value of the left joystick button + * + * @see PS4#getRightJoystickButton + */ + public boolean getLeftJoystickButton() { + return controller.getL3Button(); + } + + /** + * Method for returning the value of the right joystick button. + * + * @return value of the right joystick button + * + * @see PS4#getLeftJoystickButton + */ + public boolean getRightJoystickButton() { + return controller.getR3Button(); + } + + // Touchpad Methods // + + /** + * Method for returning the value of the Touchpad button. + * + * @return value of the Touchpad button + * + * @see PS4#getXButton + * @see PS4#getSquareButton + * @see PS4#getCircleButton + * @see PS4#getTriangleButton + * @see PS4#getShareButton + * @see PS4#getOptionsButton + * @see PS4#getPlayStationButton + */ + public boolean getTouchpadButton() { + return controller.getTouchpad(); + } + + // There is a 'touchpad' that uses an event loop + // but for the purpose of this class, it is not needed + // It might be added in a future version if there becomes a need for it + // If you have a need for it or have added it yourself, + // Submit a pull request or submit an issue on the GitHub repository + // https://github.com/J-The-Fox/FRC-Team-5098 + + // D-Pad Methods // + + public enum DPad { + /** + * Up on the D-Pad. + */ + up, + + /** + * Down on the D-Pad. + */ + down, + + /** + * Right on the D-Pad. + */ + left, + + /** + * Left on the D-Pad. + */ + right, + + /** + * Up-Right on the D-Pad. + */ + upright, + + /** + * Up-Left on the D-Pad. + */ + upleft, + + /** + * Down-Right on the D-Pad. + */ + downright, + + /** + * Down-Left on the D-Pad. + */ + downleft, + + /** + * No direction on the D-Pad. + */ + none + } + + /** + * Upright D-Pad POV value. + */ + private static final int DPAD_UPRIGHT = 45; + + /** + * Right D-Pad POV value. + */ + private static final int DPAD_RIGHT = 90; + + /** + * Downright D-Pad POV value. + */ + private static final int DPAD_DOWNRIGHT = 135; + + /** + * Down POV D-Pad value. + */ + private static final int DPAD_DOWN = 180; + + /** + * Downleft D-Pad POV value. + */ + private static final int DPAD_DOWNLEFT = 225; + + /** + * Left D-Pad POV value. + */ + private static final int DPAD_LEFT = 270; + + /** + * Upleft D-Pad POV value. + */ + private static final int DPAD_UPLEFT = 315; + + /** + * Up D-Pad POV value. + */ + private static final int DPAD_UP = 360; + + /** + * Method for returning the value of the D-Pad. + * + * @return value of the D-Pad + * + * @see PS4.DPad + */ + public DPad getDPad() { + switch (controller.getPOV()) { + case 0: + return DPad.up; + case DPAD_UPRIGHT: + return DPad.upright; + case DPAD_RIGHT: + return DPad.right; + case DPAD_DOWNRIGHT: + return DPad.downright; + case DPAD_DOWN: + return DPad.down; + case DPAD_DOWNLEFT: + return DPad.downleft; + case DPAD_LEFT: + return DPad.left; + case DPAD_UPLEFT: + return DPad.upleft; + case DPAD_UP: + return DPad.up; + default: + return DPad.none; + } + } + + // Rumble Methods // + + /** + * Method for setting the rumble of the controller. + * + * @param type type of rumble to set + * @param value value to set the rumble to + * + * @see edu.wpi.first.wpilibj.GenericHID.RumbleType + */ + public void setRumble(final RumbleType type, final double value) { + controller.setRumble(type, value); + } + + // General Methods // + + /** + * Method for checking if the controller is connected. + * + * @return true if the controller is connected, false if not + */ + public boolean isConnected() { + return (controller.isConnected()); + } + + /** + * Method for getting the name of the controller. + * + * @return name of the controller + */ + public String getName() { + return controller.getName(); + } +} diff --git a/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/controllers/Xbox.java b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/controllers/Xbox.java new file mode 100644 index 0000000..c8cc131 --- /dev/null +++ b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/controllers/Xbox.java @@ -0,0 +1,425 @@ +package frc.controllers; + +import edu.wpi.first.wpilibj.XboxController; +import edu.wpi.first.wpilibj.GenericHID.RumbleType; + +/** + * This class is used to create an Xbox controller object. + *+ * This class uses the {@code XboxController} class from the wpilibj library. + *
+ *+ * This uses a deadband that can be set if needed. This helps control drift. + * This value can be in a range of 0 to 1. The higher the value, the more the + * stick has to move to register. This value is set in the constructor and is + * set alongside the controller ID. As a note: The deadband is only applied + * to the joystick axes. + *
+ * + * @see LogitechF310 + * @see PS4 + * + * @see edu.wpi.first.wpilibj.XboxController + */ +public class Xbox { + + /** + * The controller object. + * In this case, a {@code XboxController} object. + */ + private XboxController controller; + + /** + * The deadband value. + */ + private double deadBand; + + /** + * Constructor for the Xbox class. + *+ * This constructor is used to create a LogitechF310 object. + * This takes in the controller ID and the deadband value. + *
+ * + * @param id Controller ID (Port) + * @param deadBandValue Deadband value + */ + public Xbox(final int id, final double deadBandValue) { + controller = new XboxController(id); + deadBand = deadBandValue; + } + + // Deadband Method // + + // Although this isn't really needed for newer controllers, + // it's still here just in case one might develop drift + + /** + * Method for setting the deadband of the controller on the X and Y axes. + *+ * This sets a threshold the joystick must pass before registering a value. + * This value can be in a range of 0 to 1. The higher the value, + * the more the joystick has to move to register. + *
+ * + * @return Deadbanded value + * + * @param value Value to be deadbanded + */ + private double deadBand(final double value) { + return Math.abs(value) < deadBand ? 0 : value; + } + + // Joystick Methods // + + /** + * Method for returning the X value of the left joystick. + * + * @return X value of the left joystick + * + * @see Xbox#getRightX + * @see Xbox#getRightY + * @see Xbox#getLeftY + */ + public double getLeftX() { + return deadBand(controller.getLeftX()); + } + + /** + * Method for returning the Y value of the left joystick. + * + * @return Y value of the left joystick + * + * @see Xbox#getRightX + * @see Xbox#getRightY + * @see Xbox#getLeftX + */ + public double getLeftY() { + return deadBand(controller.getLeftY()); + } + + /** + * Method for returning the X value of the right joystick. + * + * @return X value of the right joystick + * + * @see Xbox#getRightY + * @see Xbox#getLeftX + * @see Xbox#getLeftY + */ + public double getRightX() { + return deadBand(controller.getRightX()); + } + + /** + * Method for returning the Y value of the right joystick. + * + * @return Y value of the right joystick + * + * @see Xbox#getRightX + * @see Xbox#getLeftX + * @see Xbox#getLeftY + */ + public double getRightY() { + return deadBand(controller.getRightY()); + } + + // Trigger Methods // + + /** + * Method for returning the value of the left trigger. + * + * @return value of the left trigger + * + * @see Xbox#getRightTrigger + */ + public double getLeftTrigger() { + return controller.getLeftTriggerAxis(); + } + + /** + * Method for returning the value of the right trigger. + * + * @return value of the right trigger + * + * @see Xbox#getLeftTrigger + */ + public double getRightTrigger() { + return controller.getRightTriggerAxis(); + } + + // Button Methods // + + /** + * Method for returning the value of the A button. + * + * @return value of the A button + * + * @see Xbox#getBButton + * @see Xbox#getXButton + * @see Xbox#getYButton + */ + public boolean getAButton() { + return controller.getAButton(); + } + + /** + * Method for returning the value of the B button. + * + * @return value of the B button + * + * @see Xbox#getAButton + * @see Xbox#getXButton + * @see Xbox#getYButton + */ + public boolean getBButton() { + return controller.getBButton(); + } + + /** + * Method for returning the value of the X button. + * + * @return value of the X button + * + * @see Xbox#getAButton + * @see Xbox#getBButton + * @see Xbox#getYButton + */ + public boolean getXButton() { + return controller.getXButton(); + } + + /** + * Method for returning the value of the Y button. + * + * @return value of the Y button + * + * @see Xbox#getAButton + * @see Xbox#getBButton + * @see Xbox#getXButton + */ + public boolean getYButton() { + return controller.getYButton(); + } + + /** + * Method for returning the value of the start button. + * + * @return value of the start button + * + * @see Xbox#getBackButton + */ + public boolean getStartButton() { + return controller.getStartButton(); + } + + /** + * Method for returning the value of the back button. + * + * @return value of the back button + * + * @see Xbox#getStartButton + */ + public boolean getBackButton() { + return controller.getBackButton(); + } + + /** + * Method for returning the value of the left bumper. + * + * @return value of the left bumper + * + * @see Xbox#getRightBumper + */ + public boolean getLeftBumper() { + return controller.getLeftBumper(); + } + + /** + * Method for returning the value of the right bumper. + * + * @return value of the right bumper + * + * @see Xbox#getLeftBumper + */ + public boolean getRightBumper() { + return controller.getRightBumper(); + } + + /** + * Method for returning the value of the left stick button. + * + * @return value of the left stick button + * + * @see Xbox#getRightStickButton + */ + public boolean getLeftStickButton() { + return controller.getLeftStickButton(); + } + + /** + * Method for returning the value of the right stick button. + * + * @return value of the right stick button + * + * @see Xbox#getLeftStickButton + */ + public boolean getRightStickButton() { + return controller.getRightStickButton(); + } + + // D-Pad Methods // + + public enum DPad { + /** + * Up on the D-Pad. + */ + up, + + /** + * Down on the D-Pad. + */ + down, + + /** + * Right on the D-Pad. + */ + left, + + /** + * Left on the D-Pad. + */ + right, + + /** + * Up-Right on the D-Pad. + */ + upright, + + /** + * Up-Left on the D-Pad. + */ + upleft, + + /** + * Down-Right on the D-Pad. + */ + downright, + + /** + * Down-Left on the D-Pad. + */ + downleft, + + /** + * No direction on the D-Pad. + */ + none + } + + /** + * Upright D-Pad POV value. + */ + private static final int DPAD_UPRIGHT = 45; + + /** + * Right D-Pad POV value. + */ + private static final int DPAD_RIGHT = 90; + + /** + * Downright D-Pad POV value. + */ + private static final int DPAD_DOWNRIGHT = 135; + + /** + * Down POV D-Pad value. + */ + private static final int DPAD_DOWN = 180; + + /** + * Downleft D-Pad POV value. + */ + private static final int DPAD_DOWNLEFT = 225; + + /** + * Left D-Pad POV value. + */ + private static final int DPAD_LEFT = 270; + + /** + * Upleft D-Pad POV value. + */ + private static final int DPAD_UPLEFT = 315; + + /** + * Up D-Pad POV value. + */ + private static final int DPAD_UP = 360; + + /** + * Method for returning the value of the D-Pad. + * + * @return value of the D-Pad + * + * @see Xbox.DPad + */ + public DPad getDPad() { + switch (controller.getPOV()) { + case 0: + return DPad.up; + case DPAD_UPRIGHT: + return DPad.upright; + case DPAD_RIGHT: + return DPad.right; + case DPAD_DOWNRIGHT: + return DPad.downright; + case DPAD_DOWN: + return DPad.down; + case DPAD_DOWNLEFT: + return DPad.downleft; + case DPAD_LEFT: + return DPad.left; + case DPAD_UPLEFT: + return DPad.upleft; + case DPAD_UP: + return DPad.up; + default: + return DPad.none; + } + } + + // Rumble Methods // + + /** + * Method for setting the rumble of the controller. + * + * @param type type of rumble to set + * @param value value to set the rumble to + * + * @see edu.wpi.first.wpilibj.GenericHID.RumbleType + */ + public void setRumble(final RumbleType type, final double value) { + controller.setRumble(type, value); + } + + // General Methods // + + /** + * Method for checking if the controller is connected. + * + * @return true if the controller is connected, false if not + */ + public boolean isConnected() { + return (controller.isConnected()); + } + + /** + * Method for getting the name of the controller. + * + * @return name of the controller + */ + public String getName() { + return controller.getName(); + } +} diff --git a/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/controllers/package-info.java b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/controllers/package-info.java new file mode 100644 index 0000000..80793a8 --- /dev/null +++ b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/controllers/package-info.java @@ -0,0 +1,7 @@ +/** + * Holds controller classes + *+ * This can be used to hold both custom and pre-made controller classes. + *
+ */ +package frc.controllers; diff --git a/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/package-info.java b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/package-info.java new file mode 100644 index 0000000..36e2dec --- /dev/null +++ b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/package-info.java @@ -0,0 +1,7 @@ +/** + * Main package for robot code. + *+ * All code that is deployed to the robot would be located under this package. + *
+ */ +package frc; diff --git a/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/robot/Main.java b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/robot/Main.java new file mode 100644 index 0000000..48b72ed --- /dev/null +++ b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/robot/Main.java @@ -0,0 +1,30 @@ +// 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; + +/** + * Do NOT add any static variables to this class, + * or any initialization at all. Unless you know what you are doing, + * do not modify this file except to change the parameter class to the + * startRobot call. + */ +public final class Main { + private Main() { + } + + /** + * Main initialization function. Do not perform any initialization here. + *+ * If you change your main robot class, change the parameter type. + *
+ * + * @param args arguments from command line + */ + public static void main(final String... args) { + RobotBase.startRobot(Robot::new); + } +} diff --git a/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/robot/Robot.java b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/robot/Robot.java new file mode 100644 index 0000000..cd92b7c --- /dev/null +++ b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/robot/Robot.java @@ -0,0 +1,179 @@ +// 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; + +// Imports // +import com.fasterxml.jackson.databind.ObjectMapper; +import edu.wpi.first.wpilibj.Filesystem; +import edu.wpi.first.wpilibj.GenericHID.RumbleType; +import edu.wpi.first.wpilibj.TimedRobot; +import frc.CommonData; +import frc.components.IComponent; +import frc.components.SwerveDrive; +import frc.components.autonomous.Autonomous; +import frc.controllers.PS4; +import frc.controllers.Xbox; +import java.io.IOException; + +/** + * The VM is configured to automatically run this class, + * and to call the functions corresponding to + * each mode, as described in the TimedRobot documentation. + * If you change the name of this class or + * the package after creating this project, + * you must also update the build.gradle file in the + * project. + */ +public final class Robot extends TimedRobot { + + /** + * The settings object. + * This is used to store the settings from the robot_settings.json file. + */ + private static Settings settings; + static { + ObjectMapper mapper = new ObjectMapper(); + try { + var filepath = Filesystem.getDeployDirectory().toPath().resolve( + "robot_settings.json"); + settings = mapper.readValue(filepath.toFile(), Settings.class); + } catch (IOException ex) { + System.out.println(ex.toString()); + } + } + + // Initialize the controllers // + // NOTE: This might be used for a more dynamic way of selecting controllers + + /** + * The main controller. + * This is used for the main driver. + *+ * This is an {@code Xbox} object. + *
+ *+ * Notice: This might be changed in the future. + *
+ */ + private Xbox controller = new Xbox(settings.controllerID, 0.1); + + /** + * The auxiliary controller. + * This is used for the auxiliary driver. + *+ * This is a {@code PS4} object. + *
+ *+ * Notice: This might be changed in the future. + *
+ */ + // private PS4 auxController = new PS4(settings.auxControllerID, 0); + + // Set up the components + /** + * The components array. + * This is used to store all of the components. + *+ * This is an array of {@code IComponent} objects. + *
+ *+ * Note: More components will be added here. + *
+ */ + private IComponent[] components = + new IComponent[] {new SwerveDrive(settings.swerveDrive)}; + + /** + * The autonomous object. + */ + private Autonomous autonomous; + + @Override + public void robotInit() { + // Calibrate the gyro before the robot runs to ensure that it is accurate + CommonData.setCalibrate(true); + CommonData.setFollowPath(false); + } + + @Override + public void robotPeriodic() { + + // For each component in the components array, update it + // This calls the update method in each of the component classes + // Since this in the robotPeriodic method, + // this will apply to all modes (autonomous, teleop, etc.) + for (var actuator : components) { + actuator.update(); + } + } + + @Override + public void autonomousInit() { + // autonomous = new Autonomous(); + + CommonData.setFollowPath(true); + } + + @Override + public void autonomousPeriodic() { + // Update the autonomous states + // autonomous.update(); + } + + @Override + public void teleopInit() { + CommonData.setFollowPath(false); + } + + @Override + public void teleopPeriodic() { + + // Update the controller values // + + // Update values for the Swerve Drive + CommonData.setCalibrate(controller.getXButton()); + CommonData.setSideSpeed(controller.getLeftX()); + CommonData.setForwardSpeed(controller.getLeftY()); + CommonData.setDesiredTurn( + Utility.snapToEdge(-controller.getRightX(), -1, 1, 0.9)); + // Utility.UIUpdate(); + } + + @Override + public void disabledInit() { + CommonData.setFollowPath(false); + + // "Turn off" all functions of the robot // + + CommonData.setDesiredTurn(0); // Set the turn speed to 0 + CommonData.setForwardSpeed(0); // Set the drive speed to 0 + + // Turn off the rumble on any controllers + controller.setRumble(RumbleType.kBothRumble, 0); + // auxController.setRumble(RumbleType.kBothRumble, 0); + + CommonData.setCounter(0); // Set the counter to 0 (used in autonomous) + } + + @Override + public void disabledPeriodic() {} + + @Override + public void testInit() { + CommonData.setFollowPath(true); + } + + @Override + public void testPeriodic() { + // Utility.printLn("Test Periodic running"); + // Utility.UIUpdate(); + } + + @Override + public void simulationInit() {} + + @Override + public void simulationPeriodic() {} +} diff --git a/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/robot/Settings.java b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/robot/Settings.java new file mode 100644 index 0000000..a5c7fc3 --- /dev/null +++ b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/robot/Settings.java @@ -0,0 +1,26 @@ +package frc.robot; + +public class Settings { + + public class SwerveDrive { + + public class Wheel { + + public int driveID; + public int turnID; + public int encoderID; + + public double posX; + public double posY; + } + + public Wheel frontLeft; + public Wheel frontRight; + public Wheel backLeft; + public Wheel backRight; + } + + public SwerveDrive swerveDrive; + + public int controllerID; +} diff --git a/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/robot/Utility.java b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/robot/Utility.java new file mode 100644 index 0000000..6464012 --- /dev/null +++ b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/robot/Utility.java @@ -0,0 +1,106 @@ +package frc.robot; + +// import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; +// import frc.CommonData; +/** + * The {@code Utility} class is used to store general methods that are used + * throughout the code. + *+ * Current methods include: + *
+ * If the value is less than the minimum, the minimum is returned. + * If the value is greater than the maximum, the maximum is returned. + * If the value is between the minimum and maximum, the value is returned. + *
+ * + * @param value Value to clamp + * @param min Minimum value + * @param max Maximum value + * + * @return The clamped value + */ + public static double clamp(final double value, final double min, + final double max) { + return value < min ? min : value > max ? max : value; + } + + /** + * Snap a value to the minimum or maximum value only if it is within a + * threshold. + * Although similar to the {@link Utility#clamp} method, + * this method is used to snap a value to the minimum or maximum value + * if it iswithin a threshold + * + * @param value Value to snap + * @param min Minimum value + * @param max Maximum value + * @param threshold Threshold to snap to + * + * @return The snapped value + */ + public static double snapToEdge(final double value, final double min, + final double max, final double threshold) { + return value < -threshold ? min : value > threshold ? max : value; + } + // public static void UIUpdate() { + // // question for later, what is the key parameter necessary for methods + // // CommonData.setTuningMotor(SmartDashboard.getString("Change Tuning + // Motor", "FL")); SmartDashboard.putString("Tuning Motor", + // CommonData.getTuningMotor()); SmartDashboard.putBoolean("FL Button", + // true); SmartDashboard.putBoolean("FR Button", false); + // SmartDashboard.putBoolean("BL Button", false); + // SmartDashboard.putBoolean("BR Button", false); + // SmartDashboard.putBooleanArray("Motor Array", + // CommonData.tuningMotorArray); + // // SmartDashboard.getNumber("P Value", "") + // // SmartDashboard. + // Utility.printLn("UI update is running"); + // } +} \ No newline at end of file diff --git a/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/robot/package-info.java b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/robot/package-info.java new file mode 100644 index 0000000..20c110b --- /dev/null +++ b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/robot/package-info.java @@ -0,0 +1,7 @@ +/** + * Holds primary robot methods + *+ * This package is automatically created when creating a new robot project. + *
+ */ +package frc.robot; diff --git a/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/state_machine/State.java b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/state_machine/State.java new file mode 100644 index 0000000..d2450f0 --- /dev/null +++ b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/state_machine/State.java @@ -0,0 +1,37 @@ +package frc.state_machine; + +/** +* Abstract class used to create states for the state machine. +*/ +public abstract class State { + + // Imported from 2022-2023 code + + /** + * Method called when a state is entered. + */ + public void onEnter() { + } + + /** + * Method called when a state is exited. + */ + public void onExit() { + } + + /** + * Method called to check if a state is valid. + * @return boolean + */ + public boolean isValid() { + return true; + } + + /** + * Method called to run a state. + * This method should return true when the state is finished + * + * @return boolean + */ + public abstract boolean run(); +} diff --git a/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/state_machine/StateMachine.java b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/state_machine/StateMachine.java new file mode 100644 index 0000000..3d9e73f --- /dev/null +++ b/2024-2025/Win-Nguyen/Win-Nguyen-2024/src/main/java/frc/state_machine/StateMachine.java @@ -0,0 +1,52 @@ +package frc.state_machine; + +import java.util.ArrayList; +import java.util.List; + +/** + * State Machine class for controlling a state machine. + * This is mainly used during auto. + * + * @see frc.components.autonomous.Autonomous + */ +public final class StateMachine { + + /** + * The current state of the state machine. + */ + private State currentState; + + /** + * The list of states to run. + */ + private List+ * This package contains all of the code for the state machine. + *
+ */ +package frc.state_machine; diff --git a/2024-2025/Win-Nguyen/Win-Nguyen-2024/vendordeps/NavX.json b/2024-2025/Win-Nguyen/Win-Nguyen-2024/vendordeps/NavX.json new file mode 100644 index 0000000..e978a5f --- /dev/null +++ b/2024-2025/Win-Nguyen/Win-Nguyen-2024/vendordeps/NavX.json @@ -0,0 +1,40 @@ +{ + "fileName": "NavX.json", + "name": "NavX", + "version": "2024.1.0", + "uuid": "cb311d09-36e9-4143-a032-55bb2b94443b", + "frcYear": "2024", + "mavenUrls": [ + "https://dev.studica.com/maven/release/2024/" + ], + "jsonUrl": "https://dev.studica.com/releases/2024/NavX.json", + "javaDependencies": [ + { + "groupId": "com.kauailabs.navx.frc", + "artifactId": "navx-frc-java", + "version": "2024.1.0" + } + ], + "jniDependencies": [], + "cppDependencies": [ + { + "groupId": "com.kauailabs.navx.frc", + "artifactId": "navx-frc-cpp", + "version": "2024.1.0", + "headerClassifier": "headers", + "sourcesClassifier": "sources", + "sharedLibrary": false, + "libName": "navx_frc", + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "linuxathena", + "linuxraspbian", + "linuxarm32", + "linuxarm64", + "linuxx86-64", + "osxuniversal", + "windowsx86-64" + ] + } + ] +} \ No newline at end of file diff --git a/2024-2025/Win-Nguyen/Win-Nguyen-2024/vendordeps/PathplannerLib.json b/2024-2025/Win-Nguyen/Win-Nguyen-2024/vendordeps/PathplannerLib.json new file mode 100644 index 0000000..6dc648d --- /dev/null +++ b/2024-2025/Win-Nguyen/Win-Nguyen-2024/vendordeps/PathplannerLib.json @@ -0,0 +1,38 @@ +{ + "fileName": "PathplannerLib.json", + "name": "PathplannerLib", + "version": "2024.2.8", + "uuid": "1b42324f-17c6-4875-8e77-1c312bc8c786", + "frcYear": "2024", + "mavenUrls": [ + "https://3015rangerrobotics.github.io/pathplannerlib/repo" + ], + "jsonUrl": "https://3015rangerrobotics.github.io/pathplannerlib/PathplannerLib.json", + "javaDependencies": [ + { + "groupId": "com.pathplanner.lib", + "artifactId": "PathplannerLib-java", + "version": "2024.2.8" + } + ], + "jniDependencies": [], + "cppDependencies": [ + { + "groupId": "com.pathplanner.lib", + "artifactId": "PathplannerLib-cpp", + "version": "2024.2.8", + "libName": "PathplannerLib", + "headerClassifier": "headers", + "sharedLibrary": false, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal", + "linuxathena", + "linuxarm32", + "linuxarm64" + ] + } + ] +} \ No newline at end of file diff --git a/2024-2025/Win-Nguyen/Win-Nguyen-2024/vendordeps/Phoenix6.json b/2024-2025/Win-Nguyen/Win-Nguyen-2024/vendordeps/Phoenix6.json new file mode 100644 index 0000000..2b7d172 --- /dev/null +++ b/2024-2025/Win-Nguyen/Win-Nguyen-2024/vendordeps/Phoenix6.json @@ -0,0 +1,339 @@ +{ + "fileName": "Phoenix6.json", + "name": "CTRE-Phoenix (v6)", + "version": "24.2.0", + "frcYear": 2024, + "uuid": "e995de00-2c64-4df5-8831-c1441420ff19", + "mavenUrls": [ + "https://maven.ctr-electronics.com/release/" + ], + "jsonUrl": "https://maven.ctr-electronics.com/release/com/ctre/phoenix6/latest/Phoenix6-frc2024-latest.json", + "conflictsWith": [ + { + "uuid": "3fcf3402-e646-4fa6-971e-18afe8173b1a", + "errorMessage": "The combined Phoenix-6-And-5 vendordep is no longer supported. Please remove the vendordep and instead add both the latest Phoenix 6 vendordep and Phoenix 5 vendordep.", + "offlineFileName": "Phoenix6And5.json" + } + ], + "javaDependencies": [ + { + "groupId": "com.ctre.phoenix6", + "artifactId": "wpiapi-java", + "version": "24.2.0" + } + ], + "jniDependencies": [ + { + "groupId": "com.ctre.phoenix6", + "artifactId": "tools", + "version": "24.2.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxathena" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "tools-sim", + "version": "24.2.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simTalonSRX", + "version": "24.2.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simTalonFX", + "version": "24.2.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simVictorSPX", + "version": "24.2.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simPigeonIMU", + "version": "24.2.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simCANCoder", + "version": "24.2.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProTalonFX", + "version": "24.2.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProCANcoder", + "version": "24.2.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProPigeon2", + "version": "24.2.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + } + ], + "cppDependencies": [ + { + "groupId": "com.ctre.phoenix6", + "artifactId": "wpiapi-cpp", + "version": "24.2.0", + "libName": "CTRE_Phoenix6_WPI", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxathena" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix6", + "artifactId": "tools", + "version": "24.2.0", + "libName": "CTRE_PhoenixTools", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxathena" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "wpiapi-cpp-sim", + "version": "24.2.0", + "libName": "CTRE_Phoenix6_WPISim", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "tools-sim", + "version": "24.2.0", + "libName": "CTRE_PhoenixTools_Sim", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simTalonSRX", + "version": "24.2.0", + "libName": "CTRE_SimTalonSRX", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simTalonFX", + "version": "24.2.0", + "libName": "CTRE_SimTalonFX", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simVictorSPX", + "version": "24.2.0", + "libName": "CTRE_SimVictorSPX", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simPigeonIMU", + "version": "24.2.0", + "libName": "CTRE_SimPigeonIMU", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simCANCoder", + "version": "24.2.0", + "libName": "CTRE_SimCANCoder", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProTalonFX", + "version": "24.2.0", + "libName": "CTRE_SimProTalonFX", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProCANcoder", + "version": "24.2.0", + "libName": "CTRE_SimProCANcoder", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProPigeon2", + "version": "24.2.0", + "libName": "CTRE_SimProPigeon2", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + } + ] +} \ No newline at end of file diff --git a/2024-2025/Win-Nguyen/Win-Nguyen-2024/vendordeps/WPILibNewCommands.json b/2024-2025/Win-Nguyen/Win-Nguyen-2024/vendordeps/WPILibNewCommands.json new file mode 100644 index 0000000..67bf389 --- /dev/null +++ b/2024-2025/Win-Nguyen/Win-Nguyen-2024/vendordeps/WPILibNewCommands.json @@ -0,0 +1,38 @@ +{ + "fileName": "WPILibNewCommands.json", + "name": "WPILib-New-Commands", + "version": "1.0.0", + "uuid": "111e20f7-815e-48f8-9dd6-e675ce75b266", + "frcYear": "2024", + "mavenUrls": [], + "jsonUrl": "", + "javaDependencies": [ + { + "groupId": "edu.wpi.first.wpilibNewCommands", + "artifactId": "wpilibNewCommands-java", + "version": "wpilib" + } + ], + "jniDependencies": [], + "cppDependencies": [ + { + "groupId": "edu.wpi.first.wpilibNewCommands", + "artifactId": "wpilibNewCommands-cpp", + "version": "wpilib", + "libName": "wpilibNewCommands", + "headerClassifier": "headers", + "sourcesClassifier": "sources", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "linuxathena", + "linuxarm32", + "linuxarm64", + "windowsx86-64", + "windowsx86", + "linuxx86-64", + "osxuniversal" + ] + } + ] +} diff --git a/2024-2025/main-bot/WPILib-License.md b/2024-2025/main-bot/WPILib-License.md new file mode 100644 index 0000000..e7cd597 --- /dev/null +++ b/2024-2025/main-bot/WPILib-License.md @@ -0,0 +1,24 @@ +Copyright (c) 2009-2024 FIRST and other WPILib contributors +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of FIRST, WPILib, nor the names of other WPILib + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY FIRST AND OTHER WPILIB CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY NONINFRINGEMENT AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL FIRST OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/2024-2025/main-bot/build.gradle b/2024-2025/main-bot/build.gradle new file mode 100644 index 0000000..b15eee5 --- /dev/null +++ b/2024-2025/main-bot/build.gradle @@ -0,0 +1,104 @@ +plugins { + id "java" + id "edu.wpi.first.GradleRIO" version "2025.2.1" +} + +java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 +} + +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' + deleteOldFiles = true // Change to true to delete files on roboRIO that no + // longer exist in deploy directory of this project + } + } + } + } +} + +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 = false + +// Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries. +// Also defines JUnit 5. +dependencies { + annotationProcessor wpi.java.deps.wpilibAnnotations() + 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) + + 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() + + 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:5.10.1' + testRuntimeOnly 'org.junit.platform:junit-platform-launcher' +} + +test { + useJUnitPlatform() + systemProperty 'junit.jupiter.extensions.autodetection.enabled', 'true' +} + +// Simulation configuration (e.g. environment variables). +wpi.sim.addGui().defaultEnabled = true +wpi.sim.addDriverstation() + +// Setting up my Jar File. In this case, adding all libraries into the main jar ('fat jar') +// 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) } } + from sourceSets.main.allSource + manifest edu.wpi.first.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) + +// Configure string concat to always inline compile +tasks.withType(JavaCompile) { + options.compilerArgs.add '-XDstringConcat=inline' +} diff --git a/2024-2025/main-bot/gradle/wrapper/gradle-wrapper.properties b/2024-2025/main-bot/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..8e975a5 --- /dev/null +++ b/2024-2025/main-bot/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=permwrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=permwrapper/dists diff --git a/2024-2025/main-bot/gradlew b/2024-2025/main-bot/gradlew new file mode 100755 index 0000000..f5feea6 --- /dev/null +++ b/2024-2025/main-bot/gradlew @@ -0,0 +1,252 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/2024-2025/main-bot/gradlew.bat b/2024-2025/main-bot/gradlew.bat new file mode 100644 index 0000000..9b42019 --- /dev/null +++ b/2024-2025/main-bot/gradlew.bat @@ -0,0 +1,94 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/2024-2025/main-bot/networktables.json b/2024-2025/main-bot/networktables.json new file mode 100644 index 0000000..60b0742 --- /dev/null +++ b/2024-2025/main-bot/networktables.json @@ -0,0 +1 @@ +[] diff --git a/2024-2025/main-bot/settings.gradle b/2024-2025/main-bot/settings.gradle new file mode 100644 index 0000000..3bc070a --- /dev/null +++ b/2024-2025/main-bot/settings.gradle @@ -0,0 +1,30 @@ +import org.gradle.internal.os.OperatingSystem + +pluginManagement { + repositories { + mavenLocal() + gradlePluginPortal() + String frcYear = '2025' + 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 + } + } +} + +Properties props = System.getProperties(); +props.setProperty("org.gradle.internal.native.headers.unresolved.dependencies.ignore", "true"); diff --git a/2024-2025/main-bot/simgui-ds.json b/2024-2025/main-bot/simgui-ds.json new file mode 100644 index 0000000..4a63cc1 --- /dev/null +++ b/2024-2025/main-bot/simgui-ds.json @@ -0,0 +1,97 @@ +{ + "System Joysticks": { + "window": { + "enabled": false + } + }, + "keyboardJoysticks": [ + { + "axisConfig": [ + { + "decKey": 65, + "incKey": 68 + }, + { + "decKey": 87, + "incKey": 83 + }, + { + "decKey": 69, + "decayRate": 0.0, + "incKey": 82, + "keyRate": 0.009999999776482582 + } + ], + "axisCount": 3, + "buttonCount": 4, + "buttonKeys": [ + 90, + 88, + 67, + 86 + ], + "povConfig": [ + { + "key0": 328, + "key135": 323, + "key180": 322, + "key225": 321, + "key270": 324, + "key315": 327, + "key45": 329, + "key90": 326 + } + ], + "povCount": 1 + }, + { + "axisConfig": [ + { + "decKey": 74, + "incKey": 76 + }, + { + "decKey": 73, + "incKey": 75 + } + ], + "axisCount": 2, + "buttonCount": 4, + "buttonKeys": [ + 77, + 44, + 46, + 47 + ], + "povCount": 0 + }, + { + "axisConfig": [ + { + "decKey": 263, + "incKey": 262 + }, + { + "decKey": 265, + "incKey": 264 + } + ], + "axisCount": 2, + "buttonCount": 6, + "buttonKeys": [ + 260, + 268, + 266, + 261, + 269, + 267 + ], + "povCount": 0 + }, + { + "axisCount": 0, + "buttonCount": 0, + "povCount": 0 + } + ] +} diff --git a/2024-2025/main-bot/simgui-window.json b/2024-2025/main-bot/simgui-window.json new file mode 100644 index 0000000..785b5de --- /dev/null +++ b/2024-2025/main-bot/simgui-window.json @@ -0,0 +1,83 @@ +{ + "Docking": { + "Data": [] + }, + "MainWindow": { + "GLOBAL": { + "font": "Proggy Dotted", + "fps": "120", + "height": "1057", + "maximized": "1", + "style": "0", + "userScale": "2", + "width": "1920", + "xpos": "1920", + "ypos": "23" + } + }, + "Table": { + "0xE56EC1C2,4": { + "Column 0 Weight": "1.0000", + "Column 1 Weight": "1.0000", + "Column 2 Weight": "1.0000", + "Column 3 Weight": "1.0000" + } + }, + "Window": { + "###FMS": { + "Collapsed": "0", + "Pos": "10,346", + "Size": "169,184" + }, + "###Joysticks": { + "Collapsed": "0", + "Pos": "149,27", + "Size": "796,234" + }, + "###NetworkTables": { + "Collapsed": "1", + "Pos": "28,566", + "Size": "750,440" + }, + "###NetworkTables Info": { + "Collapsed": "1", + "Pos": "26,593", + "Size": "750,145" + }, + "###Other Devices": { + "Collapsed": "0", + "Pos": "1650,32", + "Size": "250,695" + }, + "###Plot <0>": { + "Collapsed": "0", + "Pos": "948,27", + "Size": "700,400" + }, + "###Plot <1>": { + "Collapsed": "0", + "Pos": "949,433", + "Size": "700,400" + }, + "###System Joysticks": { + "Collapsed": "0", + "Pos": "12,348", + "Size": "192,218" + }, + "###Timing": { + "Collapsed": "0", + "Pos": "5,150", + "Size": "135,173" + }, + "Debug##Default": { + "Collapsed": "0", + "Pos": "60,60", + "Size": "400,400" + }, + "Robot State": { + "Collapsed": "0", + "Pos": "5,20", + "Size": "99,116" + } + } +} diff --git a/2024-2025/main-bot/simgui.json b/2024-2025/main-bot/simgui.json new file mode 100644 index 0000000..307e52a --- /dev/null +++ b/2024-2025/main-bot/simgui.json @@ -0,0 +1,95 @@ +{ + "HALProvider": { + "Other Devices": { + "Talon FX (v6)[12]": { + "header": { + "open": true + } + }, + "Talon FX (v6)[13]": { + "header": { + "open": true + } + } + } + }, + "NTProvider": { + "types": { + "/FMSInfo": "FMSInfo", + "/Pose": "Field2d", + "/SmartDashboard/Alerts": "Alerts", + "/SmartDashboard/Auto Chooser": "String Chooser", + "/SmartDashboard/Module 0": "Mechanism2d", + "/SmartDashboard/Module 1": "Mechanism2d", + "/SmartDashboard/Module 2": "Mechanism2d", + "/SmartDashboard/Module 3": "Mechanism2d" + } + }, + "NetworkTables": { + "Persistent Values": { + "open": false + }, + "Retained Values": { + "open": false + }, + "Transitory Values": { + "open": false + }, + "transitory": { + "DriveState": { + "ChassisSpeeds##v_/DriveState/Speeds": { + "open": true + } + }, + "SmartDashboard": { + "Alerts": { + "open": true + }, + "Auto Chooser": { + "open": true + }, + "Module 0": { + "open": true + }, + "Module 1": { + "open": true + }, + "Module 2": { + "open": true + }, + "Module 3": { + "open": true + } + } + } + }, + "NetworkTables Info": { + "visible": true + }, + "Plot": { + "Plot <0>": { + "plots": [ + { + "backgroundColor": [ + 0.0, + 0.0, + 0.0, + 0.8500000238418579 + ], + "height": 338, + "series": [ + { + "color": [ + 0.2980392277240753, + 0.44705885648727417, + 0.6901960968971252, + 1.0 + ], + "id": "CANMotor:Talon FX (v6)[12]-motorVoltage" + } + ] + } + ] + } + } +} diff --git a/2024-2025/main-bot/src/main/deploy/example.txt b/2024-2025/main-bot/src/main/deploy/example.txt new file mode 100644 index 0000000..bb82515 --- /dev/null +++ b/2024-2025/main-bot/src/main/deploy/example.txt @@ -0,0 +1,3 @@ +Files placed in this directory will be deployed to the RoboRIO into the +'deploy' directory in the home folder. Use the 'Filesystem.getDeployDirectory' wpilib function +to get a proper path relative to the deploy directory. \ No newline at end of file diff --git a/2024-2025/main-bot/src/main/deploy/pathplanner/autos/Long Curve Test Auto.auto b/2024-2025/main-bot/src/main/deploy/pathplanner/autos/Long Curve Test Auto.auto new file mode 100644 index 0000000..11e4ee9 --- /dev/null +++ b/2024-2025/main-bot/src/main/deploy/pathplanner/autos/Long Curve Test Auto.auto @@ -0,0 +1,19 @@ +{ + "version": "2025.0", + "command": { + "type": "sequential", + "data": { + "commands": [ + { + "type": "path", + "data": { + "pathName": "Command Example Path" + } + } + ] + } + }, + "resetOdom": true, + "folder": null, + "choreoAuto": false +} \ No newline at end of file diff --git a/2024-2025/main-bot/src/main/deploy/pathplanner/autos/Short PathPlanner Test.auto b/2024-2025/main-bot/src/main/deploy/pathplanner/autos/Short PathPlanner Test.auto new file mode 100644 index 0000000..f94ce95 --- /dev/null +++ b/2024-2025/main-bot/src/main/deploy/pathplanner/autos/Short PathPlanner Test.auto @@ -0,0 +1,19 @@ +{ + "version": "2025.0", + "command": { + "type": "sequential", + "data": { + "commands": [ + { + "type": "path", + "data": { + "pathName": "Fun Short Path" + } + } + ] + } + }, + "resetOdom": true, + "folder": null, + "choreoAuto": false +} \ No newline at end of file diff --git a/2024-2025/main-bot/src/main/deploy/pathplanner/navgrid.json b/2024-2025/main-bot/src/main/deploy/pathplanner/navgrid.json new file mode 100644 index 0000000..23e0db9 --- /dev/null +++ b/2024-2025/main-bot/src/main/deploy/pathplanner/navgrid.json @@ -0,0 +1 @@ +{"field_size":{"x":17.548,"y":8.052},"nodeSizeMeters":0.3,"grid":[[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true],[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true],[true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true,true,true],[true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true,true],[true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true],[true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true],[true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true],[true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true],[true,true,false,false,false,false,false,false,false,false,false,false,false,false,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,true,true],[true,true,false,false,false,false,false,false,false,false,false,false,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,true,true],[true,true,false,false,false,false,false,false,false,false,false,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,true,true],[true,true,false,false,false,false,false,false,false,false,true,true,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,true,true,true,false,false,false,false,false,false,false,false,true,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,true,true],[true,true,false,false,false,false,false,false,false,false,true,true,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,true,true,true,true,true,false,false,false,false,false,false,false,true,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,true,true],[true,true,false,false,false,false,false,false,false,false,true,true,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,true,true,true,true,true,false,false,false,false,false,false,false,true,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,true,true],[true,true,false,false,false,false,false,false,false,false,true,true,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,true,true,true,true,true,false,false,false,false,false,false,false,true,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,true,true],[true,true,false,false,false,false,false,false,false,false,true,true,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,true,true,true,false,false,false,false,false,false,false,false,true,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,true,true],[true,true,false,false,false,false,false,false,false,false,false,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,true,true],[true,true,false,false,false,false,false,false,false,false,false,false,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,true,true],[true,true,false,false,false,false,false,false,false,false,false,false,false,false,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,true,true],[true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true],[true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true],[true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true],[true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true],[true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true,true],[true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true,true,true],[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true],[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true]]} \ No newline at end of file diff --git a/2024-2025/main-bot/src/main/deploy/pathplanner/paths/Command Example Path.path b/2024-2025/main-bot/src/main/deploy/pathplanner/paths/Command Example Path.path new file mode 100644 index 0000000..cd58fd4 --- /dev/null +++ b/2024-2025/main-bot/src/main/deploy/pathplanner/paths/Command Example Path.path @@ -0,0 +1,70 @@ +{ + "version": "2025.0", + "waypoints": [ + { + "anchor": { + "x": 2.0, + "y": 7.0 + }, + "prevControl": null, + "nextControl": { + "x": 3.0, + "y": 7.0 + }, + "isLocked": false, + "linkedName": null + }, + { + "anchor": { + "x": 6.58125, + "y": 6.74464897260274 + }, + "prevControl": { + "x": 5.860809075342465, + "y": 7.706271404109589 + }, + "nextControl": { + "x": 7.301690924657534, + "y": 5.783026541095891 + }, + "isLocked": false, + "linkedName": null + }, + { + "anchor": { + "x": 6.881763698630137, + "y": 3.1535102739726026 + }, + "prevControl": { + "x": 6.971917808219178, + "y": 4.235359589041096 + }, + "nextControl": null, + "isLocked": false, + "linkedName": null + } + ], + "rotationTargets": [], + "constraintZones": [], + "pointTowardsZones": [], + "eventMarkers": [], + "globalConstraints": { + "maxVelocity": 3.0, + "maxAcceleration": 3.0, + "maxAngularVelocity": 540.0, + "maxAngularAcceleration": 720.0, + "nominalVoltage": 12.0, + "unlimited": false + }, + "goalEndState": { + "velocity": 0, + "rotation": 0.0 + }, + "reversed": false, + "folder": null, + "idealStartingState": { + "velocity": 0, + "rotation": 0.0 + }, + "useDefaultConstraints": true +} \ No newline at end of file diff --git a/2024-2025/main-bot/src/main/deploy/pathplanner/paths/Fun Short Path.path b/2024-2025/main-bot/src/main/deploy/pathplanner/paths/Fun Short Path.path new file mode 100644 index 0000000..95b3ae8 --- /dev/null +++ b/2024-2025/main-bot/src/main/deploy/pathplanner/paths/Fun Short Path.path @@ -0,0 +1,54 @@ +{ + "version": "2025.0", + "waypoints": [ + { + "anchor": { + "x": 2.0, + "y": 7.0 + }, + "prevControl": null, + "nextControl": { + "x": 3.0, + "y": 7.0 + }, + "isLocked": false, + "linkedName": null + }, + { + "anchor": { + "x": 4.1470890410958905, + "y": 5.587671232876712 + }, + "prevControl": { + "x": 3.1470890410958905, + "y": 5.587671232876712 + }, + "nextControl": null, + "isLocked": false, + "linkedName": null + } + ], + "rotationTargets": [], + "constraintZones": [], + "pointTowardsZones": [], + "eventMarkers": [], + "globalConstraints": { + "maxVelocity": 3.0, + "maxAcceleration": 3.0, + "maxAngularVelocity": 540.0, + "maxAngularAcceleration": 720.0, + "nominalVoltage": 12.0, + "unlimited": false + }, + "goalEndState": { + "velocity": 0, + "rotation": 178.8622775462112 + }, + "reversed": false, + "folder": null, + "idealStartingState": { + "velocity": 0, + "rotation": 0.0 + }, + "useDefaultConstraints": true +} \ No newline at end of file diff --git a/2024-2025/main-bot/src/main/deploy/pathplanner/paths/New Path.path b/2024-2025/main-bot/src/main/deploy/pathplanner/paths/New Path.path new file mode 100644 index 0000000..8ea16a6 --- /dev/null +++ b/2024-2025/main-bot/src/main/deploy/pathplanner/paths/New Path.path @@ -0,0 +1,54 @@ +{ + "version": "2025.0", + "waypoints": [ + { + "anchor": { + "x": 2.0, + "y": 7.0 + }, + "prevControl": null, + "nextControl": { + "x": 3.0, + "y": 7.0 + }, + "isLocked": false, + "linkedName": null + }, + { + "anchor": { + "x": 3.4408818493150686, + "y": 4.009974315068493 + }, + "prevControl": { + "x": 2.4408818493150686, + "y": 4.009974315068493 + }, + "nextControl": null, + "isLocked": false, + "linkedName": null + } + ], + "rotationTargets": [], + "constraintZones": [], + "pointTowardsZones": [], + "eventMarkers": [], + "globalConstraints": { + "maxVelocity": 3.0, + "maxAcceleration": 3.0, + "maxAngularVelocity": 540.0, + "maxAngularAcceleration": 720.0, + "nominalVoltage": 12.0, + "unlimited": false + }, + "goalEndState": { + "velocity": 0, + "rotation": 0.0 + }, + "reversed": false, + "folder": null, + "idealStartingState": { + "velocity": 0, + "rotation": 0.0 + }, + "useDefaultConstraints": true +} \ No newline at end of file diff --git a/2024-2025/main-bot/src/main/deploy/pathplanner/settings.json b/2024-2025/main-bot/src/main/deploy/pathplanner/settings.json new file mode 100644 index 0000000..1ce63a6 --- /dev/null +++ b/2024-2025/main-bot/src/main/deploy/pathplanner/settings.json @@ -0,0 +1,32 @@ +{ + "robotWidth": 0.9, + "robotLength": 0.9, + "holonomicMode": true, + "pathFolders": [], + "autoFolders": [], + "defaultMaxVel": 3.0, + "defaultMaxAccel": 3.0, + "defaultMaxAngVel": 540.0, + "defaultMaxAngAccel": 720.0, + "defaultNominalVoltage": 12.0, + "robotMass": 74.088, + "robotMOI": 6.883, + "robotTrackwidth": 0.546, + "driveWheelRadius": 0.051, + "driveGearing": 5.143, + "maxDriveSpeed": 5.45, + "driveMotorType": "krakenX60", + "driveCurrentLimit": 60.0, + "wheelCOF": 1.2, + "flModuleX": 0.273, + "flModuleY": 0.273, + "frModuleX": 0.273, + "frModuleY": -0.273, + "blModuleX": -0.273, + "blModuleY": 0.273, + "brModuleX": -0.273, + "brModuleY": -0.273, + "bumperOffsetX": 0.0, + "bumperOffsetY": 0.0, + "robotFeatures": [] +} \ No newline at end of file diff --git a/2024-2025/main-bot/src/main/java/frc/.clang-format b/2024-2025/main-bot/src/main/java/frc/.clang-format new file mode 100644 index 0000000..bdb418e --- /dev/null +++ b/2024-2025/main-bot/src/main/java/frc/.clang-format @@ -0,0 +1,6 @@ +Language: Java +BasedOnStyle: Microsoft + +AlignConsecutiveAssignments: Consecutive +AlignConsecutiveDeclarations: Consecutive +ColumnLimit: 0 \ No newline at end of file diff --git a/2024-2025/main-bot/src/main/java/frc/robot/Constants.java b/2024-2025/main-bot/src/main/java/frc/robot/Constants.java new file mode 100644 index 0000000..baac14d --- /dev/null +++ b/2024-2025/main-bot/src/main/java/frc/robot/Constants.java @@ -0,0 +1,120 @@ +// 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.generated.TunerConstants; +import static edu.wpi.first.units.Units.*; +import edu.wpi.first.units.measure.Angle; + +import edu.wpi.first.units.measure.Distance; + +/** + * The Constants class provides a convenient place for teams to hold robot-wide + * numerical or boolean constants. This class should not be used for any other + * purpose. All constants should be declared globally (i.e. public static). Do + * not put anything functional in this class. + * + *
+ * It is advised to statically import this class (or one of its inner classes)
+ * wherever the constants are needed, to reduce verbosity.
+ */
+public class Constants {
+ public static class OperatorConstants {
+ public static final int kDriverControllerPort = 0;
+ public static final int kAuxiliaryControllerPort = 1;
+ }
+
+ // PLACEHOLDER IDS!!!
+ public static class ElevatorConstants {
+ public static final int kElevatorLeftMotorID = 12;
+ public static final int kElevatorRightMotorID = 13;
+ public static final double kMotorElevatorSpeed = 0.2;
+ public static final int kLeftElevatorEncoderID1 = 0;
+ public static final int kLeftElevatorEncoderID2 = 1;
+ public static final int kRightElevatorEncoderID1 = 2;
+ public static final int kRightElevatorEncoderID2 = 3;
+ public static final int kElevatorEncoderBottomValue = 0;
+ public static final int kElevatorEncoderTopValue = 1000;
+
+ public static class ElevatorPreset {
+ // PLACEHOLDER VALUES!!!
+ public static final double level1EncoderValue = 0.5;
+ public static final double level2EncoderValue = 1.0;
+ public static final double level3EncoderValue = 1.5;
+ public static final double level4EncoderValue = 2.0;
+ }
+ }
+
+ public static final class AlgaeArmConstants {
+ public static final int algaeArmBarMotorID = 8;// placeholder
+ }
+
+ public static class CoralArmConstants {
+ public static final int coralArmMotorID = 69;// placeholder with funny number hehe
+ public static final int kCoralEncoderID1 = 4;
+ public static final int kCoralEncoderID2 = 5;
+ public static final int kCoralEncoderTopValue = 1000;
+ public static final int kCoralEncoderTopBuffer = kCoralEncoderTopValue + 10;
+ public static final int kCoralEncoderBottomValue = 0;
+ public static final int kCoralEncoderBottomBuffer = kCoralEncoderBottomValue - 10;
+ }
+
+ public static class ClimberConstants {
+ public static final int kLeftClimberMotorID = 25; // TEMP
+ public static final int kRightClimberMotorID = 26; // TEMP
+ public static final int kClimberLimitSwitchID = 6; // TEMP
+ }
+
+ public static class DriveTrainConstants {
+ public static final double MaxAngularRate = RotationsPerSecond.of(0.75).in(RadiansPerSecond);
+ public static final double MaxSpeed = TunerConstants.kSpeedAt12Volts.in(MetersPerSecond);
+ public static final double gearRatio = 4.59375;
+ public static final double lengthBetweenSwerveModules = 22.5;
+ public static final double lengthOfBumpers = 25.0; // placeholder
+
+ // Motor and encoder ids (ALL ARE PLACEHOLDERS. FIND ACTUAL IDS IN
+ // COMMANDSWERVEDRIVETRAIN.JAVA)
+ public static final int FLDriveMotorID = 0;
+ public static final int FLTurnMotorID = 1;
+ // You can finish this out Scott! :D
+
+ // Front Left Constants
+ public static final int kFrontLeftDriveMotorId = 42;
+ public static final int kFrontLeftSteerMotorId = 1;
+ public static final int kFrontLeftEncoderId = 0;
+ public static final Angle kFrontLeftEncoderOffset = Rotations.of(-0.432373046875);
+ public static final boolean kFrontLeftSteerMotorInverted = true;
+ public static final boolean kFrontLeftEncoderInverted = false;
+ public static final Distance kFrontLeftXPos = Inches.of(11.25);
+ public static final Distance kFrontLeftYPos = Inches.of(11.25);
+ // Front Right Constants
+ public static final int kFrontRightDriveMotorId = 2;
+ public static final int kFrontRightSteerMotorId = 3;
+ public static final int kFrontRightEncoderId = 2;
+ public static final Angle kFrontRightEncoderOffset = Rotations.of(-0.282958984375);
+ public static final boolean kFrontRightSteerMotorInverted = true;
+ public static final boolean kFrontRightEncoderInverted = false;
+ public static final Distance kFrontRightXPos = Inches.of(11.25);
+ public static final Distance kFrontRightYPos = Inches.of(-11.25);
+ // Back Left Constants
+ public static final int kBackLeftDriveMotorId = 6;
+ public static final int kBackLeftSteerMotorId = 7;
+ public static final int kBackLeftEncoderId = 6;
+ public static final Angle kBackLeftEncoderOffset = Rotations.of(-0.09326171875);
+ public static final boolean kBackLeftSteerMotorInverted = true;
+ public static final boolean kBackLeftEncoderInverted = false;
+ public static final Distance kBackLeftXPos = Inches.of(-11.25);
+ public static final Distance kBackLeftYPos = Inches.of(11.25);
+ // Back Right Constants
+ public static final int kBackRightDriveMotorId = 4;
+ public static final int kBackRightSteerMotorId = 0;
+ public static final int kBackRightEncoderId = 4;
+ public static final Angle kBackRightEncoderOffset = Rotations.of(-0.111328125);
+ public static final boolean kBackRightSteerMotorInverted = true;
+ public static final boolean kBackRightEncoderInverted = false;
+ public static final Distance kBackRightXPos = Inches.of(-11.25);
+ public static final Distance kBackRightYPos = Inches.of(-11.25);
+ }
+}
diff --git a/2024-2025/main-bot/src/main/java/frc/robot/LimelightHelpers.java b/2024-2025/main-bot/src/main/java/frc/robot/LimelightHelpers.java
new file mode 100644
index 0000000..ddafedd
--- /dev/null
+++ b/2024-2025/main-bot/src/main/java/frc/robot/LimelightHelpers.java
@@ -0,0 +1,1647 @@
+//LimelightHelpers v1.11 (REQUIRES LLOS 2025.0 OR LATER)
+
+package frc.robot;
+
+import edu.wpi.first.networktables.DoubleArrayEntry;
+import edu.wpi.first.networktables.NetworkTable;
+import edu.wpi.first.networktables.NetworkTableEntry;
+import edu.wpi.first.networktables.NetworkTableInstance;
+import edu.wpi.first.networktables.TimestampedDoubleArray;
+import frc.robot.LimelightHelpers.LimelightResults;
+import frc.robot.LimelightHelpers.PoseEstimate;
+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.Translation3d;
+import edu.wpi.first.math.util.Units;
+import edu.wpi.first.math.geometry.Rotation3d;
+import edu.wpi.first.math.geometry.Translation2d;
+
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Map;
+import java.util.concurrent.CompletableFuture;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonFormat.Shape;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * LimelightHelpers provides static methods and classes for interfacing with Limelight vision cameras in FRC.
+ * This library supports all Limelight features including AprilTag tracking, Neural Networks, and standard color/retroreflective tracking.
+ */
+public class LimelightHelpers {
+
+ private static final Map If you change your main robot class, change the parameter type.
+ * Man it sure is nice to add secret comments for others to find as easter eggs :O
+ */
+ public static void main(String[] args) {
+ RobotBase.startRobot(Robot::new);
+ }
+}
diff --git a/2024-2025/main-bot/src/main/java/frc/robot/Robot.java b/2024-2025/main-bot/src/main/java/frc/robot/Robot.java
new file mode 100644
index 0000000..9a5e699
--- /dev/null
+++ b/2024-2025/main-bot/src/main/java/frc/robot/Robot.java
@@ -0,0 +1,143 @@
+// PROGRAMMING TO DOS!
+
+// Basic TO DOs
+// Set up Elevator simulation or Algae arm simulation in test bed // Status: Failed
+
+// Advanced TO DOs
+//NONE
+
+// To-Dos: Once the elevator is attached
+// Move elevator and update encoder preset values in Constants.java // Status: Not Started
+// Check which motors need to be reversed// Status: Not Started
+// Investigate Motion Magic // Status: Not Started
+
+// 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 org.ironmaple.simulation.SimulatedArena;
+import org.ironmaple.simulation.seasonspecific.reefscape2025.ReefscapeAlgaeOnField;
+
+import com.ctre.phoenix6.SignalLogger;
+
+import edu.wpi.first.wpilibj.TimedRobot;
+
+import edu.wpi.first.wpilibj2.command.Command;
+
+import edu.wpi.first.wpilibj2.command.CommandScheduler;
+
+/**
+ * The methods in this class are called automatically corresponding to each
+ * mode, as described in the TimedRobot documentation. If you change the name of
+ * this class or the package after creating this project, you must also update
+ * the Main.java file in the project.
+ */
+public class Robot extends TimedRobot {
+
+ private Command m_autonomousCommand;
+
+ private final RobotContainer m_robotContainer;
+
+ /**
+ * This function is run when the robot is first started up and should be used
+ * for any initialization code.
+ */
+ public Robot() {// instantiate robot container
+
+ m_robotContainer = new RobotContainer();
+
+ }
+
+ /**
+ * This function is called every 20 ms, no matter the mode. Use this for items
+ * like diagnostics that you want ran during disabled, autonomous, teleoperated
+ * and test.
+ *
+ *
+ * This runs after the mode specific periodic functions, but before LiveWindow
+ * and SmartDashboard integrated updating.
+ */
+ @Override
+ public void robotPeriodic() {
+ // Runs the Scheduler. This is responsible for polling buttons, adding
+ // newly-scheduled
+ // commands, running already-scheduled commands, removing finished or
+ // interrupted commands,
+ // and running subsystem periodic() methods. This must be called from the
+ // robot's periodic
+ // block in order for anything in the Command-based framework to work.
+ CommandScheduler.getInstance().run();
+ }
+
+ /** This function is called once each time the robot enters Disabled mode. */
+ @Override
+ public void disabledInit() {
+ SignalLogger.stop();
+ }
+
+ @Override
+ public void disabledPeriodic() {
+ }
+
+ /**
+ * This autonomous runs the autonomous command selected by your
+ * {@link RobotContainer} class.
+ */
+ @Override
+ public void autonomousInit() {
+ m_autonomousCommand = m_robotContainer.getAutonomousCommand();
+
+ // schedule the autonomous command (example)
+ if (m_autonomousCommand != null) {
+ m_autonomousCommand.schedule();
+ }
+ }
+
+ /** This function is called periodically during autonomous. */
+ @Override
+ public void autonomousPeriodic() {
+ }
+
+ @Override
+ public void teleopInit() {
+ // This makes sure that the autonomous stops running when
+ // teleop starts running. If you want the autonomous to
+ // continue until interrupted by another command, remove
+ // this line or comment it out.
+ if (m_autonomousCommand != null) {
+ m_autonomousCommand.cancel();
+ }
+ SignalLogger.setPath("C:\\Users\\teams\\Desktop\\2025HootLogs");
+ SignalLogger.start();
+ }
+
+ /** This function is called periodically during operator control. */
+ @Override
+ public void teleopPeriodic() {
+ }
+
+ @Override
+ public void testInit() {
+ // Cancels all running commands at the start of test mode.
+ CommandScheduler.getInstance().cancelAll();
+ }
+
+ /** This function is called periodically during test mode. */
+ @Override
+ public void testPeriodic() {
+ }
+
+ /** This function is called once when the robot is first started up. */
+ @Override
+ public void simulationInit() {
+ SimulatedArena.getInstance();
+ }
+
+ /** This function is called periodically whilst in simulation. */
+ @Override
+ public void simulationPeriodic() {
+ SimulatedArena.getInstance().simulationPeriodic();
+ }
+}
\ No newline at end of file
diff --git a/2024-2025/main-bot/src/main/java/frc/robot/RobotContainer.java b/2024-2025/main-bot/src/main/java/frc/robot/RobotContainer.java
new file mode 100644
index 0000000..24858fa
--- /dev/null
+++ b/2024-2025/main-bot/src/main/java/frc/robot/RobotContainer.java
@@ -0,0 +1,366 @@
+// 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.
+
+/*
+ * This Is The Input List. Whenever Adding A New Input, Make Sure To Add It To The List Below
+ *
+ * Driver Controller:
+ * A - Brake
+ * B - Point
+ * Dpad Center - climber
+ * Back + Y - SysId Dynamic Forward
+ * Back + X - SysId Dynamic Reverse
+ * Start + Y - SysId Quasistatic Forward
+ * Start + X - SysId Quasistatic Reverse
+ * Left Joystick - Move (Field Orientated)
+ * Right Joystick - Turn
+ * LB - Reset Field Centric Seed
+ * RT - Align with Apriltag
+ *
+ * Auxiliary Controller:
+ * A - Level 1 Elevator + Coral Arm
+ * B - Level 2 Elevator + Coral Arm
+ * Y - Level 3 Elevator + Coral Arm
+ * X - Level 4 Elevator + Coral Arm
+ * Left Joystick up - Move Elevator up
+ * Left Joystick down - Move Elevator down
+ * LB - Coral Arm Up
+ * RB - Coral Arm Down
+ * DPad Center - Coral Arm Stop
+ * LT - Algae intake
+ * RT - Algae outtake
+ *
+ */
+
+package frc.robot;
+
+import static edu.wpi.first.units.Units.*;
+
+import com.ctre.phoenix6.swerve.SwerveModule.DriveRequestType;
+import com.pathplanner.lib.auto.AutoBuilder;
+import com.pathplanner.lib.auto.NamedCommands;
+import com.pathplanner.lib.commands.PathPlannerAuto;
+import com.ctre.phoenix6.swerve.SwerveRequest;
+import java.lang.Math;
+import frc.robot.Constants.OperatorConstants;
+import frc.robot.generated.TunerConstants;
+import frc.robot.subsystems.ElevatorSubsystem;
+import frc.robot.subsystems.LimeLightSubsystem;
+import frc.robot.subsystems.MapleSimSubsystem;
+import frc.robot.subsystems.CoralArmSubsystem.CoralArmLevels;
+import frc.robot.subsystems.ElevatorSubsystem.ElevatorPresets;
+import frc.robot.subsystems.AlgaeArmSubsystem;
+import frc.robot.subsystems.ClimberSubsystem;
+import frc.robot.subsystems.CommandSwerveDrivetrain;
+import frc.robot.subsystems.CoralArmSubsystem;
+import edu.wpi.first.wpilibj2.command.Command;
+import edu.wpi.first.wpilibj2.command.Commands;
+import edu.wpi.first.wpilibj2.command.InstantCommand;
+import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
+import edu.wpi.first.wpilibj2.command.button.Trigger;
+import edu.wpi.first.math.geometry.Rotation2d;
+import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
+import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
+import edu.wpi.first.wpilibj2.command.RunCommand;
+import edu.wpi.first.wpilibj2.command.sysid.SysIdRoutine.Direction;
+import edu.wpi.first.wpilibj.DigitalInput;
+import frc.robot.subsystems.ElevatorSubsystem.ElevatorPresets;
+
+/**
+ * little secret comment OwO This class is where the bulk of the robot should be
+ * declared. Since Command-based is a "declarative" paradigm, very little robot
+ * logic should actually be handled in the {@link Robot} periodic methods (other
+ * than the scheduler calls). Instead, the structure of the robot (including
+ * subsystems, commands, and trigger mappings) should be declared here.
+ */
+public class RobotContainer {
+ // The robot's subsystems and commands are defined here...ElevatorConstants
+ private final ElevatorSubsystem m_ElevatorSubsystem = new ElevatorSubsystem();
+ private final AlgaeArmSubsystem m_AlgaeArmSubsystem = new AlgaeArmSubsystem();
+ private final CoralArmSubsystem m_CoralArmSubsystem = new CoralArmSubsystem();
+ private final ClimberSubsystem m_ClimberSubsystem = new ClimberSubsystem();
+
+ // Controllers
+ private final CommandXboxController m_driverController = new CommandXboxController(
+ OperatorConstants.kDriverControllerPort);
+ private final CommandXboxController m_auxillaryController = new CommandXboxController(
+ Constants.OperatorConstants.kAuxiliaryControllerPort);
+
+ private final SendableChooser
+ * Current methods include:
+ *
+ // * If the value is less than the minimum, the minimum is returned.
+ // * If the value is greater than the maximum, the maximum is returned.
+ // * If the value is between the minimum and maximum, the value is returned.
+ // *
+ * This constructs the underlying hardware devices, so users should not
+ * construct the devices themselves. If they need the devices, they can access
+ * them through getters in the classes.
+ *
+ * @param drivetrainConstants Drivetrain-wide constants for the swerve drive
+ * @param modules Constants for each specific module
+ */
+ public TunerSwerveDrivetrain(SwerveDrivetrainConstants drivetrainConstants,
+ SwerveModuleConstants, ?, ?>... modules) {
+ super(TalonFX::new, TalonFX::new, CANcoder::new, drivetrainConstants, modules);
+ }
+
+ /**
+ * Constructs a CTRE SwerveDrivetrain using the specified constants.
+ *
+ * This constructs the underlying hardware devices, so users should not
+ * construct the devices themselves. If they need the devices, they can access
+ * them through getters in the classes.
+ *
+ * @param drivetrainConstants Drivetrain-wide constants for the swerve drive
+ * @param odometryUpdateFrequency The frequency to run the odometry loop. If
+ * unspecified or set to 0 Hz, this is 250 Hz on
+ * CAN FD, and 100 Hz on CAN 2.0.
+ * @param modules Constants for each specific module
+ */
+ public TunerSwerveDrivetrain(SwerveDrivetrainConstants drivetrainConstants,
+ double odometryUpdateFrequency, SwerveModuleConstants, ?, ?>... modules) {
+ super(TalonFX::new, TalonFX::new, CANcoder::new, drivetrainConstants, odometryUpdateFrequency,
+ modules);
+ }
+
+ /**
+ * Constructs a CTRE SwerveDrivetrain using the specified constants.
+ *
+ * This constructs the underlying hardware devices, so users should not
+ * construct the devices themselves. If they need the devices, they can access
+ * them through getters in the classes.
+ *
+ * @param drivetrainConstants Drivetrain-wide constants for the swerve
+ * drive
+ * @param odometryUpdateFrequency The frequency to run the odometry loop. If
+ * unspecified or set to 0 Hz, this is 250 Hz
+ * on CAN FD, and 100 Hz on CAN 2.0.
+ * @param odometryStandardDeviation The standard deviation for odometry
+ * calculation in the form [x, y, theta]ᵀ, with
+ * units in meters and radians
+ * @param visionStandardDeviation The standard deviation for vision
+ * calculation in the form [x, y, theta]ᵀ, with
+ * units in meters and radians
+ * @param modules Constants for each specific module
+ */
+ public TunerSwerveDrivetrain(SwerveDrivetrainConstants drivetrainConstants,
+ double odometryUpdateFrequency, Matrix
+ * This constructs the underlying hardware devices, so users should not
+ * construct the devices themselves. If they need the devices, they can access
+ * them through getters in the classes.
+ *
+ * @param drivetrainConstants Drivetrain-wide constants for the swerve drive
+ * @param modules Constants for each specific module
+ */
+ public CommandSwerveDrivetrain(SwerveDrivetrainConstants drivetrainConstants,
+ SwerveModuleConstants, ?, ?>... modules) {
+ super(drivetrainConstants, modules);
+ if (Utils.isSimulation()) {
+ startSimThread();
+ }
+ configureAutoBuilder();
+ }
+
+ /**
+ * Constructs a CTRE SwerveDrivetrain using the specified constants.
+ *
+ * This constructs the underlying hardware devices, so users should not
+ * construct the devices themselves. If they need the devices, they can access
+ * them through getters in the classes.
+ *
+ * @param drivetrainConstants Drivetrain-wide constants for the swerve drive
+ * @param odometryUpdateFrequency The frequency to run the odometry loop. If
+ * unspecified or set to 0 Hz, this is 250 Hz on
+ * CAN FD, and 100 Hz on CAN 2.0.
+ * @param modules Constants for each specific module
+ */
+ public CommandSwerveDrivetrain(SwerveDrivetrainConstants drivetrainConstants, double odometryUpdateFrequency,
+ SwerveModuleConstants, ?, ?>... modules) {
+ super(drivetrainConstants, odometryUpdateFrequency, modules);
+ if (Utils.isSimulation()) {
+ startSimThread();
+ }
+ configureAutoBuilder();
+ }
+
+ /**
+ * Constructs a CTRE SwerveDrivetrain using the specified constants.
+ *
+ * This constructs the underlying hardware devices, so users should not
+ * construct the devices themselves. If they need the devices, they can access
+ * them through getters in the classes.
+ *
+ * @param drivetrainConstants Drivetrain-wide constants for the swerve
+ * drive
+ * @param odometryUpdateFrequency The frequency to run the odometry loop. If
+ * unspecified or set to 0 Hz, this is 250 Hz
+ * on CAN FD, and 100 Hz on CAN 2.0.
+ * @param odometryStandardDeviation The standard deviation for odometry
+ * calculation in the form [x, y, theta]ᵀ, with
+ * units in meters and radians
+ * @param visionStandardDeviation The standard deviation for vision
+ * calculation in the form [x, y, theta]ᵀ, with
+ * units in meters and radians
+ * @param modules Constants for each specific module
+ */
+ public CommandSwerveDrivetrain(SwerveDrivetrainConstants drivetrainConstants, double odometryUpdateFrequency,
+ Matrix
+ * Note that the vision measurement standard deviations passed into this method
+ * will continue to apply to future measurements until a subsequent call to
+ * {@link #setVisionMeasurementStdDevs(Matrix)} or this method.
+ *
+ * @param visionRobotPoseMeters The pose of the robot as measured by the
+ * vision camera.
+ * @param timestampSeconds The timestamp of the vision measurement in
+ * seconds.
+ * @param visionMeasurementStdDevs Standard deviations of the vision pose
+ * measurement in the form [x, y, theta]ᵀ, with
+ * units in meters and radians.
+ */
+ @Override
+ public void addVisionMeasurement(Pose2d visionRobotPoseMeters, double timestampSeconds,
+ Matrix
+ *
+ * Additional methods may be added in the future if and when they are needed.
+ *