diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 28a230a..0000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -name: Bug report -about: Create a bug report for something -title: "[Bug]: Describe the bug here" -labels: bug -assignees: '' - ---- - -**Describe the bug** -Describe what the issue is and any steps you may have tried to fix it (Like making sure you are using the right version, etc.) - -Please make sure to include the application that is failing or not working correctly like if it's a problem in Driver Station or if it's an issue with the code itself not doing what you would expect or not building (If using Java / C++. This would also be included in the Versions sections) - -**Steps To Reproduce** -Steps to reproduce the behavior: -1. Go to '...' -2. Click on '...' -3. Scroll down to '...' -4. See error - -**Expected Behavior** -What should have happened? - -**Screenshots or Videos** -If applicable, add screenshots and / or videos to help explain your problem - -**Versions (if applicable):** -> If using Python, please list off what version of robotpy you are using along with the version of Python - -- OS: [e.g. Arch Linux] -- Version [e.g. 6.4.12] -- Architecture [e.g x86_64] -- Java, C++ or Python Version [e.g. Python 3.11, Java 20.0.2] -- WPILib Version [e.g. 2023.4.3] - -**Additional context** -Add any other context about the problem down here. diff --git a/.github/linters/actionlint.yml b/.github/linters/actionlint.yml deleted file mode 100644 index fab3ac3..0000000 --- a/.github/linters/actionlint.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -self-hosted-runner: - labels: - - Primary - - Backup \ No newline at end of file diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml new file mode 100644 index 0000000..b25a586 --- /dev/null +++ b/.github/workflows/gradle.yml @@ -0,0 +1,56 @@ +# Gradle workflow to build the current project and generate a dependency graph for Dependabot Alerts. + +name: Gradle Dependencies and Build + +on: + push: + branches: [ "repo-rework" ] # Change to "main" when merged + pull_request: + branches: [ "repo-rework" ] # 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 + 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/linter.yml b/.github/workflows/linter.yml new file mode 100644 index 0000000..c577fe9 --- /dev/null +++ b/.github/workflows/linter.yml @@ -0,0 +1,37 @@ +# Workflow to lint and format code using super-linter +# +# https://github.com/github/super-linter +--- +name: Linting and Formatting + +on: + push: + branches: ["repo-rework"] # Change to "main" when merged + pull_request: + branches: ["repo-rework"] # Change to "main" when merged + +jobs: + super-linter: + + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - uses: actions/checkout@v4 + with: + # Full git history is needed to get a proper list of changed files within + # `super-linter` + fetch-depth: 0 + + - name: Lint Code Base + uses: github/super-linter@v4 + # Update the environment here + env: + # Update to false whenever all previous files have been linted successfully so we + # aren't checking the whole codebase each time + VALIDATE_ALL_CODEBASE: true + # Add files or folders to exclude here + FILTER_REGEX_EXCLUDE: ".*vendordeps/.*|.*gradlew|.*.gradle|.*WPILib-License.md.*" + DEFAULT_BRANCH: "main" + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 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..ceb43c0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,156 +1,195 @@ -# .gitignore -# Ingore File For Git - -# -----=====[ IDEs ]=====----- # - -# VSCode -.vscode/ - -# Sublime Text -.sublime-workspace -.sublime-project - -# PyCharm -.idea/ -*.iml -*.ipr -*.iws - -# -----=====[ Python ]=====----- # - -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -pip-wheel-metadata/ -share/python-wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.nox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -*.py,cover -.hypothesis/ -.pytest_cache/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -local_settings.py -db.sqlite3 -db.sqlite3-journal - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# IPython -profile_default/ -ipython_config.py - -# pyenv -.python-version - -# pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. -# However, in case of collaboration, if having platform-specific dependencies or dependencies -# having no cross-platform support, pipenv may install dependencies that don't work, or not -# install all needed dependencies. -#Pipfile.lock - -# PEP 582; used by e.g. github.com/David-OConnor/pyflow -__pypackages__/ - -# Celery stuff -celerybeat-schedule -celerybeat.pid - -# SageMath parsed files -*.sage.py - -# Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ -.dmypy.json -dmypy.json - -# Pyre type checker -.pyre/ - -# -----=====[ Misc ]=====----- # - -# MacOS Finder Cache -# >:( -*.DS_Store - +# This gitignore has been specially created by the WPILib team. +# If you remove items from this file, intellisense might break. + +### C++ ### +# Prerequisites +*.d + +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app + +### 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* + +### Linux ### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### VisualStudioCode ### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +### Gradle ### +.gradle +/build/ + +# Ignore Gradle GUI config +gradle-app.setting + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar + +# Cache of project +.gradletasknamecache + +# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 +# gradle/wrapper/gradle-wrapper.properties + +# # VSCode Specific Java Settings +# DO NOT REMOVE .classpath and .project +.classpath +.project +.settings/ +bin/ + +# IntelliJ +*.iml +*.ipr +*.iws +.idea/ +out/ + +# Fleet +.fleet + +# Simulation GUI and other tools window save file +networktables.json +simgui.json +*-window.json + +# Simulation data log directory +logs/ + +# Folder that has CTRE Phoenix Sim device config storage +ctre_sim/ + +# clangd +/.cache +compile_commands.json + +# VSCode settings +.vscode/ + +# MacOS specific files +.DS_Store + +# Windows specific files +Thumbs.db +Desktop.ini +System Volume Information/ \ No newline at end of file diff --git a/2022-2023/main-bot/.wpilib/wpilib_preferences.json b/.wpilib/wpilib_preferences.json old mode 100755 new mode 100644 similarity index 77% rename from 2022-2023/main-bot/.wpilib/wpilib_preferences.json rename to .wpilib/wpilib_preferences.json index 4062463..475f197 --- a/2022-2023/main-bot/.wpilib/wpilib_preferences.json +++ b/.wpilib/wpilib_preferences.json @@ -1,6 +1,6 @@ { "enableCppIntellisense": false, "currentLanguage": "java", - "projectYear": "2023", + "projectYear": "2025", "teamNumber": 5098 } \ 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 5a04837..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 c8ee3ba..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 2d75895..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/dependencies-accessors/gc.properties b/2022-2023/main-bot/.gradle/7.5.1/dependencies-accessors/gc.properties deleted file mode 100755 index e69de29..0000000 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/7.5.1/gc.properties b/2022-2023/main-bot/.gradle/7.5.1/gc.properties deleted file mode 100755 index e69de29..0000000 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/cache.properties b/2022-2023/main-bot/.gradle/buildOutputCleanup/cache.properties deleted file mode 100755 index 7fdc208..0000000 --- a/2022-2023/main-bot/.gradle/buildOutputCleanup/cache.properties +++ /dev/null @@ -1,2 +0,0 @@ -#Thu Jan 26 17:19:17 CST 2023 -gradle.version=7.5.1 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/.gradle/file-system.probe b/2022-2023/main-bot/.gradle/file-system.probe deleted file mode 100755 index 6c82972..0000000 Binary files a/2022-2023/main-bot/.gradle/file-system.probe and /dev/null differ diff --git a/2022-2023/main-bot/.gradle/vcs-1/gc.properties b/2022-2023/main-bot/.gradle/vcs-1/gc.properties deleted file mode 100755 index e69de29..0000000 diff --git a/2022-2023/main-bot/WPILib-License.md b/2022-2023/main-bot/WPILib-License.md deleted file mode 100755 index f6cdf0d..0000000 --- a/2022-2023/main-bot/WPILib-License.md +++ /dev/null @@ -1,24 +0,0 @@ -Copyright (c) 2009-2021 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/2022-2023/main-bot/bin/main/frc/.clang-format b/2022-2023/main-bot/bin/main/frc/.clang-format deleted file mode 100755 index bdb418e..0000000 --- a/2022-2023/main-bot/bin/main/frc/.clang-format +++ /dev/null @@ -1,6 +0,0 @@ -Language: Java -BasedOnStyle: Microsoft - -AlignConsecutiveAssignments: Consecutive -AlignConsecutiveDeclarations: Consecutive -ColumnLimit: 0 \ No newline at end of file diff --git a/2022-2023/main-bot/bin/main/frc/CommonData.class b/2022-2023/main-bot/bin/main/frc/CommonData.class deleted file mode 100644 index e49417b..0000000 Binary files a/2022-2023/main-bot/bin/main/frc/CommonData.class and /dev/null differ diff --git a/2022-2023/main-bot/bin/main/frc/components/Arm$Position.class b/2022-2023/main-bot/bin/main/frc/components/Arm$Position.class deleted file mode 100644 index c17c3f1..0000000 Binary files a/2022-2023/main-bot/bin/main/frc/components/Arm$Position.class and /dev/null differ diff --git a/2022-2023/main-bot/bin/main/frc/components/Arm.class b/2022-2023/main-bot/bin/main/frc/components/Arm.class deleted file mode 100644 index abfe5a9..0000000 Binary files a/2022-2023/main-bot/bin/main/frc/components/Arm.class and /dev/null differ diff --git a/2022-2023/main-bot/bin/main/frc/components/Claw$State.class b/2022-2023/main-bot/bin/main/frc/components/Claw$State.class deleted file mode 100644 index b9b889a..0000000 Binary files a/2022-2023/main-bot/bin/main/frc/components/Claw$State.class and /dev/null differ diff --git a/2022-2023/main-bot/bin/main/frc/components/Claw.class b/2022-2023/main-bot/bin/main/frc/components/Claw.class deleted file mode 100644 index ca879a2..0000000 Binary files a/2022-2023/main-bot/bin/main/frc/components/Claw.class and /dev/null differ diff --git a/2022-2023/main-bot/bin/main/frc/components/IComponent.class b/2022-2023/main-bot/bin/main/frc/components/IComponent.class deleted file mode 100644 index ef13c9f..0000000 Binary files a/2022-2023/main-bot/bin/main/frc/components/IComponent.class and /dev/null differ diff --git a/2022-2023/main-bot/bin/main/frc/components/README.md b/2022-2023/main-bot/bin/main/frc/components/README.md deleted file mode 100755 index 6e1e7ce..0000000 --- a/2022-2023/main-bot/bin/main/frc/components/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# Structure of components - -Each component should implement an `update` function, as specified in -`IComponent`. What each component does in its `update` depends on that -component. For instance, a controller component may fetch all the data -it needs and fill out relevant sections of a common `data` object. A -drive component may fetch the values from the common `data` object and -drive accordingly. \ No newline at end of file diff --git a/2022-2023/main-bot/bin/main/frc/components/SwerveDrive.class b/2022-2023/main-bot/bin/main/frc/components/SwerveDrive.class deleted file mode 100644 index b0bfedf..0000000 Binary files a/2022-2023/main-bot/bin/main/frc/components/SwerveDrive.class and /dev/null differ diff --git a/2022-2023/main-bot/bin/main/frc/components/SwerveWheel.class b/2022-2023/main-bot/bin/main/frc/components/SwerveWheel.class deleted file mode 100644 index 4544e2c..0000000 Binary files a/2022-2023/main-bot/bin/main/frc/components/SwerveWheel.class and /dev/null differ diff --git a/2022-2023/main-bot/bin/main/frc/components/autonomous/ArmState1.class b/2022-2023/main-bot/bin/main/frc/components/autonomous/ArmState1.class deleted file mode 100644 index 468c9a2..0000000 Binary files a/2022-2023/main-bot/bin/main/frc/components/autonomous/ArmState1.class and /dev/null differ diff --git a/2022-2023/main-bot/bin/main/frc/components/autonomous/ArmState2.class b/2022-2023/main-bot/bin/main/frc/components/autonomous/ArmState2.class deleted file mode 100644 index e6354b7..0000000 Binary files a/2022-2023/main-bot/bin/main/frc/components/autonomous/ArmState2.class and /dev/null differ diff --git a/2022-2023/main-bot/bin/main/frc/components/autonomous/ArmState3.class b/2022-2023/main-bot/bin/main/frc/components/autonomous/ArmState3.class deleted file mode 100644 index f5d0bb2..0000000 Binary files a/2022-2023/main-bot/bin/main/frc/components/autonomous/ArmState3.class and /dev/null differ diff --git a/2022-2023/main-bot/bin/main/frc/components/autonomous/Autonomous.class b/2022-2023/main-bot/bin/main/frc/components/autonomous/Autonomous.class deleted file mode 100644 index 73b5883..0000000 Binary files a/2022-2023/main-bot/bin/main/frc/components/autonomous/Autonomous.class and /dev/null differ diff --git a/2022-2023/main-bot/bin/main/frc/components/autonomous/DriveState1.class b/2022-2023/main-bot/bin/main/frc/components/autonomous/DriveState1.class deleted file mode 100644 index 08a086c..0000000 Binary files a/2022-2023/main-bot/bin/main/frc/components/autonomous/DriveState1.class and /dev/null 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 deleted file mode 100644 index 08983c3..0000000 Binary files a/2022-2023/main-bot/bin/main/frc/components/autonomous/DriveState2.class and /dev/null 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 deleted file mode 100644 index 4ebecb7..0000000 Binary files a/2022-2023/main-bot/bin/main/frc/components/autonomous/DriveState3.class and /dev/null differ diff --git a/2022-2023/main-bot/bin/main/frc/components/autonomous/DriveState4.class b/2022-2023/main-bot/bin/main/frc/components/autonomous/DriveState4.class deleted file mode 100644 index c6a2f0d..0000000 Binary files a/2022-2023/main-bot/bin/main/frc/components/autonomous/DriveState4.class and /dev/null differ diff --git a/2022-2023/main-bot/bin/main/frc/components/autonomous/DriveState5.class b/2022-2023/main-bot/bin/main/frc/components/autonomous/DriveState5.class deleted file mode 100644 index b62e3b2..0000000 Binary files a/2022-2023/main-bot/bin/main/frc/components/autonomous/DriveState5.class and /dev/null differ diff --git a/2022-2023/main-bot/bin/main/frc/components/autonomous/DriveState6.class b/2022-2023/main-bot/bin/main/frc/components/autonomous/DriveState6.class deleted file mode 100644 index 044a2c4..0000000 Binary files a/2022-2023/main-bot/bin/main/frc/components/autonomous/DriveState6.class and /dev/null differ diff --git a/2022-2023/main-bot/bin/main/frc/controllers/LogitechF310.class b/2022-2023/main-bot/bin/main/frc/controllers/LogitechF310.class deleted file mode 100644 index 2be01dd..0000000 Binary files a/2022-2023/main-bot/bin/main/frc/controllers/LogitechF310.class and /dev/null differ diff --git a/2022-2023/main-bot/bin/main/frc/controllers/Xbox360$dPad.class b/2022-2023/main-bot/bin/main/frc/controllers/Xbox360$dPad.class deleted file mode 100644 index d3ab43e..0000000 Binary files a/2022-2023/main-bot/bin/main/frc/controllers/Xbox360$dPad.class and /dev/null differ diff --git a/2022-2023/main-bot/bin/main/frc/controllers/Xbox360.class b/2022-2023/main-bot/bin/main/frc/controllers/Xbox360.class deleted file mode 100644 index 2ba9c9d..0000000 Binary files a/2022-2023/main-bot/bin/main/frc/controllers/Xbox360.class and /dev/null differ diff --git a/2022-2023/main-bot/bin/main/frc/controllers/XboxOne$dPad.class b/2022-2023/main-bot/bin/main/frc/controllers/XboxOne$dPad.class deleted file mode 100644 index ff0d64b..0000000 Binary files a/2022-2023/main-bot/bin/main/frc/controllers/XboxOne$dPad.class and /dev/null differ diff --git a/2022-2023/main-bot/bin/main/frc/controllers/XboxOne.class b/2022-2023/main-bot/bin/main/frc/controllers/XboxOne.class deleted file mode 100644 index ccbb110..0000000 Binary files a/2022-2023/main-bot/bin/main/frc/controllers/XboxOne.class and /dev/null differ diff --git a/2022-2023/main-bot/bin/main/frc/robot/Main.class b/2022-2023/main-bot/bin/main/frc/robot/Main.class deleted file mode 100644 index 54aaf77..0000000 Binary files a/2022-2023/main-bot/bin/main/frc/robot/Main.class and /dev/null differ diff --git a/2022-2023/main-bot/bin/main/frc/robot/Robot.class b/2022-2023/main-bot/bin/main/frc/robot/Robot.class deleted file mode 100644 index 165911b..0000000 Binary files a/2022-2023/main-bot/bin/main/frc/robot/Robot.class and /dev/null 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 deleted file mode 100644 index f9d72fb..0000000 Binary files a/2022-2023/main-bot/bin/main/frc/robot/Utility.class and /dev/null differ diff --git a/2022-2023/main-bot/bin/main/frc/settings/ArmSettings.class b/2022-2023/main-bot/bin/main/frc/settings/ArmSettings.class deleted file mode 100644 index 42ce2c9..0000000 Binary files a/2022-2023/main-bot/bin/main/frc/settings/ArmSettings.class and /dev/null differ diff --git a/2022-2023/main-bot/bin/main/frc/settings/ClawSettings.class b/2022-2023/main-bot/bin/main/frc/settings/ClawSettings.class deleted file mode 100644 index 54ece2c..0000000 Binary files a/2022-2023/main-bot/bin/main/frc/settings/ClawSettings.class and /dev/null differ diff --git a/2022-2023/main-bot/bin/main/frc/settings/LimitedMotorSettings.class b/2022-2023/main-bot/bin/main/frc/settings/LimitedMotorSettings.class deleted file mode 100644 index 9246187..0000000 Binary files a/2022-2023/main-bot/bin/main/frc/settings/LimitedMotorSettings.class and /dev/null differ diff --git a/2022-2023/main-bot/bin/main/frc/settings/Settings.class b/2022-2023/main-bot/bin/main/frc/settings/Settings.class deleted file mode 100644 index 6fda243..0000000 Binary files a/2022-2023/main-bot/bin/main/frc/settings/Settings.class and /dev/null differ diff --git a/2022-2023/main-bot/bin/main/frc/settings/SwerveDriveSettings.class b/2022-2023/main-bot/bin/main/frc/settings/SwerveDriveSettings.class deleted file mode 100644 index cab29a8..0000000 Binary files a/2022-2023/main-bot/bin/main/frc/settings/SwerveDriveSettings.class and /dev/null differ diff --git a/2022-2023/main-bot/bin/main/frc/settings/SwerveWheelSettings$Location.class b/2022-2023/main-bot/bin/main/frc/settings/SwerveWheelSettings$Location.class deleted file mode 100644 index 3fba39b..0000000 Binary files a/2022-2023/main-bot/bin/main/frc/settings/SwerveWheelSettings$Location.class and /dev/null differ diff --git a/2022-2023/main-bot/bin/main/frc/settings/SwerveWheelSettings.class b/2022-2023/main-bot/bin/main/frc/settings/SwerveWheelSettings.class deleted file mode 100644 index 031ebc5..0000000 Binary files a/2022-2023/main-bot/bin/main/frc/settings/SwerveWheelSettings.class and /dev/null differ diff --git a/2022-2023/main-bot/bin/main/frc/settings/WristSettings.class b/2022-2023/main-bot/bin/main/frc/settings/WristSettings.class deleted file mode 100644 index 068c37a..0000000 Binary files a/2022-2023/main-bot/bin/main/frc/settings/WristSettings.class and /dev/null differ diff --git a/2022-2023/main-bot/bin/main/frc/state_machine/State.class b/2022-2023/main-bot/bin/main/frc/state_machine/State.class deleted file mode 100644 index dfee2a5..0000000 Binary files a/2022-2023/main-bot/bin/main/frc/state_machine/State.class and /dev/null differ diff --git a/2022-2023/main-bot/bin/main/frc/state_machine/StateMachine.class b/2022-2023/main-bot/bin/main/frc/state_machine/StateMachine.class deleted file mode 100644 index e734538..0000000 Binary files a/2022-2023/main-bot/bin/main/frc/state_machine/StateMachine.class and /dev/null differ diff --git a/2022-2023/main-bot/build.gradle b/2022-2023/main-bot/build.gradle deleted file mode 100755 index e1a67b8..0000000 --- a/2022-2023/main-bot/build.gradle +++ /dev/null @@ -1,105 +0,0 @@ -plugins { - id "java" - id "edu.wpi.first.GradleRIO" version "2023.4.3" -} - -sourceCompatibility = JavaVersion.VERSION_11 -targetCompatibility = JavaVersion.VERSION_11 - -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 - -repositories { - mavenCentral() -} - -// 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-api:5.8.2' - testImplementation 'org.junit.jupiter:junit-jupiter-params:5.8.2' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2' - - implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.2' -} - -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) } } - 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/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/2022-2023/main-bot/gradle/wrapper/gradle-wrapper.properties b/2022-2023/main-bot/gradle/wrapper/gradle-wrapper.properties deleted file mode 100755 index 7414769..0000000 --- a/2022-2023/main-bot/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=permwrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=permwrapper/dists diff --git a/2022-2023/main-bot/gradlew b/2022-2023/main-bot/gradlew deleted file mode 100755 index a69d9cb..0000000 --- a/2022-2023/main-bot/gradlew +++ /dev/null @@ -1,240 +0,0 @@ -#!/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/master/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 - -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" -APP_BASE_NAME=${0##*/} - -# 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"' - -# 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 - which java >/dev/null 2>&1 || 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 - -# Increase the maximum file descriptors if we can. -if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then - case $MAX_FD in #( - max*) - MAX_FD=$( ulimit -H -n ) || - warn "Could not query maximum file descriptor limit" - esac - case $MAX_FD in #( - '' | soft) :;; #( - *) - 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 - -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. - -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/2022-2023/main-bot/gradlew.bat b/2022-2023/main-bot/gradlew.bat deleted file mode 100755 index 53a6b23..0000000 --- a/2022-2023/main-bot/gradlew.bat +++ /dev/null @@ -1,91 +0,0 @@ -@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=. -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/2022-2023/main-bot/settings.gradle b/2022-2023/main-bot/settings.gradle deleted file mode 100755 index ae1af1c..0000000 --- a/2022-2023/main-bot/settings.gradle +++ /dev/null @@ -1,27 +0,0 @@ -import org.gradle.internal.os.OperatingSystem - -pluginManagement { - repositories { - mavenLocal() - gradlePluginPortal() - String frcYear = '2023' - File frcHome - if (OperatingSystem.current().isWindows()) { - String publicFolder = System.getenv('PUBLIC') - if (publicFolder == null) { - publicFolder = "C:\\Users\\Public" - } - def homeRoot = new File(publicFolder, "wpilib") - frcHome = new File(homeRoot, frcYear) - } else { - def userFolder = System.getProperty("user.home") - def homeRoot = new File(userFolder, "wpilib") - frcHome = new File(homeRoot, frcYear) - } - def frcHomeMaven = new File(frcHome, 'maven') - maven { - name 'frcHome' - url frcHomeMaven - } - } -} diff --git a/2022-2023/main-bot/src/main/deploy/robot_settings.json b/2022-2023/main-bot/src/main/deploy/robot_settings.json deleted file mode 100755 index 022b1d5..0000000 --- a/2022-2023/main-bot/src/main/deploy/robot_settings.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "controllerID": 0, - "auxControllerID": 1, - "swerveDrive": { - "FLSwerve": { - "driveID": 1, - "turnID": 2, - "encoderID": 10, - "location": "front", - "defensiveAngle": 315, - "posY": -0.238125, - "posX": 0.365125 - }, - "FRSwerve": { - "driveID": 7, - "turnID": 8, - "encoderID": 12, - "location": "front", - "defensiveAngle": 45, - "posY": 0.238125, - "posX": 0.365125 - }, - "BLSwerve": { - "driveID": 3, - "turnID": 4, - "encoderID": 11, - "location": "back", - "defensiveAngle": 45, - "posY": -0.238125, - "posX": -0.365125 - }, - "BRSwerve": { - "driveID": 5, - "turnID": 6, - "encoderID": 9, - "location": "back", - "defensiveAngle": 315, - "posY": 0.238125, - "posX": -0.365125 - } - }, - "clawSettings": { - "pneumaticsModuleId": 1, - "openingPortId": 7, - "closingPortId": 8 - }, - "armSettings": { - "shoulderMotorID": 13, - "elbowMotorID": 14 - } -} \ No newline at end of file diff --git a/2022-2023/main-bot/src/main/java/frc/.clang-format b/2022-2023/main-bot/src/main/java/frc/.clang-format deleted file mode 100755 index bdb418e..0000000 --- a/2022-2023/main-bot/src/main/java/frc/.clang-format +++ /dev/null @@ -1,6 +0,0 @@ -Language: Java -BasedOnStyle: Microsoft - -AlignConsecutiveAssignments: Consecutive -AlignConsecutiveDeclarations: Consecutive -ColumnLimit: 0 \ No newline at end of file diff --git a/2022-2023/main-bot/src/main/java/frc/CommonData.java b/2022-2023/main-bot/src/main/java/frc/CommonData.java deleted file mode 100755 index 572ccce..0000000 --- a/2022-2023/main-bot/src/main/java/frc/CommonData.java +++ /dev/null @@ -1,116 +0,0 @@ -package frc; - -import frc.components.Claw; - -/* -* 'public': This class can be accessed outside of this folder. -* 'class': This can contain variables and functionality. -* 'CommonData': The name of this class. It is treated as a TYPE. -*/ -public class CommonData { - /* - * 'public': This variable can be accessed outside this class. - * 'static': This variable is the same across the entire class; - * it is not unique to individual intances, or - * objects, of this class. - * 'Claw.State': The type of data this variable is. - * 'ClawState': The name of this variable. - */ - - // Contructor to prevent instantiation of a utility class - private CommonData() { - throw new UnsupportedOperationException( - "This is a utility class and cannot be instantiated"); - } - - public static Claw.State clawState; - /* - * This keeps track of the state of claw - * Either open or closed - */ - - public static double desiredTurn; - /* - * This is the desired turn value - * It is used in the drive class - */ - - public static double forwardSpeed; - /* - * This is the desired forward speed - * It's used to keep track of the speed - * and set the speed in the drive class - */ - - public static double sideSpeed; - /* - * Side speed of the robot - * This is used when the robot is strafing - */ - - public static boolean balance; - /* - * Set to true when the robot is balancing in autonomous - */ - - public static boolean battenDownTheHatches; - /* - * This is set to true whenever the robot is in defense mode - * All wheels are set to an 'x' pattern so the robot can't be pushed - */ - - public static boolean calibrate; - /* - * Set to true when the robot is calibrating - * Set to false otherwise - */ - - public static double shoulderPower; - /* - * This is the current power of the shoulder motor - */ - public static double elbowPower; - /* - * This is the current power of the elbow motor - */ - - public static double shoulderAngle; - /* - * The current angle of the shoulder motor - * This is in degrees - */ - public static double elbowAngle; - /* - * The current angle of the elbow motor - * This is in degrees - */ - - public static double desiredShoulderAngle; - /* - * The desired angle of the shoulder motor - * This is in degrees - */ - public static double desiredElbowAngle; - /* - * The desired angle of the elbow motor - * This is in degrees - */ - - public static double robotPitch; - /* - * Current pitch of the robot - * Gathered from the NavX - */ - public static double robotRoll; - /* - * Current roll of the robot - * Gathered from the NavX - */ - - // Autonomous Varaibles - public static int counter; - /* - * This is a counter that is used in the autonomous class - * It is used to keep track of the current state of the state machine - */ -} diff --git a/2022-2023/main-bot/src/main/java/frc/components/Arm.java b/2022-2023/main-bot/src/main/java/frc/components/Arm.java deleted file mode 100755 index c3ee00b..0000000 --- a/2022-2023/main-bot/src/main/java/frc/components/Arm.java +++ /dev/null @@ -1,53 +0,0 @@ -package frc.components; - -import com.ctre.phoenix.motorcontrol.ControlMode; -import com.ctre.phoenix.motorcontrol.can.TalonFX; -import frc.CommonData; -import frc.robot.Utility; -import frc.settings.ArmSettings; - -public class Arm implements IComponent { - - public enum Position { - /* - * This is the positions or 'presets' of the arms - */ - - kTopShelf(-85465, 99934), - kMiddleShelfOrHumanPlayer(-30156, 152244), - kGroundPickup(10411, 26723), - kHome(-32405, 941), - kHumanPlayerStation(-55821, 45126); - - Position(double presetShoulderPos, double presetElbowPos) { - shoulderPos = presetShoulderPos; - elbowPos = presetElbowPos; - } - - public double shoulderPos; - public double elbowPos; - } - - public Arm(ArmSettings settings) { - shoulderMotor = new TalonFX(settings.shoulderMotorID); - elbowMotor = new TalonFX(settings.elbowMotorID); - } - - TalonFX shoulderMotor; - TalonFX elbowMotor; - - public void moveToPOS() { - CommonData.shoulderAngle = shoulderMotor.getSelectedSensorPosition(); - CommonData.elbowAngle = elbowMotor.getSelectedSensorPosition(); - - var actualShoulderTarget = Utility.clamp(CommonData.desiredShoulderAngle, -91250, 52915); - var actualElbowTarget = Utility.clamp(CommonData.desiredElbowAngle, -645, 189514); - - shoulderMotor.set(ControlMode.Position, actualShoulderTarget); - elbowMotor.set(ControlMode.Position, actualElbowTarget); - } - - public void update() { - moveToPOS(); - } -} diff --git a/2022-2023/main-bot/src/main/java/frc/components/Claw.java b/2022-2023/main-bot/src/main/java/frc/components/Claw.java deleted file mode 100755 index faa3266..0000000 --- a/2022-2023/main-bot/src/main/java/frc/components/Claw.java +++ /dev/null @@ -1,66 +0,0 @@ -package frc.components; - -import edu.wpi.first.wpilibj.DoubleSolenoid; -import edu.wpi.first.wpilibj.DoubleSolenoid.Value; -import edu.wpi.first.wpilibj.PneumaticsModuleType; -import frc.CommonData; -import frc.settings.ClawSettings; - -/* - * 'public': This class can be accessed outside of this folder. - * 'class': This can contain variables and functionality. - * 'Claw': The name of this particular class. This is treated as a TYPE. - * 'implements': This class implements an interface, or more than one. This class must implement the methods described - * in the interface. - * 'IComponent': The name of the interface this class implements. This can be more than one, separated by commas. - */ -public class Claw implements IComponent { - - /* - * 'public': This enum can be accessed outside this class. - * 'enum': A conventiently-named list of constants, in lieu of saying '1', '2', '3'... by giving each value a - * meaningful name. An enum is actually capable of more than this, but this is its most used form. - * 'State': The name of this particular enum. This is treated as a TYPE. - */ - public enum State { - kOpen, - kClosed, - } - - /* - * 'private': This variable cannot be accessed outside this class, nor by any potential child classes. - * 'DoubleSolenoid': the TYPE of data this variable is. - * 'm_solenoid': A custom name for this variable. Uses the convention that member variables begin with 'm_'. - */ - private DoubleSolenoid m_solenoid; - - /* - * 'public': This constructor can be accessed outside this class. - * 'Claw': The same name as the class. A "method-looking" declaration that uses the same name as the class is a - * constructor. Constructors do NOT specify a return type, not even 'void'. - * '(...)': This constructor accepts 3 arguments. - * '(int _, int _, int _)': Each argument is an 'int'. Generally, arguments need not all be the same type. - * '(_ pneumaticsModuleId, _ openingPortId, _ closingPortId)': Each argument's name. These are variables. - */ - public Claw(ClawSettings settings) { - m_solenoid = new DoubleSolenoid(settings.pneumaticsModuleId, PneumaticsModuleType.REVPH, settings.openingPortId, settings.closingPortId); - } - - /* - * 'public': This method can be called by code outside this class. - * 'void': This method does not return anything. - * 'update': The name of this method. - * '()': This method accepts 0 arguments. - */ - public void update() { - // This method will be called periodically. - // This assumes that 'CommonData.ClawState' updates elsewhere before this is called. - switch (CommonData.clawState) { - case kOpen: - m_solenoid.set(Value.kForward); // piston pushes forward -> claw opens - break; - case kClosed: - m_solenoid.set(Value.kReverse); // piston pulls back -> claw closes - } - } -} diff --git a/2022-2023/main-bot/src/main/java/frc/components/IComponent.java b/2022-2023/main-bot/src/main/java/frc/components/IComponent.java deleted file mode 100755 index b04a23c..0000000 --- a/2022-2023/main-bot/src/main/java/frc/components/IComponent.java +++ /dev/null @@ -1,19 +0,0 @@ -package frc.components; - -/* - * 'public': This class can be accessed outside of this folder. - * 'interface': This can contain method declarations without their definitions. Any class that implements this - * interface MUST implement all methods this interface describes. Otherwise, the compiler reports an - * error. - * 'IComponent': The name of this particular interface. - */ -public interface IComponent { - /* - * 'public': This method can be accessed outside this class. - * 'void': This method does not return anything. - * 'update': This method is called "update". - * '()': This method accepts no arguments. - * ';' This method contains no body; it is not defined (only declared); it is not implemented. - */ - public void update(); -} diff --git a/2022-2023/main-bot/src/main/java/frc/components/README.md b/2022-2023/main-bot/src/main/java/frc/components/README.md deleted file mode 100755 index 6e1e7ce..0000000 --- a/2022-2023/main-bot/src/main/java/frc/components/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# Structure of components - -Each component should implement an `update` function, as specified in -`IComponent`. What each component does in its `update` depends on that -component. For instance, a controller component may fetch all the data -it needs and fill out relevant sections of a common `data` object. A -drive component may fetch the values from the common `data` object and -drive accordingly. \ No newline at end of file diff --git a/2022-2023/main-bot/src/main/java/frc/components/SwerveDrive.java b/2022-2023/main-bot/src/main/java/frc/components/SwerveDrive.java deleted file mode 100755 index 5cbd129..0000000 --- a/2022-2023/main-bot/src/main/java/frc/components/SwerveDrive.java +++ /dev/null @@ -1,84 +0,0 @@ -package frc.components; - -import com.kauailabs.navx.frc.AHRS; -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.wpilibj.SPI; -import frc.CommonData; -import frc.robot.Utility; -import frc.settings.SwerveDriveSettings; - -public class SwerveDrive implements IComponent { - final static double maximumSpeed = (6380 * 0.3191858136) / 60 / 3; - final static double maximumRotation = (maximumSpeed * 2 * Math.PI) / 2.7389195456 / 2; - - double yawOffset = 0; - - public SwerveDrive(SwerveDriveSettings settings) { - swerveWheels = new SwerveWheel[] { - new SwerveWheel(settings.FLSwerve), - new SwerveWheel(settings.FRSwerve), - new SwerveWheel(settings.BLSwerve), - new SwerveWheel(settings.BRSwerve)}; - - kinematics = new SwerveDriveKinematics(swerveWheels[0].getSwervePos(), swerveWheels[1].getSwervePos(), swerveWheels[2].getSwervePos(), swerveWheels[3].getSwervePos()); - } - - SwerveWheel[] swerveWheels; - - double leftOrRight; - double forwardOrBack; - - AHRS ahrs = new AHRS(SPI.Port.kMXP); - - SwerveDriveKinematics kinematics; - - public void balance() { - final double maximumTiltAngle = 12.81974281; - - forwardOrBack = Math.abs(CommonData.robotPitch) > 10 ? CommonData.robotPitch / maximumTiltAngle : 0; - leftOrRight = Math.abs(CommonData.robotRoll) > 10 ? CommonData.robotRoll / maximumTiltAngle : 0; - - Utility.printLn("" + forwardOrBack); - final var desiredTranslationSpeedX = forwardOrBack * -maximumSpeed; // This code uses '+x' as toward opposing alliance wall - final var desiredTranslationSpeedY = 0; // This code uses '+y' as toward driver's right - final var desiredRotationSpeed = -leftOrRight * maximumRotation; - var moduleStates = kinematics.toSwerveModuleStates(ChassisSpeeds.fromFieldRelativeSpeeds(desiredTranslationSpeedX, desiredTranslationSpeedY, desiredRotationSpeed, Rotation2d.fromDegrees(ahrs.getYaw() - yawOffset))); - - for (int i = 0; i < 4; i++) { - moduleStates[i].speedMetersPerSecond *= 0.1; - swerveWheels[i].set(moduleStates[i]); - } - } - - public void update() { - CommonData.robotPitch = ahrs.getPitch(); - CommonData.robotRoll = ahrs.getRoll(); - - // Calabrate The NavX - if (CommonData.calibrate == true) { - CommonData.calibrate = false; - yawOffset = ahrs.getYaw(); - } - - if (CommonData.battenDownTheHatches) { - for (int i = 0; i < 4; i++) { - swerveWheels[i].defense(); - } - } - else if (CommonData.balance) { - balance(); - } - else { - final var desiredTranslationSpeedX = CommonData.forwardSpeed * maximumSpeed; // This code uses '+x' as toward opposing alliance wall - final var desiredTranslationSpeedY = -CommonData.sideSpeed * maximumSpeed; // This code uses '+y' as toward driver's right - final var desiredRotationSpeed = -CommonData.desiredTurn * maximumRotation; - var moduleStates = kinematics.toSwerveModuleStates(ChassisSpeeds.fromFieldRelativeSpeeds(desiredTranslationSpeedX, desiredTranslationSpeedY, desiredRotationSpeed, Rotation2d.fromDegrees(ahrs.getYaw()))); - - for (int i = 0; i < 4; i++) { - swerveWheels[i].set(moduleStates[i]); - } - } - } -} \ No newline at end of file diff --git a/2022-2023/main-bot/src/main/java/frc/components/SwerveWheel.java b/2022-2023/main-bot/src/main/java/frc/components/SwerveWheel.java deleted file mode 100755 index 25f4d31..0000000 --- a/2022-2023/main-bot/src/main/java/frc/components/SwerveWheel.java +++ /dev/null @@ -1,70 +0,0 @@ -package frc.components; - -import com.ctre.phoenix.motorcontrol.ControlMode; -import com.ctre.phoenix.motorcontrol.can.TalonFX; -import com.ctre.phoenix.sensors.CANCoder; -import edu.wpi.first.math.geometry.Rotation2d; -import edu.wpi.first.math.geometry.Translation2d; -import edu.wpi.first.math.kinematics.SwerveModuleState; -import frc.settings.SwerveWheelSettings; -import frc.settings.SwerveWheelSettings.Location; - -public class SwerveWheel { - TalonFX turnMotor; - TalonFX driveMotor; - CANCoder encoder; - - // 0.238125 Meters - // 0.365125 Meters - - Translation2d modulePos; - - double defensiveAngle; - - Location location; - - public SwerveWheel(SwerveWheelSettings settings) { - turnMotor = new TalonFX(settings.turnID); - driveMotor = new TalonFX(settings.driveID); - encoder = new CANCoder(settings.encoderID); - - location = settings.location; - defensiveAngle = settings.defensiveAngle; - - modulePos = new Translation2d(settings.posX, settings.posY); - } - - public void set(SwerveModuleState swerveModuleState) { - swerveModuleState = SwerveModuleState.optimize(swerveModuleState, Rotation2d.fromDegrees(turnMotor.getSelectedSensorPosition() / 11.3777778)); - double maximumSpeed = (6380 * 0.3191858136) / 60 / 3; - - final double desiredTurnPos = swerveModuleState.angle.getDegrees() * 11.3777778; // conversion from degrees to native encoder value - - turnMotor.set(ControlMode.Position, desiredTurnPos); - - driveMotor.set(ControlMode.PercentOutput, swerveModuleState.speedMetersPerSecond / maximumSpeed); - // 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 TalonFX getTurnMotor() { - return turnMotor; - } - - public TalonFX getDriveMotor() { - return driveMotor; - } - - public Translation2d getSwervePos() { - return modulePos; - } - - // public void battenDownTheHatches() - // { - // set(defensiveAngle, 0, 0); - // } -} \ No newline at end of file diff --git a/2022-2023/main-bot/src/main/java/frc/components/autonomous/ArmState1.java b/2022-2023/main-bot/src/main/java/frc/components/autonomous/ArmState1.java deleted file mode 100755 index 97c82f9..0000000 --- a/2022-2023/main-bot/src/main/java/frc/components/autonomous/ArmState1.java +++ /dev/null @@ -1,43 +0,0 @@ -package frc.components.autonomous; - -import frc.CommonData; -// import frc.robot.Utility; -import frc.state_machine.State; - -public class ArmState1 extends State { - - private static final double targetShoulderAngle = -75563; - private static final double targetElbowAngle = 109928; - - private static final double shoulderThreshold = 500; - private static final double elbowThreshold = 500; - - private static final double shoulderPower = 0.2; - private static final double elbowPower = 0.2; - - @Override - public void onEnter() { - System.out.println("Arm State 1 entered"); - } - - @Override - public void onExit() { - System.out.println("Arm State 1 exited"); - } - - @Override - public boolean run() { - CommonData.desiredShoulderAngle = targetShoulderAngle; - CommonData.desiredElbowAngle = targetElbowAngle; - - final double shoulderError = targetShoulderAngle - CommonData.shoulderAngle; - final double elbowError = targetElbowAngle - CommonData.elbowAngle; - - if (Math.abs(elbowError) < 400 && Math.abs(shoulderError) < 400) { - return true; - } - else { - return false; - } - } -} diff --git a/2022-2023/main-bot/src/main/java/frc/components/autonomous/ArmState2.java b/2022-2023/main-bot/src/main/java/frc/components/autonomous/ArmState2.java deleted file mode 100755 index aa7a65b..0000000 --- a/2022-2023/main-bot/src/main/java/frc/components/autonomous/ArmState2.java +++ /dev/null @@ -1,34 +0,0 @@ -package frc.components.autonomous; - -import edu.wpi.first.wpilibj.Timer; -import frc.CommonData; -import frc.components.Claw; -import frc.state_machine.State; - -public class ArmState2 extends State { - Timer timer = new Timer(); - - @Override - public void onEnter() { - System.out.println("Arm State 2 entered"); - timer.start(); - } - - @Override - public void onExit() { - System.out.println("Arm State 2 exited"); - } - - @Override - public boolean run() { - if (timer.hasElapsed(1)) { - CommonData.counter++; - return true; - } - else if (timer.hasElapsed(0.5)) { - CommonData.clawState = Claw.State.kOpen; - } - - return false; - } -} diff --git a/2022-2023/main-bot/src/main/java/frc/components/autonomous/ArmState3.java b/2022-2023/main-bot/src/main/java/frc/components/autonomous/ArmState3.java deleted file mode 100755 index acafd99..0000000 --- a/2022-2023/main-bot/src/main/java/frc/components/autonomous/ArmState3.java +++ /dev/null @@ -1,41 +0,0 @@ -package frc.components.autonomous; - -import frc.CommonData; -import frc.state_machine.State; - -public class ArmState3 extends State { - private static final double targetShoulderAngle = -18610; // Placeholder - private static final double targetElbowAngle = -645; // Placeholder - - private static final double shoulderThreshold = 500; - private static final double elbowThreshold = 500; - - private static final double shoulderPower = 0.2; - private static final double elbowPower = 0.2; - - @Override - public void onEnter() { - System.out.println("Arm State 3 entered"); - } - - @Override - public void onExit() { - System.out.println("Arm State 3 exited"); - } - - @Override - public boolean run() { - CommonData.desiredShoulderAngle = targetShoulderAngle; - CommonData.desiredElbowAngle = targetElbowAngle; - - final double shoulderError = targetShoulderAngle - CommonData.shoulderAngle; - final double elbowError = targetElbowAngle - CommonData.elbowAngle; - - if (Math.abs(elbowError) < 400 && Math.abs(shoulderError) < 400) { - return true; - } - else { - return false; - } - } -} diff --git a/2022-2023/main-bot/src/main/java/frc/components/autonomous/Autonomous.java b/2022-2023/main-bot/src/main/java/frc/components/autonomous/Autonomous.java deleted file mode 100755 index 7321b91..0000000 --- a/2022-2023/main-bot/src/main/java/frc/components/autonomous/Autonomous.java +++ /dev/null @@ -1,28 +0,0 @@ -package frc.components.autonomous; - -import frc.components.IComponent; -import frc.state_machine.StateMachine; - -public class Autonomous implements IComponent { - StateMachine m_stateMachine = new StateMachine(); - - public Autonomous() { - // m_driveStateMachine.addState(new DriveState1()); - // m_driveStateMachine.addState(new DriveState2()); - - // VV Balancing code -- UNCOMMENT TO TEST THIS CODE AT AN OFFICIAL COMPETITION - COMMENT AGAIN IF IT DOES NOT WORK - // m_driveStateMachine.addState(new DriveState5()); - // ^^ Balancing code - - m_stateMachine.addState(new ArmState1()); // Move arm to drop box - m_stateMachine.addState(new ArmState2()); // Drop box - m_stateMachine.addState(new ArmState3()); // Move arm to reset - m_stateMachine.addState(new DriveState3()); // Move to balance or taxi - m_stateMachine.addState(new DriveState6()); // Balance - } - - @Override - public void update() { - m_stateMachine.run(); - } -} diff --git a/2022-2023/main-bot/src/main/java/frc/components/autonomous/DriveState1.java b/2022-2023/main-bot/src/main/java/frc/components/autonomous/DriveState1.java deleted file mode 100755 index 5fb12ff..0000000 --- a/2022-2023/main-bot/src/main/java/frc/components/autonomous/DriveState1.java +++ /dev/null @@ -1,44 +0,0 @@ -package frc.components.autonomous; - -import edu.wpi.first.networktables.NetworkTable; -import edu.wpi.first.networktables.NetworkTableEntry; -import edu.wpi.first.networktables.NetworkTableInstance; -import edu.wpi.first.wpilibj.Timer; -import frc.CommonData; -import frc.state_machine.State; - -public class DriveState1 extends State { - NetworkTable table = NetworkTableInstance.getDefault().getTable("limelight"); - NetworkTableEntry tv = table.getEntry("tv"); - - Timer timer; - - @Override - public void onEnter() { - System.out.println("Drive State 1 entered"); - } - @Override - public void onExit() { - System.out.println("Drive State 1 exited"); - } - - @Override - public boolean run() { - CommonData.forwardSpeed = -0.1; - - boolean targetFound = tv.getDouble(0) == 1; - if (targetFound) { - if (timer == null) { - timer = new Timer(); - timer.start(); - } - else if (timer.hasElapsed(0.1)) { - return true; - } - } - else { - timer = null; - } - return false; - } -} diff --git a/2022-2023/main-bot/src/main/java/frc/components/autonomous/DriveState2.java b/2022-2023/main-bot/src/main/java/frc/components/autonomous/DriveState2.java deleted file mode 100755 index c0f918a..0000000 --- a/2022-2023/main-bot/src/main/java/frc/components/autonomous/DriveState2.java +++ /dev/null @@ -1,68 +0,0 @@ -package frc.components.autonomous; - -import edu.wpi.first.networktables.NetworkTable; -import edu.wpi.first.networktables.NetworkTableEntry; -import edu.wpi.first.networktables.NetworkTableInstance; -import frc.CommonData; -import frc.robot.Utility; -import frc.state_machine.State; - -public class DriveState2 extends State { - - NetworkTable table = NetworkTableInstance.getDefault().getTable("limelight"); - NetworkTableEntry tv = table.getEntry("tv"); - NetworkTableEntry array = table.getEntry("camerapose_targetspace"); - - @Override - public void onEnter() { - System.out.println("Drive State 2 entered"); - } - @Override - public void onExit() { - System.out.println("Drive State 2 exited"); - } - - @Override - public boolean run() { - boolean found = tv.getDouble(0) == 1; - - double tx = 0; - double tz = 0; - double ry = 0; - // CommonData.desiredHeading = 0; - // CommonData.desiredPower = 0; - CommonData.desiredTurn = 0; - if (found) { - Double[] targetInfo = array.getDoubleArray(new Double[0]); - - tx = targetInfo[0]; // tx - tz = targetInfo[2] + .5; // tz - ry = targetInfo[4]; // ry - - tx = Utility.sigmoid(tx * 2) * 2 - 1; - tz = Utility.clamp(tz, -1.0, 1.0); - ry = Utility.sigmoid(ry / 10) * 2 - 1; - Utility.printLn("TX: " + tx + " TZ: " + tz + " RY: " + ry); - - if ((Math.abs(tz) < 0.1) && (Math.abs(tx) < 0.15) && (Math.abs(ry) < 0.6)) { - CommonData.counter++; - return true; - } - else { - // Drive Until Center And Lined Up With The April Tag - double theta = Math.atan2(tx, tz); - double degrees = Math.toDegrees(theta) + 180; - double power = Math.sqrt(Math.pow(tx, 2) + Math.pow(tz, 2)); - - if (tx == 0 && tz == 0) { - degrees = 0; - } - - // CommonData.desiredHeading = degrees; - // CommonData.desiredPower = power; - CommonData.desiredTurn = ry; - } - } - return false; - } -} diff --git a/2022-2023/main-bot/src/main/java/frc/components/autonomous/DriveState3.java b/2022-2023/main-bot/src/main/java/frc/components/autonomous/DriveState3.java deleted file mode 100755 index dc4cf1f..0000000 --- a/2022-2023/main-bot/src/main/java/frc/components/autonomous/DriveState3.java +++ /dev/null @@ -1,53 +0,0 @@ -package frc.components.autonomous; - -import edu.wpi.first.networktables.NetworkTable; -import edu.wpi.first.networktables.NetworkTableEntry; -import edu.wpi.first.networktables.NetworkTableInstance; -import edu.wpi.first.wpilibj.Timer; -import frc.CommonData; -import frc.state_machine.State; - -public class DriveState3 extends State { - NetworkTable table = NetworkTableInstance.getDefault().getTable("limelight"); - NetworkTableEntry tid = table.getEntry("tid"); - NetworkTableEntry tv = table.getEntry("tv"); - Timer timer; - Timer timer2; - - @Override - public void onEnter() { - System.out.println("Drive State 3 entered"); - } - @Override - public void onExit() { - System.out.println("Drive State 3 exited"); - } - - @Override - public boolean run() { - CommonData.forwardSpeed = -0.35; - CommonData.desiredTurn = 0; - - if (CommonData.robotPitch > 10 || CommonData.robotRoll > 10) { - if (timer2 == null) { - System.out.println("Pitch: " + CommonData.robotPitch + " Roll: " + CommonData.robotRoll); - timer2 = new Timer(); - timer2.start(); - } - if (timer2.hasElapsed(1)) { - System.out.println("Tilted!"); - return true; - } - } - - if (timer == null) { - timer = new Timer(); - timer.start(); - } - else if (timer.hasElapsed(3)) { - return true; - } - - return false; - } -} diff --git a/2022-2023/main-bot/src/main/java/frc/components/autonomous/DriveState4.java b/2022-2023/main-bot/src/main/java/frc/components/autonomous/DriveState4.java deleted file mode 100755 index 50b4ee2..0000000 --- a/2022-2023/main-bot/src/main/java/frc/components/autonomous/DriveState4.java +++ /dev/null @@ -1,68 +0,0 @@ -package frc.components.autonomous; - -import edu.wpi.first.networktables.NetworkTable; -import edu.wpi.first.networktables.NetworkTableEntry; -import edu.wpi.first.networktables.NetworkTableInstance; -import frc.CommonData; -import frc.robot.Utility; -import frc.state_machine.State; - -public class DriveState4 extends State { - NetworkTable table = NetworkTableInstance.getDefault().getTable("limelight"); - NetworkTableEntry tv = table.getEntry("tv"); - NetworkTableEntry tid = table.getEntry("tid"); - NetworkTableEntry array = table.getEntry("camerapose_targetspace"); - - @Override - public void onEnter() { - System.out.println("Drive State 4 entered"); - } - @Override - public void onExit() { - System.out.println("Drive State 4 exited"); - } - - @Override - public boolean run() { - boolean found = tv.getDouble(0) == 1; - double id = tid.getDouble(-1); - - double tx = 0; - double tz = 0; - double ry = 0; - // CommonData.desiredHeading = 0; - // CommonData.desiredPower = 0; - CommonData.desiredTurn = 0; - if (found && (id == 2) || (id == 7)) { - Double[] targetInfo = array.getDoubleArray(new Double[0]); - - tx = targetInfo[0]; // tx - tz = targetInfo[2] + .5; // tz - ry = targetInfo[4]; // ry - - tx = Utility.sigmoid(tx * 2) * 2 - 1; - tz = Utility.clamp(tz, -1.0, 1.0); - ry = Utility.sigmoid(ry / 10) * 2 - 1; - - if ((Math.abs(tz) < 0.1) && (Math.abs(tx) < 0.15) && (Math.abs(ry) < 0.6)) { - return true; - } - else { - // Drive Until Center And Lined Up With The April Tag - double theta = Math.atan2(tx, tz); - double degrees = Math.toDegrees(theta) + 180; - double power = Math.sqrt(Math.pow(tx, 2) + Math.pow(tz, 2)); - - if (tx == 0 && tz == 0) - { - degrees = 0; - } - - // CommonData.desiredHeading = degrees; - // CommonData.desiredPower = power; - CommonData.desiredTurn = ry; - } - } - return false; - } -} diff --git a/2022-2023/main-bot/src/main/java/frc/components/autonomous/DriveState5.java b/2022-2023/main-bot/src/main/java/frc/components/autonomous/DriveState5.java deleted file mode 100755 index 920d3d4..0000000 --- a/2022-2023/main-bot/src/main/java/frc/components/autonomous/DriveState5.java +++ /dev/null @@ -1,36 +0,0 @@ -package frc.components.autonomous; - -import edu.wpi.first.networktables.NetworkTable; -import edu.wpi.first.networktables.NetworkTableEntry; -import edu.wpi.first.networktables.NetworkTableInstance; -import frc.CommonData; -import frc.robot.Utility; -import frc.state_machine.State; - -public class DriveState5 extends State { - NetworkTable table = NetworkTableInstance.getDefault().getTable("limelight"); - NetworkTableEntry tv = table.getEntry("tv"); - NetworkTableEntry tid = table.getEntry("tid"); - NetworkTableEntry array = table.getEntry("camerapose_targetspace"); - - @Override - public void onEnter() { - System.out.println("Drive State 5 entered"); - } - @Override - public void onExit() { - System.out.println("Drive State 5 exited"); - } - - @Override - public boolean run() { - if (CommonData.robotPitch > 2 || CommonData.robotRoll > 2) { - return true; - } - else { - CommonData.forwardSpeed = -0.3; - CommonData.desiredTurn = 0; - return false; - } - } -} \ No newline at end of file diff --git a/2022-2023/main-bot/src/main/java/frc/components/autonomous/DriveState6.java b/2022-2023/main-bot/src/main/java/frc/components/autonomous/DriveState6.java deleted file mode 100755 index 02e5d48..0000000 --- a/2022-2023/main-bot/src/main/java/frc/components/autonomous/DriveState6.java +++ /dev/null @@ -1,21 +0,0 @@ -package frc.components.autonomous; - -import frc.CommonData; -import frc.state_machine.State; - -public class DriveState6 extends State { - @Override - public void onEnter() { - System.out.println("Drive State 6 entered"); - } - @Override - public void onExit() { - System.out.println("Drive State 6 exited"); - } - - @Override - public boolean run() { - CommonData.balance = true; - return false; - } -} diff --git a/2022-2023/main-bot/src/main/java/frc/controllers/LogitechF310.java b/2022-2023/main-bot/src/main/java/frc/controllers/LogitechF310.java deleted file mode 100755 index 78c4848..0000000 --- a/2022-2023/main-bot/src/main/java/frc/controllers/LogitechF310.java +++ /dev/null @@ -1,150 +0,0 @@ -package frc.controllers; - -import edu.wpi.first.wpilibj.Joystick; -import java.lang.Math; - -public class LogitechF310 { - // Imported From Code/2022/stingr/main-bot - - private final int kIdButtonA = 1; - private final int kIdButtonB = 2; - private final int kIdButtonX = 3; - private final int kIdButtonY = 4; - private final int kIdButtonBumperLeft = 5; - private final int kIdButtonBumperRight = 6; - private final int kIdAxisleftX = 0; - private final int kIdAxisleftY = 1; - private final int kIdAxisrightX = 4; - private final int kIdAxisrightY = 5; - private final int kIdlefttrigger = 2; - private final int kIdrighttrigger = 3; - private final int kIdDpad = 0; - - // ... - - private Joystick controller; - - public double deadBand(double value) { - return Math.abs(value) < 0.2 ? 0 : value; - } - - public LogitechF310(int id) { - controller = new Joystick(id); - } - - public boolean getA() { - return controller.getRawButton(kIdButtonA); - } - - public boolean getB() { - return controller.getRawButton(kIdButtonB); - } - - public boolean getX() { - return controller.getRawButton(kIdButtonX); - } - - public boolean getY() { - return controller.getRawButton(kIdButtonY); - } - - public boolean getLeftBumper() { - return controller.getRawButton(kIdButtonBumperLeft); - } - - public boolean getRightBumper() { - return controller.getRawButton(kIdButtonBumperRight); - } - - public double getLeftStickX() { - return deadBand(controller.getRawAxis(kIdAxisleftX)); - } - - public double getLeftStickY() { - return deadBand(controller.getRawAxis(kIdAxisleftY)); - } - - public double getRightStickX() { - return deadBand(controller.getRawAxis(kIdAxisrightX)); - } - - public double getRightStickY() { - return deadBand(controller.getRawAxis(kIdAxisrightY)); - } - - public double getLeftTrigger() { - return controller.getRawAxis(kIdlefttrigger); - } - - public double getRightTrigger() { - return controller.getRawAxis(kIdrighttrigger); - } - - public boolean getDUp() { - int degrees = controller.getPOV(kIdDpad); - if (degrees == 315) { - return true; - } - - if (degrees == 0) { - return true; - } - - if (degrees == 45) { - return true; - } - - return false; - } - - public boolean getDRight() { - int degrees = controller.getPOV(kIdDpad); - if (degrees == 45) { - return true; - } - - if (degrees == 90) { - return true; - } - - if (degrees == 135) { - return true; - } - - return false; - } - - public boolean getDDown() { - int degrees = controller.getPOV(kIdDpad); - if (degrees == 135) { - return true; - } - - if (degrees == 180) { - return true; - } - - if (degrees == 225) { - return true; - } - - return false; - } - - public boolean getDLeft() { - int degrees = controller.getPOV(kIdDpad); - if (degrees == 225) { - return true; - } - - if (degrees == 270) { - return true; - } - - if (degrees == 315) { - return true; - } - - return false; - } -} diff --git a/2022-2023/main-bot/src/main/java/frc/controllers/Xbox360.java b/2022-2023/main-bot/src/main/java/frc/controllers/Xbox360.java deleted file mode 100755 index 69d026d..0000000 --- a/2022-2023/main-bot/src/main/java/frc/controllers/Xbox360.java +++ /dev/null @@ -1,146 +0,0 @@ -package frc.controllers; - -import edu.wpi.first.wpilibj.GenericHID.RumbleType; -import edu.wpi.first.wpilibj.Joystick; -import java.lang.Math; - -public class Xbox360 -{ - - public Xbox360(int ID) { - joystick = new Joystick(ID); - } - - Joystick joystick; - - public double deadBand(double value) { - return Math.abs(value) < 0.175 ? 0 : value; - } - - public double getLeftStickX() { - return deadBand(joystick.getRawAxis(0)); - } - - public double getLeftStickY() { - return deadBand(joystick.getRawAxis(1)); - } - - public double getRightStickX() { - return deadBand(joystick.getRawAxis(4)); - } - - public double getRightStickY() { - return deadBand(joystick.getRawAxis(5)); - } - - public boolean getA() { - return joystick.getRawButton(1); - } - - public boolean getB() { - return joystick.getRawButton(2); - } - - public boolean getX() { - return joystick.getRawButton(3); - } - - public boolean getY() { - return joystick.getRawButton(4); - } - - public boolean getLB() { - return joystick.getRawButton(5); - } - - public boolean getRB() { - return joystick.getRawButton(6); - } - - public boolean getBack() { - return joystick.getRawButton(7); - } - - public boolean getStart() { - return joystick.getRawButton(8); - } - - public boolean getLeftStick() { - return joystick.getRawButton(9); - } - - public boolean getRightStick() { - return joystick.getRawButton(10); - } - - public double getLeftTrigger() { - return joystick.getRawAxis(2); - } - - public double getRightTrigger() { - return joystick.getRawAxis(3); - } - - public enum dPad { - up, - down, - left, - right, - upright, - upleft, - downright, - downleft, - none - } - - public dPad getPad() { - switch (joystick.getPOV()) - { - case 0: - return dPad.up; - - case 360: - return dPad.up; - - case 90: - return dPad.right; - - case 180: - return dPad.down; - - case 270: - return dPad.left; - - case 45: - return dPad.upright; - - case 135: - return dPad.downright; - - case 225: - return dPad.downleft; - - case 315: - return dPad.upleft; - - default: - return dPad.none; - } - } - - public void rumbleHigh() { - joystick.setRumble(RumbleType.kRightRumble, 1); - } - - public void rumbleLow() { - joystick.setRumble(RumbleType.kLeftRumble, 1); - } - - public void letsGetReadyToRumble() { - joystick.setRumble(RumbleType.kBothRumble, 1); - } - - public void rumbleOff() { - joystick.setRumble(RumbleType.kBothRumble, 0); - } -} diff --git a/2022-2023/main-bot/src/main/java/frc/controllers/XboxOne.java b/2022-2023/main-bot/src/main/java/frc/controllers/XboxOne.java deleted file mode 100644 index 029b779..0000000 --- a/2022-2023/main-bot/src/main/java/frc/controllers/XboxOne.java +++ /dev/null @@ -1,147 +0,0 @@ -package frc.controllers; - -import edu.wpi.first.wpilibj.GenericHID.RumbleType; -import edu.wpi.first.wpilibj.Joystick; -import java.lang.Math; - -public class XboxOne -{ - - public XboxOne(int ID) { - joystick = new Joystick(ID); - } - - Joystick joystick; - - public double deadBand(double value) { - return Math.abs(value) < 0 ? 0 : value; // Set deadband to 0 as this controller doesn't have drift - } - - public double getLeftStickX() { - return deadBand(joystick.getRawAxis(0)); - } - - public double getLeftStickY() { - return deadBand(joystick.getRawAxis(1)); - } - - public double getRightStickX() { - return deadBand(joystick.getRawAxis(4)); - } - - public double getRightStickY() { - return deadBand(joystick.getRawAxis(5)); - } - - public boolean getA() { - return joystick.getRawButton(1); - } - - public boolean getB() { - return joystick.getRawButton(2); - } - - public boolean getX() { - return joystick.getRawButton(3); - } - - public boolean getY() { - return joystick.getRawButton(4); - } - - public boolean getLB() { - return joystick.getRawButton(5); - } - - public boolean getRB() { - return joystick.getRawButton(6); - } - - public boolean getBack() { - return joystick.getRawButton(7); - } - - public boolean getStart() { - return joystick.getRawButton(8); - } - - public boolean getLeftStick() - { - return joystick.getRawButton(9); - } - - public boolean getRightStick() { - return joystick.getRawButton(10); - } - - public double getLeftTrigger() { - return joystick.getRawAxis(2); - } - - public double getRightTrigger() { - return joystick.getRawAxis(3); - } - - public enum dPad { - up, - down, - left, - right, - upright, - upleft, - downright, - downleft, - none - } - - public dPad getPad() { - switch (joystick.getPOV()) - { - case 0: - return dPad.up; - - case 360: - return dPad.up; - - case 90: - return dPad.right; - - case 180: - return dPad.down; - - case 270: - return dPad.left; - - case 45: - return dPad.upright; - - case 135: - return dPad.downright; - - case 225: - return dPad.downleft; - - case 315: - return dPad.upleft; - - default: - return dPad.none; - } - } - - public void rumbleHigh() { - joystick.setRumble(RumbleType.kRightRumble, 1); - } - - public void rumbleLow() { - joystick.setRumble(RumbleType.kLeftRumble, 1); - } - - public void letsGetReadyToRumble() { - joystick.setRumble(RumbleType.kBothRumble, 1); - } - - public void rumbleOff() { - joystick.setRumble(RumbleType.kBothRumble, 0); - } -} diff --git a/2022-2023/main-bot/src/main/java/frc/robot/Main.java b/2022-2023/main-bot/src/main/java/frc/robot/Main.java deleted file mode 100755 index 8776e5d..0000000 --- a/2022-2023/main-bot/src/main/java/frc/robot/Main.java +++ /dev/null @@ -1,25 +0,0 @@ -// 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/2022-2023/main-bot/src/main/java/frc/robot/Robot.java b/2022-2023/main-bot/src/main/java/frc/robot/Robot.java
deleted file mode 100755
index 2d5b738..0000000
--- a/2022-2023/main-bot/src/main/java/frc/robot/Robot.java
+++ /dev/null
@@ -1,200 +0,0 @@
-// 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 com.fasterxml.jackson.databind.ObjectMapper;
-import edu.wpi.first.wpilibj.Compressor;
-import edu.wpi.first.wpilibj.Filesystem;
-import edu.wpi.first.wpilibj.PneumaticsModuleType;
-import edu.wpi.first.wpilibj.TimedRobot;
-import frc.CommonData;
-import frc.components.Arm;
-import frc.components.Claw;
-import frc.components.IComponent;
-import frc.components.SwerveDrive;
-import frc.components.autonomous.Autonomous;
-import frc.controllers.LogitechF310;
-import frc.controllers.Xbox360;
-import frc.settings.Settings;
-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 class Robot extends TimedRobot {
- /*
- * Constants should go here. For example:
- *
- * final int kMainControllerId = 0;
- * final int kAuxControllerId = 1;
- *
- * final int kDriveMotorTopLeftId = 1;
- * final int kDriveMotorTopRightId = 2;
- * ...
- *
- * Each constant should start with 'k'. This is a convention.
- * Each Id should be given its own constant.
- * Each constant should clearly say what it is for.
- */
-
- public 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());
- }
- }
-
- final int kPneumaticsModuleId = 0;
-
- final int kClawOpeningPortId = 0;
- final int kClawClosingPortId = 1;
-
- Xbox360 xbox360 = new Xbox360(settings.controllerID);
- LogitechF310 logitechF310 = new LogitechF310(settings.auxControllerID);
-
- Autonomous autonomous;
-
- Compressor compressor = new Compressor(settings.clawSettings.pneumaticsModuleId, PneumaticsModuleType.REVPH);
-
- // IComponent[] sensorComponents;
- IComponent[] actuatorComponents = new IComponent[] {
- new Claw(settings.clawSettings),
- new Arm(settings.armSettings),
- new SwerveDrive(settings.swerveDrive)
-
- };
-
- boolean driverIsAnna = false;
-
- /**
- * This function is run when the robot is first started up and should be used for any
- * initialization code.
- */
- @Override
- public void robotInit()
- {
- // compressor.disable();
- }
-
- @Override
- public void robotPeriodic() {
- // for(var sensor : sensorComponents)
- //{
- // sensor.update();
- // }
-
- for (var actuator : actuatorComponents) {
- actuator.update();
- }
- }
-
- @Override
- public void autonomousInit() {
- autonomous = new Autonomous();
- CommonData.calibrate = true;
- }
-
- @Override
- public void autonomousPeriodic() {
- autonomous.update();
- }
-
- @Override
- public void teleopInit() {
- }
-
- // 18.75 -> 0.47625
- // 28.75 -> 0.73025
-
- // 0.238125 Meters
- // 0.365125 Meters
-
- @Override
- public void teleopPeriodic()
- {
- CommonData.balance = xbox360.getB();
- CommonData.battenDownTheHatches = xbox360.getX();
- CommonData.sideSpeed = xbox360.getLeftStickX();
- CommonData.forwardSpeed = xbox360.getLeftStickY();
- CommonData.desiredTurn = Utility.snapToEdge(-xbox360.getRightStickX(), -1, 1, 0.9);
-
- CommonData.desiredShoulderAngle = CommonData.shoulderAngle + (logitechF310.getLeftStickY() * 35000); // 10000
- CommonData.desiredElbowAngle = CommonData.elbowAngle + (logitechF310.getRightStickY() * 10000); // 10000
-
- if (logitechF310.getDUp()) {
- CommonData.desiredShoulderAngle = Arm.Position.kTopShelf.shoulderPos;
- CommonData.desiredElbowAngle = Arm.Position.kTopShelf.elbowPos;
- }
- else if (logitechF310.getDDown()) {
- CommonData.desiredShoulderAngle = Arm.Position.kMiddleShelfOrHumanPlayer.shoulderPos;
- CommonData.desiredElbowAngle = Arm.Position.kMiddleShelfOrHumanPlayer.elbowPos;
- }
- else if (logitechF310.getA()) {
- CommonData.desiredShoulderAngle = Arm.Position.kGroundPickup.shoulderPos;
- CommonData.desiredElbowAngle = Arm.Position.kGroundPickup.elbowPos;
- }
- else if (logitechF310.getB()) {
- CommonData.desiredShoulderAngle = Arm.Position.kHome.shoulderPos;
- CommonData.desiredElbowAngle = Arm.Position.kHome.elbowPos;
- }
- else if (logitechF310.getY())
- {
- CommonData.desiredShoulderAngle = Arm.Position.kHumanPlayerStation.shoulderPos;
- CommonData.desiredElbowAngle = Arm.Position.kHumanPlayerStation.elbowPos;
- }
-
- if (logitechF310.getLeftBumper()) {
- CommonData.clawState = Claw.State.kOpen;
- }
- else if (logitechF310.getRightBumper()) {
- CommonData.clawState = Claw.State.kClosed;
- }
- }
-
- @Override
- public void disabledInit() {
- CommonData.clawState = Claw.State.kClosed;
- CommonData.sideSpeed = 0;
- CommonData.desiredTurn = 0;
- CommonData.forwardSpeed = 0;
- CommonData.balance = false;
-
- autonomous = null;
- xbox360.rumbleOff();
-
- CommonData.counter = 0;
-
- // "Zero" out the rest of the variables (as they are added) to safe, sensible default values
- }
-
- @Override
- public void disabledPeriodic() {
- }
-
- @Override
- public void testInit() {
- CommonData.calibrate = true;
- }
-
- @Override
- public void testPeriodic() {
- }
-
- @Override
- public void simulationInit() {
- }
-
- @Override
- public void simulationPeriodic() {
- }
-}
diff --git a/2022-2023/main-bot/src/main/java/frc/robot/Utility.java b/2022-2023/main-bot/src/main/java/frc/robot/Utility.java
deleted file mode 100755
index 7bfabf5..0000000
--- a/2022-2023/main-bot/src/main/java/frc/robot/Utility.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package frc.robot;
-
-import java.lang.Math;
-
-public class Utility {
- static int printCounter = 0;
-
- public static void printLn(String messageString) {
- if (printCounter == 50) {
- System.out.println(messageString);
- printCounter = 0;
- }
- else {
- printCounter++;
- }
- }
-
- public static double sigmoid(double x) {
- return 1 / (1 + Math.pow(Math.E, -x));
- }
-
- public static double clamp(double value, double min, double max) {
- return value < min ? min : value > max ? max
- : value;
- }
-
- public static double snapToEdge(double value, double min, double max, double threshold) {
- if (value < -threshold) {
- return min;
- }
- if (value > threshold) {
- return max;
- }
- return value;
- }
-}
\ No newline at end of file
diff --git a/2022-2023/main-bot/src/main/java/frc/settings/ArmSettings.java b/2022-2023/main-bot/src/main/java/frc/settings/ArmSettings.java
deleted file mode 100755
index bba8fdb..0000000
--- a/2022-2023/main-bot/src/main/java/frc/settings/ArmSettings.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package frc.settings;
-
-public class ArmSettings {
- public int shoulderMotorID;
- public int elbowMotorID;
-}
\ No newline at end of file
diff --git a/2022-2023/main-bot/src/main/java/frc/settings/ClawSettings.java b/2022-2023/main-bot/src/main/java/frc/settings/ClawSettings.java
deleted file mode 100755
index 5ea966d..0000000
--- a/2022-2023/main-bot/src/main/java/frc/settings/ClawSettings.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package frc.settings;
-
-public class ClawSettings {
-
- public int openingPortId;
- public int closingPortId;
- public int pneumaticsModuleId;
-
-}
diff --git a/2022-2023/main-bot/src/main/java/frc/settings/LimitedMotorSettings.java b/2022-2023/main-bot/src/main/java/frc/settings/LimitedMotorSettings.java
deleted file mode 100755
index fe28273..0000000
--- a/2022-2023/main-bot/src/main/java/frc/settings/LimitedMotorSettings.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package frc.settings;
-
-public class LimitedMotorSettings {
-
- public int motorID;
-
- public double[] limits;
-}
diff --git a/2022-2023/main-bot/src/main/java/frc/settings/Settings.java b/2022-2023/main-bot/src/main/java/frc/settings/Settings.java
deleted file mode 100755
index c5f3e73..0000000
--- a/2022-2023/main-bot/src/main/java/frc/settings/Settings.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package frc.settings;
-
-public class Settings {
-
- public SwerveDriveSettings swerveDrive;
- public ClawSettings clawSettings;
- public ArmSettings armSettings;
-
- public int controllerID;
- public int auxControllerID;
-}
diff --git a/2022-2023/main-bot/src/main/java/frc/settings/SwerveDriveSettings.java b/2022-2023/main-bot/src/main/java/frc/settings/SwerveDriveSettings.java
deleted file mode 100755
index 298a4de..0000000
--- a/2022-2023/main-bot/src/main/java/frc/settings/SwerveDriveSettings.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package frc.settings;
-
-public class SwerveDriveSettings {
-
- public SwerveWheelSettings FLSwerve;
- public SwerveWheelSettings FRSwerve;
- public SwerveWheelSettings BLSwerve;
- public SwerveWheelSettings BRSwerve;
-}
diff --git a/2022-2023/main-bot/src/main/java/frc/settings/SwerveWheelSettings.java b/2022-2023/main-bot/src/main/java/frc/settings/SwerveWheelSettings.java
deleted file mode 100755
index 3cc9110..0000000
--- a/2022-2023/main-bot/src/main/java/frc/settings/SwerveWheelSettings.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package frc.settings;
-
-public class SwerveWheelSettings {
-
- public int driveID;
- public int turnID;
- public int encoderID;
-
- public enum Location {
- front,
- back
- }
-
- public Location location;
-
- public double defensiveAngle;
-
- public double posX;
- public double posY;
-}
\ No newline at end of file
diff --git a/2022-2023/main-bot/src/main/java/frc/settings/WristSettings.java b/2022-2023/main-bot/src/main/java/frc/settings/WristSettings.java
deleted file mode 100755
index 3d99e4d..0000000
--- a/2022-2023/main-bot/src/main/java/frc/settings/WristSettings.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package frc.settings;
-
-public class WristSettings {
-
- public int wristMotorId;
- public double wristMotorPower;
- public double wristEncoderOffset;
-
- public int[] wristLimits;
-
-}
diff --git a/2022-2023/main-bot/src/main/java/frc/state_machine/State.java b/2022-2023/main-bot/src/main/java/frc/state_machine/State.java
deleted file mode 100755
index f0764f3..0000000
--- a/2022-2023/main-bot/src/main/java/frc/state_machine/State.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package frc.state_machine;
-
-public abstract class State {
-
- public void onEnter() {
- }
-
- public void onExit() {
- }
-
- public boolean isValid() {
- return true;
- }
-
- // Returns 'true' when state is finished
- public abstract boolean run();
-}
diff --git a/2022-2023/main-bot/src/main/java/frc/state_machine/StateMachine.java b/2022-2023/main-bot/src/main/java/frc/state_machine/StateMachine.java
deleted file mode 100755
index 83f8364..0000000
--- a/2022-2023/main-bot/src/main/java/frc/state_machine/StateMachine.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package frc.state_machine;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class StateMachine {
-
- State m_currentState;
- List
-* This is used to store data that needs to be accessed by multiple classes.
-*
- * 60 is used to convert from minutes to seconds.
- *
- * 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.
- *
- * 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.
- *
- * This state drives the robot forward at 35% speed for 3 seconds - *
- */ -public final class DriveState1 extends State { - - /** - * The forward speed of the robot. - */ - private static final double FORWARD_SPEED = 0.35; - - /** - * The time the robot drives forward. - */ - private static final int DRIVE_TIME = 3; - - /** - * Timer object. - */ - private Timer timer; - - @Override - public void onEnter() { - // Mainly used for debugging - System.out.println("Drive State 1 entered"); - } - - @Override - public void onExit() { - // Mainly used for debugging - System.out.println("Drive State 1 exited"); - } - - @Override - public boolean run() { - - // Set the values so it drives forward at a speed of 35% in reverse - CommonData.setForwardSpeed(-FORWARD_SPEED); - CommonData.setDesiredTurn(0); - - // Set a new timer if one doesn't exist already - if (timer == null) { - timer = new Timer(); - timer.start(); - // If the timer has elapses 3 seconds, exit the state - } else if (timer.hasElapsed(DRIVE_TIME)) { - return true; - } - - return false; - } -} diff --git a/2023-2024/main-bot/src/main/java/frc/components/autonomous/package-info.java b/2023-2024/main-bot/src/main/java/frc/components/autonomous/package-info.java deleted file mode 100644 index 8fa5a28..0000000 --- a/2023-2024/main-bot/src/main/java/frc/components/autonomous/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Contains classes that are used to run autonomous. - */ -package frc.components.autonomous; diff --git a/2023-2024/main-bot/src/main/java/frc/components/package-info.java b/2023-2024/main-bot/src/main/java/frc/components/package-info.java deleted file mode 100644 index 74893cd..0000000 --- a/2023-2024/main-bot/src/main/java/frc/components/package-info.java +++ /dev/null @@ -1,7 +0,0 @@ -/** - * 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/2023-2024/main-bot/src/main/java/frc/controllers/LogitechF310.java b/2023-2024/main-bot/src/main/java/frc/controllers/LogitechF310.java deleted file mode 100755 index 74a8997..0000000 --- a/2023-2024/main-bot/src/main/java/frc/controllers/LogitechF310.java +++ /dev/null @@ -1,463 +0,0 @@ -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/2023-2024/main-bot/src/main/java/frc/controllers/PS4.java b/2023-2024/main-bot/src/main/java/frc/controllers/PS4.java deleted file mode 100644 index cef2652..0000000 --- a/2023-2024/main-bot/src/main/java/frc/controllers/PS4.java +++ /dev/null @@ -1,498 +0,0 @@ -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/2023-2024/main-bot/src/main/java/frc/controllers/Xbox.java b/2023-2024/main-bot/src/main/java/frc/controllers/Xbox.java deleted file mode 100644 index c8cc131..0000000 --- a/2023-2024/main-bot/src/main/java/frc/controllers/Xbox.java +++ /dev/null @@ -1,425 +0,0 @@ -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/2023-2024/main-bot/src/main/java/frc/controllers/package-info.java b/2023-2024/main-bot/src/main/java/frc/controllers/package-info.java deleted file mode 100644 index 80793a8..0000000 --- a/2023-2024/main-bot/src/main/java/frc/controllers/package-info.java +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Holds controller classes - *- * This can be used to hold both custom and pre-made controller classes. - *
- */ -package frc.controllers; diff --git a/2023-2024/main-bot/src/main/java/frc/package-info.java b/2023-2024/main-bot/src/main/java/frc/package-info.java deleted file mode 100644 index 36e2dec..0000000 --- a/2023-2024/main-bot/src/main/java/frc/package-info.java +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Main package for robot code. - *- * All code that is deployed to the robot would be located under this package. - *
- */ -package frc; diff --git a/2023-2024/main-bot/src/main/java/frc/robot/Robot.java b/2023-2024/main-bot/src/main/java/frc/robot/Robot.java deleted file mode 100644 index a48cbab..0000000 --- a/2023-2024/main-bot/src/main/java/frc/robot/Robot.java +++ /dev/null @@ -1,176 +0,0 @@ -// 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 java.io.IOException; -import com.fasterxml.jackson.databind.ObjectMapper; -import edu.wpi.first.wpilibj.Filesystem; -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.Xbox; -import frc.controllers.PS4; -import edu.wpi.first.wpilibj.GenericHID.RumbleType; -import frc.settings.Settings; - -/** -* 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.getControllerID(), 0); - /** - * 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.getAuxControllerID(), 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.getSwerveDriveSettings()) - }; - - /** - * The autonomous object. - */ - private Autonomous autonomous; - - @Override - public void robotInit() { - } - - @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(); - // Calibrate the gyro before autonomous to ensure that it is accurate - CommonData.setCalibrate(true); - } - - @Override - public void autonomousPeriodic() { - // Update the autonomous states - autonomous.update(); - } - - @Override - public void teleopInit() { - } - - @Override - public void teleopPeriodic() { - - // Update the controller values // - - // Update values for the Swerve Drive - CommonData.setBattenDownTheHatches(controller.getXButton()); - CommonData.setSideSpeed(controller.getLeftX()); - CommonData.setForwardSpeed(controller.getLeftY()); - CommonData.setDesiredTurn(Utility.snapToEdge(-controller.getRightX(), -1, 1, 0.9)); - } - - @Override - public void disabledInit() { - - // "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() { - } - - @Override - public void testPeriodic() { - } - - @Override - public void simulationInit() { - } - - @Override - public void simulationPeriodic() { - } -} diff --git a/2023-2024/main-bot/src/main/java/frc/robot/Utility.java b/2023-2024/main-bot/src/main/java/frc/robot/Utility.java deleted file mode 100755 index 24e4f9b..0000000 --- a/2023-2024/main-bot/src/main/java/frc/robot/Utility.java +++ /dev/null @@ -1,88 +0,0 @@ -package frc.robot; - -/** - * 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; - } -} diff --git a/2023-2024/main-bot/src/main/java/frc/robot/package-info.java b/2023-2024/main-bot/src/main/java/frc/robot/package-info.java deleted file mode 100644 index 20c110b..0000000 --- a/2023-2024/main-bot/src/main/java/frc/robot/package-info.java +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Holds primary robot methods - *- * This package is automatically created when creating a new robot project. - *
- */ -package frc.robot; diff --git a/2023-2024/main-bot/src/main/java/frc/settings/Settings.java b/2023-2024/main-bot/src/main/java/frc/settings/Settings.java deleted file mode 100755 index b7ddb3e..0000000 --- a/2023-2024/main-bot/src/main/java/frc/settings/Settings.java +++ /dev/null @@ -1,77 +0,0 @@ -package frc.settings; - -/** - * The settings object. - *- * This is used to store the settings from the robot_settings.json file. - *
- */ -public class Settings { - - /** - * The swerve drive settings. - */ - private SwerveDriveSettings swerveDrive; - - // These might change to be more dynamic if possible - - /** - * The controller ID. - */ - private int controllerID; - - /** - * The auxiliary controller ID. - */ - private int auxControllerID; - - // Accessor Methods // - - /** - * Get the swerve drive settings. - * @return The swerve drive settings. - */ - public SwerveDriveSettings getSwerveDriveSettings() { - return swerveDrive; - } - - /** - * Set the swerve drive settings. - * @param settings The swerve drive settings. - */ - public void setSwerveDriveSettings(final SwerveDriveSettings settings) { - swerveDrive = settings; - } - - /** - * Get the controller ID. - * @return The controller ID. - */ - public int getControllerID() { - return controllerID; - } - - /** - * Set the controller ID. - * @param id The controller ID. - */ - public void setControllerID(final int id) { - controllerID = id; - } - - /** - * Get the auxiliary controller ID. - * @return The auxiliary controller ID. - */ - public int getAuxControllerID() { - return auxControllerID; - } - - /** - * Set the auxiliary controller ID. - * @param id The auxiliary controller ID. - */ - public void setAuxControllerID(final int id) { - auxControllerID = id; - } -} diff --git a/2023-2024/main-bot/src/main/java/frc/settings/SwerveDriveSettings.java b/2023-2024/main-bot/src/main/java/frc/settings/SwerveDriveSettings.java deleted file mode 100755 index db1dfb4..0000000 --- a/2023-2024/main-bot/src/main/java/frc/settings/SwerveDriveSettings.java +++ /dev/null @@ -1,116 +0,0 @@ -package frc.settings; - -/** - * The swerve drive settings. - *- * This is used to store the settings for the swerve drive. - * Each wheel has its own settings located in the {@link SwerveWheelSettings} - * class. - */ -public class SwerveDriveSettings { - - // NOTE: In this change from public to private, the way we currently read - // the settings file might be broken. This is because it relies on - // the fields being public as it has to be able to access them. These - // values have to be the same as what is in the JSON file. Since they - // are now private and have accessors, we might have to change the - // way we read these values. An alternative might be to use the - // SimpleJSON library instead of the Jackson library as it might - // allow us to access the fields without them being public. - // This needs further testing. - // - // - Jay - - /** - * The swerve wheel settings for the front left wheel. - */ - private SwerveWheelSettings flSwerve; - - /** - * The swerve wheel settings for the front right wheel. - */ - private SwerveWheelSettings frSwerve; - - /** - * The swerve wheel settings for the back left wheel. - */ - private SwerveWheelSettings blSwerve; - - /** - * The swerve wheel settings for the back right wheel. - */ - private SwerveWheelSettings brSwerve; - - // Accessor Methods // - - /** - * Get the swerve wheel settings for the front left wheel. - * @return The swerve wheel settings for the front left wheel. - */ - public SwerveWheelSettings getFLSwerveSettings() { - return flSwerve; - } - - /** - * Set the swerve wheel settings for the front left wheel. - * - * @param settings The swerve wheel settings for the front left wheel. - */ - public void setFLSwerveSettings(final SwerveWheelSettings settings) { - flSwerve = settings; - } - - /** - * Get the swerve wheel settings for the front right wheel. - * - * @return The swerve wheel settings for the front right wheel. - */ - public SwerveWheelSettings getFRSwerveSettings() { - return frSwerve; - } - - /** - * Set the swerve wheel settings for the front right wheel. - * - * @param settings The swerve wheel settings for the front right wheel. - */ - public void setFRSwerveSettings(final SwerveWheelSettings settings) { - frSwerve = settings; - } - - /** - * Get the swerve wheel settings for the back left wheel. - * - * @return The swerve wheel settings for the back left wheel. - */ - public SwerveWheelSettings getBLSwerveSettings() { - return blSwerve; - } - - /** - * Set the swerve wheel settings for the back left wheel. - * - * @param settings The swerve wheel settings for the back left wheel. - */ - public void setBLSwerveSettings(final SwerveWheelSettings settings) { - blSwerve = settings; - } - - /** - * Get the swerve wheel settings for the back right wheel. - * - * @return The swerve wheel settings for the back right wheel. - */ - public SwerveWheelSettings getBRSwerveSettings() { - return brSwerve; - } - - /** - * Set the swerve wheel settings for the back right wheel. - * - * @param settings The swerve wheel settings for the back right wheel. - */ - public void setBRSwerveSettings(final SwerveWheelSettings settings) { - brSwerve = settings; - } -} diff --git a/2023-2024/main-bot/src/main/java/frc/settings/SwerveWheelSettings.java b/2023-2024/main-bot/src/main/java/frc/settings/SwerveWheelSettings.java deleted file mode 100755 index 6a21874..0000000 --- a/2023-2024/main-bot/src/main/java/frc/settings/SwerveWheelSettings.java +++ /dev/null @@ -1,187 +0,0 @@ -package frc.settings; - -/** - * The swerve wheel settings. - *
- * This is used to store the settings for each swerve wheel. - *
- */ -public class SwerveWheelSettings { - - /** - * The drive motor ID. - */ - private int driveID; - - /** - * The turn motor ID. - */ - private int turnID; - - /** - * The encoder ID. - */ - private int encoderID; - - public enum Location { - /** - * Front of the robot. - */ - front, - - /** - * Back of the robot. - */ - back - } - - /** - * The location of the swerve wheel. - */ - private Location location; - - /** - * The angle of the swerve wheel to be in during defensive mode. - */ - private double defensiveAngle; - - /** - * The location of the swerve wheel in relation to the center of the robot. - * This is the X position. - */ - private double posX; - - /** - * The location of the swerve wheel in relation to the center of the robot. - * This is the Y position. - */ - private double posY; - - // Accessor Methods // - - /** - * Get the drive motor ID. - * - * @return The drive motor ID. - */ - public int getDriveID() { - return driveID; - } - - /** - * Set the drive motor ID. - * - * @param id The drive motor ID. - */ - public void setDriveID(final int id) { - driveID = id; - } - - /** - * Get the turn motor ID. - * - * @return The turn motor ID. - */ - public int getTurnID() { - return turnID; - } - - /** - * Set the turn motor ID. - * - * @param id The turn motor ID. - */ - public void setTurnID(final int id) { - turnID = id; - } - - /** - * Get the encoder ID. - * - * @return The encoder ID. - */ - public int getEncoderID() { - return encoderID; - } - - /** - * Set the encoder ID. - * - * @param id The encoder ID. - */ - public void setEncoderID(final int id) { - encoderID = id; - } - - /** - * Get the location of the swerve wheel. - * - * @return The location of the swerve wheel. - */ - public Location getLocation() { - return location; - } - - /** - * Set the location of the swerve wheel. - * - * @param loc The location of the swerve wheel. - */ - public void setLocation(final Location loc) { - location = loc; - } - - /** - * Get the angle of the swerve wheel to be in during defensive mode. - * - * @return The angle of the swerve wheel to be in during defensive mode. - */ - public double getDefensiveAngle() { - return defensiveAngle; - } - - /** - * Set the angle of the swerve wheel to be in during defensive mode. - * - * @param angle The angle of the swerve wheel - */ - public void setDefensiveAngle(final double angle) { - defensiveAngle = angle; - } - - /** - * Get the location of the swerve wheel. - * - * @return The location of the swerve wheel on the X axis. - */ - public double getPosX() { - return posX; - } - - /** - * Set the location of the swerve wheel. - * - * @param x The location of the swerve wheel on the X axis. - */ - public void setPosX(final double x) { - posX = x; - } - - /** - * Get the location of the swerve wheel. - * - * @return The location of the swerve wheel on the Y axis. - */ - public double getPosY() { - return posY; - } - - /** - * Set the location of the swerve wheel. - * - * @param y The location of the swerve wheel on the Y axis. - */ - public void setPosY(final double y) { - posY = y; - } -} diff --git a/2023-2024/main-bot/src/main/java/frc/settings/package-info.java b/2023-2024/main-bot/src/main/java/frc/settings/package-info.java deleted file mode 100644 index 353657d..0000000 --- a/2023-2024/main-bot/src/main/java/frc/settings/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Holds settings for the robot. - *- * These settings are gathered from the settings.json - * file located in the deploy directory. - *
- */ -package frc.settings; diff --git a/2023-2024/main-bot/src/main/java/frc/state_machine/State.java b/2023-2024/main-bot/src/main/java/frc/state_machine/State.java deleted file mode 100755 index d2450f0..0000000 --- a/2023-2024/main-bot/src/main/java/frc/state_machine/State.java +++ /dev/null @@ -1,37 +0,0 @@ -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/2023-2024/main-bot/src/main/java/frc/state_machine/StateMachine.java b/2023-2024/main-bot/src/main/java/frc/state_machine/StateMachine.java deleted file mode 100755 index 3d9e73f..0000000 --- a/2023-2024/main-bot/src/main/java/frc/state_machine/StateMachine.java +++ /dev/null @@ -1,52 +0,0 @@ -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/2023-2024/main-bot/vendordeps/NavX.json b/2023-2024/main-bot/vendordeps/NavX.json deleted file mode 100644 index e978a5f..0000000 --- a/2023-2024/main-bot/vendordeps/NavX.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "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/2023-2024/main-bot/vendordeps/WPILibNewCommands.json b/2023-2024/main-bot/vendordeps/WPILibNewCommands.json deleted file mode 100644 index 67bf389..0000000 --- a/2023-2024/main-bot/vendordeps/WPILibNewCommands.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "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/Example_Project/.gitignore b/Example_Project/.gitignore deleted file mode 100644 index 3325f5c..0000000 --- a/Example_Project/.gitignore +++ /dev/null @@ -1,172 +0,0 @@ -# This gitignore has been specially created by the WPILib team. -# If you remove items from this file, intellisense might break. - -### C++ ### -# Prerequisites -*.d - -# Compiled Object files -*.slo -*.lo -*.o -*.obj - -# Precompiled Headers -*.gch -*.pch - -# Compiled Dynamic libraries -*.so -*.dylib -*.dll - -# Fortran module files -*.mod -*.smod - -# Compiled Static libraries -*.lai -*.la -*.a -*.lib - -# Executables -*.exe -*.out -*.app - -### 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* - -### Linux ### -*~ - -# temporary files which can be created if a process still has a handle open of a deleted file -.fuse_hidden* - -# KDE directory preferences -.directory - -# Linux trash folder which might appear on any partition or disk -.Trash-* - -# .nfs files are created when an open file is removed but is still being accessed -.nfs* - -### macOS ### -# General -.DS_Store -.AppleDouble -.LSOverride - -# Icon must end with two \r -Icon - -# Thumbnails -._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns -.com.apple.timemachine.donotpresent - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk - -### VisualStudioCode ### -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json - -### Windows ### -# Windows thumbnail cache files -Thumbs.db -ehthumbs.db -ehthumbs_vista.db - -# Dump file -*.stackdump - -# Folder config file -[Dd]esktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msix -*.msm -*.msp - -# Windows shortcuts -*.lnk - -### Gradle ### -.gradle -/build/ - -# Ignore Gradle GUI config -gradle-app.setting - -# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) -!gradle-wrapper.jar - -# Cache of project -.gradletasknamecache - -# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 -# gradle/wrapper/gradle-wrapper.properties - -# # VS Code Specific Java Settings -# DO NOT REMOVE .classpath and .project -.classpath -.project -.settings/ -bin/ - -# IntelliJ -*.iml -*.ipr -*.iws -.idea/ -out/ - -# Fleet -.fleet - -# Simulation GUI and other tools window save file -*-window.json diff --git a/Example_Project/.wpilib/wpilib_preferences.json b/Example_Project/.wpilib/wpilib_preferences.json deleted file mode 100644 index 4062463..0000000 --- a/Example_Project/.wpilib/wpilib_preferences.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "enableCppIntellisense": false, - "currentLanguage": "java", - "projectYear": "2023", - "teamNumber": 5098 -} \ No newline at end of file diff --git a/Example_Project/WPILib-License.md b/Example_Project/WPILib-License.md deleted file mode 100644 index 064ccbe..0000000 --- a/Example_Project/WPILib-License.md +++ /dev/null @@ -1,26 +0,0 @@ -# WPILib License - -Copyright (c) 2009-2021 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/Example_Project/build.gradle b/Example_Project/build.gradle deleted file mode 100644 index 5487988..0000000 --- a/Example_Project/build.gradle +++ /dev/null @@ -1,101 +0,0 @@ -plugins { - id "java" - id "edu.wpi.first.GradleRIO" version "2023.4.3" -} - -sourceCompatibility = JavaVersion.VERSION_11 -targetCompatibility = JavaVersion.VERSION_11 - -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-api:5.8.2' - testImplementation 'org.junit.jupiter:junit-jupiter-params:5.8.2' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2' - - implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.2' -} - -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) } } - 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/Example_Project/gradle/wrapper/gradle-wrapper.jar b/Example_Project/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 249e583..0000000 Binary files a/Example_Project/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/Example_Project/gradle/wrapper/gradle-wrapper.properties b/Example_Project/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 7414769..0000000 --- a/Example_Project/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=permwrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=permwrapper/dists diff --git a/Example_Project/gradlew b/Example_Project/gradlew deleted file mode 100755 index a69d9cb..0000000 --- a/Example_Project/gradlew +++ /dev/null @@ -1,240 +0,0 @@ -#!/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/master/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 - -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" -APP_BASE_NAME=${0##*/} - -# 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"' - -# 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 - which java >/dev/null 2>&1 || 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 - -# Increase the maximum file descriptors if we can. -if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then - case $MAX_FD in #( - max*) - MAX_FD=$( ulimit -H -n ) || - warn "Could not query maximum file descriptor limit" - esac - case $MAX_FD in #( - '' | soft) :;; #( - *) - 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 - -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. - -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/Example_Project/gradlew.bat b/Example_Project/gradlew.bat deleted file mode 100644 index 53a6b23..0000000 --- a/Example_Project/gradlew.bat +++ /dev/null @@ -1,91 +0,0 @@ -@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=. -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/Example_Project/settings.gradle b/Example_Project/settings.gradle deleted file mode 100644 index ae1af1c..0000000 --- a/Example_Project/settings.gradle +++ /dev/null @@ -1,27 +0,0 @@ -import org.gradle.internal.os.OperatingSystem - -pluginManagement { - repositories { - mavenLocal() - gradlePluginPortal() - String frcYear = '2023' - File frcHome - if (OperatingSystem.current().isWindows()) { - String publicFolder = System.getenv('PUBLIC') - if (publicFolder == null) { - publicFolder = "C:\\Users\\Public" - } - def homeRoot = new File(publicFolder, "wpilib") - frcHome = new File(homeRoot, frcYear) - } else { - def userFolder = System.getProperty("user.home") - def homeRoot = new File(userFolder, "wpilib") - frcHome = new File(homeRoot, frcYear) - } - def frcHomeMaven = new File(frcHome, 'maven') - maven { - name 'frcHome' - url frcHomeMaven - } - } -} diff --git a/Example_Project/src/main/deploy/README.md b/Example_Project/src/main/deploy/README.md deleted file mode 100644 index 1f23064..0000000 --- a/Example_Project/src/main/deploy/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# Deploy Directory - -> Copied from 'example.txt' - -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. - -## Current Files - -The file `robot_settings.json` is stored in this directory as we need to read the settings from it, and so it needs to be deployed to the robot. -The `robot_settings.json` file works hand in hand with the `frc/settings` directory. Anything in the `robot_settings.json` file must also be in the `Settings.java` file as a type decleration for the setting to be pulled. -This is because of how we implemeted the library to read the json file. -In Python this would be done with the `json` module however Java has no library equivilant so it needs to be used differently. The settings are read and used in the `Robot.java` file. \ No newline at end of file diff --git a/Example_Project/src/main/deploy/robot_settings.json b/Example_Project/src/main/deploy/robot_settings.json deleted file mode 100755 index ad32576..0000000 --- a/Example_Project/src/main/deploy/robot_settings.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "controllerID": 0, - "auxControllerID": 1, - "pneumaticSettings" : { - "pneumaticID": 0, - "largeSolenoidForwardChannelID": 0, - "largeSolenoidReverseChannelID": 1, - "smallSolenoidForwardChannelID": 2, - "smallSolenoidReverseChannelID": 3 - }, - "NavXSettings": { - "navXID": 0, - "navXPort": "kMXP", - "navXUpdateRate": 50 - }, - "ShuffleBoardSettings": { - "shuffleBoardPort": 5800 - } -} \ No newline at end of file diff --git a/Example_Project/src/main/java/frc/CommonData.java b/Example_Project/src/main/java/frc/CommonData.java deleted file mode 100644 index e084fa0..0000000 --- a/Example_Project/src/main/java/frc/CommonData.java +++ /dev/null @@ -1,27 +0,0 @@ -package frc; - -import frc.components.Pneumatics; - -/** - * This is mainly for storing varaiables that are accessed by multiple classes that write and read to the same variable - * This is useful for storing things like a position of a motor, the location of a sensor, or a constant value - * This is also used as a means of organization - */ - -// import frc.components.Pneumatics.State; - -public class CommonData { - - // Pneumatics states - public static Pneumatics.State largeSolenoidState; - public static Pneumatics.State smallSolenoidState; - - // Gyro data from the NavX2 - public static double robotPitch; - public static double robotRoll; - public static double robotYaw; - - // Encoder data from the Spark Max and CANCoder - public static double canCoderPosition; - public static double sparkMaxEncoderPosition; -} diff --git a/Example_Project/src/main/java/frc/components/IComponent.java b/Example_Project/src/main/java/frc/components/IComponent.java deleted file mode 100644 index cb691b4..0000000 --- a/Example_Project/src/main/java/frc/components/IComponent.java +++ /dev/null @@ -1,14 +0,0 @@ -package frc.components; - -public interface IComponent { - - /** - * This is the interface for all components in this directory. - * It contains the update method that is called every 20 milliseconds during the robot's operation. - * This method is used to update the component with new data. - * - * It is called in the Robot.java file in the periodic() method. - */ - - public void update(); -} \ No newline at end of file diff --git a/Example_Project/src/main/java/frc/components/Pneumatics.java b/Example_Project/src/main/java/frc/components/Pneumatics.java deleted file mode 100644 index d2bbf18..0000000 --- a/Example_Project/src/main/java/frc/components/Pneumatics.java +++ /dev/null @@ -1,53 +0,0 @@ -package frc.components; - -// Imports // -import edu.wpi.first.wpilibj.DoubleSolenoid; -import edu.wpi.first.wpilibj.DoubleSolenoid.Value; -import edu.wpi.first.wpilibj.PneumaticsModuleType; -import frc.CommonData; -import frc.settings.PneumaticsSettings; - -public class Pneumatics implements IComponent{ - - // Create an enum for the states of the solenoids - public enum State { - kOpen, - kClosed, - } - - // Create a new solenoid object - private DoubleSolenoid m_solenoidLarge; - private DoubleSolenoid m_solenoidSmall; - - public Pneumatics(PneumaticsSettings settings) { - // Set the settings for the solenoids using the settings in PneumaticsSettings.java - m_solenoidLarge = new DoubleSolenoid(settings.pneumaticsModuleID, PneumaticsModuleType.REVPH, settings.largeSolenoidForwardChannelID, settings.largeSolenoidReverseChannelID); - m_solenoidSmall = new DoubleSolenoid(settings.pneumaticsModuleID, PneumaticsModuleType.REVPH, settings.smallSolenoidForwardChannelID, settings.smallSolenoidReverseChannelID); - }; - - public void update(){ - - // Note: This assumes that the CommonData values are updated elsewhere - - // Update the solenoid state for the small solenoid - switch (CommonData.smallSolenoidState) - { - case kOpen: - m_solenoidSmall.set(Value.kForward); - break; - case kClosed: - m_solenoidSmall.set(Value.kReverse); - } - - // Update the solenoid state for the large solenoid - switch (CommonData.largeSolenoidState) - { - case kOpen: - m_solenoidLarge.set(Value.kForward); - break; - case kClosed: - m_solenoidLarge.set(Value.kReverse); - } - } -} - diff --git a/Example_Project/src/main/java/frc/components/ShuffleBoardController.java b/Example_Project/src/main/java/frc/components/ShuffleBoardController.java deleted file mode 100644 index 3e77d16..0000000 --- a/Example_Project/src/main/java/frc/components/ShuffleBoardController.java +++ /dev/null @@ -1,20 +0,0 @@ -package frc.components; - -// Local Imports -import frc.settings.ShuffleBoardSettings; -import frc.CommonData; - -public class ShuffleBoardController implements IComponent{ - // This is the ShuffleBoard Class. It contains methods and functions that are used to display data on the ShuffleBoard. - - - public ShuffleBoardController(ShuffleBoardSettings settings) { - // This is the ShuffleBoardSettings object. It contains all of the settings for the ShuffleBoard. - // It is initialized in the Settings.java file. - }; - - public void update(){ - // Place any Shuffleboard values here - } - -} diff --git a/Example_Project/src/main/java/frc/controllers/LogitechAttack3.java b/Example_Project/src/main/java/frc/controllers/LogitechAttack3.java deleted file mode 100755 index 3e220ed..0000000 --- a/Example_Project/src/main/java/frc/controllers/LogitechAttack3.java +++ /dev/null @@ -1,90 +0,0 @@ -package frc.controllers; - -import edu.wpi.first.wpilibj.Joystick; - -// Imported From Code/2022/stingr/main-bot - -public class LogitechAttack3 -{ - private final Joystick controller; - - // These are the button and axis IDs for the Logitech F310 controller. - // They are constants because they will never change. - // They always start with a k as a naming convention. - private final int kXAxis = 0; - private final int kYAxis = 1; - private final int kSlider = 2; - private final int kTrigger = 1; - private final int kButton2 = 2; - private final int kButton3 = 3; - private final int kButton4 = 4; - private final int kButton5 = 5; - private final int kButton6 = 6; - private final int kButton7 = 7; - private final int kButton8 = 8; - private final int kButton9 = 9; - private final int kButton10 = 10; - private final int kButton11 = 11; - - public double getX() - { - return controller.getRawAxis(kXAxis); - } - public double getY() - { - return controller.getRawAxis(kYAxis); - } - public double getSlider() - { - return controller.getRawAxis(kSlider); - } - public boolean getTrigger() - { - return controller.getRawButton(kTrigger); - } - public boolean getButton2() - { - return controller.getRawButton(kButton2); - } - public boolean getButton3() - { - return controller.getRawButton(kButton3); - } - public boolean getButton4() - { - return controller.getRawButton(kButton4); - } - public boolean getButton5() - { - return controller.getRawButton(kButton5); - } - public boolean getButton6() - { - return controller.getRawButton(kButton6); - } - public boolean getButton7() - { - return controller.getRawButton(kButton7); - } - public boolean getButton8() - { - return controller.getRawButton(kButton8); - } - public boolean getButton9() - { - return controller.getRawButton(kButton9); - } - public boolean getButton10() - { - return controller.getRawButton(kButton10); - } - public boolean getButton11() - { - return controller.getRawButton(kButton11); - } - - public LogitechAttack3(int controllerPort) - { - controller = new Joystick(controllerPort); - } -} \ No newline at end of file diff --git a/Example_Project/src/main/java/frc/controllers/LogitechF310.java b/Example_Project/src/main/java/frc/controllers/LogitechF310.java deleted file mode 100755 index 6e47c08..0000000 --- a/Example_Project/src/main/java/frc/controllers/LogitechF310.java +++ /dev/null @@ -1,184 +0,0 @@ -package frc.controllers; - -import edu.wpi.first.wpilibj.Joystick; -import java.lang.Math; - -// Imported From Code/2022/stingr/main-bot -// Note: This is modified from the original code to add deadbanding - -public class LogitechF310 -{ - - // These are the button and axis IDs for the Logitech F310 controller. - // They are constants because they will never change. - // They always start with a k as a naming convention. - private final int kIdButtonA = 1; - private final int kIdButtonB = 2; - private final int kIdButtonX = 3; - private final int kIdButtonY = 4; - private final int kIdButtonBumperLeft = 5; - private final int kIdButtonBumperRight = 6; - private final int kIdAxisleftX = 0; - private final int kIdAxisleftY = 1; - private final int kIdAxisrightX = 4; - private final int kIdAxisrightY = 5; - private final int kIdlefttrigger = 2; - private final int kIdrighttrigger = 3; - private final int kIdDpad = 0; - - private Joystick controller; - - public double deadBand(double value) - { - return Math.abs(value) < 0.2 ? 0 : value; - } - - public LogitechF310(int id) - { - controller = new Joystick(id); - } - - public boolean getA() - { - return controller.getRawButton(kIdButtonA); - } - - public boolean getB() - { - return controller.getRawButton(kIdButtonB); - } - - public boolean getX() - { - return controller.getRawButton(kIdButtonX); - } - - public boolean getY() - { - return controller.getRawButton(kIdButtonY); - } - - public boolean getLeftBumper() - { - return controller.getRawButton(kIdButtonBumperLeft); - } - - public boolean getRightBumper() - { - return controller.getRawButton(kIdButtonBumperRight); - } - - public double getLeftStickX() - { - return deadBand(controller.getRawAxis(kIdAxisleftX)); - } - - public double getLeftStickY() - { - return deadBand(controller.getRawAxis(kIdAxisleftY)); - } - - public double getRightStickX() - { - return deadBand(controller.getRawAxis(kIdAxisrightX)); - } - - public double getRightStickY() - { - return deadBand(controller.getRawAxis(kIdAxisrightY)); - } - - public double getLeftTrigger() - { - return controller.getRawAxis(kIdlefttrigger); - } - - public double getRightTrigger() - { - return controller.getRawAxis(kIdrighttrigger); - } - - public boolean getDUp() - { - int degrees = controller.getPOV(kIdDpad); - if (degrees == 315) - { - return true; - } - - if (degrees == 0) - { - return true; - } - - if (degrees == 45) - { - return true; - } - - return false; - } - - public boolean getDRight() - { - int degrees = controller.getPOV(kIdDpad); - if (degrees == 45) - { - return true; - } - - if (degrees == 90) - { - return true; - } - - if (degrees == 135) - { - return true; - } - - return false; - } - - public boolean getDDown() - { - int degrees = controller.getPOV(kIdDpad); - if (degrees == 135) - { - return true; - } - - if (degrees == 180) - { - return true; - } - - if (degrees == 225) - { - return true; - } - - return false; - } - - public boolean getDLeft() - { - int degrees = controller.getPOV(kIdDpad); - if (degrees == 225) - { - return true; - } - - if (degrees == 270) - { - return true; - } - - if (degrees == 315) - { - return true; - } - - return false; - } -} \ No newline at end of file diff --git a/Example_Project/src/main/java/frc/controllers/README.md b/Example_Project/src/main/java/frc/controllers/README.md deleted file mode 100644 index b02e836..0000000 --- a/Example_Project/src/main/java/frc/controllers/README.md +++ /dev/null @@ -1,202 +0,0 @@ -# Controllers - -This folder is used to store the controller files that are used to intereact with the controllers we use to control the robot -Altough this folder is not required, it is useful for organization - -There are two main types of controllers that could be used. The standard controller such as an Xbox One, Logitech F310, etc and a joystick controller like the Logitech Attack 3. Both are similar to set up. Same functions and methods, just different IDs - -## Set Up - -There are few different types of inputs on a controller. Axis input for things like joysticks, Button input for standard buttons and POV input for d-pads. - -A few imports are used to set up a controller class: -- `edu.wpi.first.wpilibj.Joystick` - For getting input from the controller (Required) -- `edu.wpi.first.wpilibj.GenericHID.RumbleType` - For controlling rumble if the controller supports it (Optional) -- `java.lang.Math` - For adding a deadband if the controller drifts (Optional) - -**Setting Up The Joystick:** - -The Joystick import is responsible for getting all input from the controller. To set it up, you need to define an ID for that controller. (Which is set in the Driver Station by the order of the controllers. So the top one is ID 0, the second one is ID 1, etc.) - -The code below is used to set an ID for an Xbox360 controller when an Xbox360 instance is created - -> Remember to put the code in your class! - -Ex: -```java -public Xbox360(int ID) - { - joystick = new Joystick(ID); - } -``` - -Now that the joystick is created. It can be used to gather input from the controller. - -**Setting Up Buttons:** - -To take inputs from buttons on the controller you need to use the `joystick.getRawButton(ID)` method. -We can use this method inside of whatever function, in this case getA(), to get the input of the controller -The method will return a boolean so the function will also return a boolean - -> The ID for the getRawButton method will change depending on the button that you are getting. -> If you don't know the ID for the button, you can look online or check in the Driver Station. -> In the Driver Station, go to the controller menu and click on the desired controller. Hit the button you want to ID and look which square lights up. -> The position of the sqaure indicates the ID of the button - -Ex: -```java -public boolean getA() - { - return joystick.getRawButton(1); - } -``` - -You can repeat this for however many buttons you have on your controller, naming the functions accordingly - -**Setting Up Axis Inputs:** - -Setting up inputs for an axis is similar to that of a controller except using the `joystick.getRawAxis(ID)` method. -The method will return a double (from -1 to 1) so the function will also return a double - -> Checking the ID of the axis is almost the same for checking the ID of the buttons. -> Instead of looking at which squares lights up, look at which bar moves up and down when moved - -Ex: -```java -public double getLeftStickX() - { - return joystick.getRawAxis(0); - } -``` - -You can repeat this for each axis you have on your controller, naming the functions accordingly - -**Setting Up A D-Pad:** - -The D-Pad differs greatly from any other method as it uses a POV to get which position it is in. -As such, it needs some extra code to get it working - -```java -public enum dPad { - up, - down, - left, - right, - upright, - upleft, - downright, - downleft, - none - } -``` - -This is an enum that is used for all 9 possible inputs from the D-Pad (including no input). -It is required for the next bit of code that follows it - -```java -public dPad getPad() - { - switch (joystick.getPOV()) - { - case 0: - return dPad.up; - - case 360: - return dPad.up; - - case 90: - return dPad.right; - - case 180: - return dPad.down; - - case 270: - return dPad.left; - - case 45: - return dPad.upright; - - case 135: - return dPad.downright; - - case 225: - return dPad.downleft; - - case 315: - return dPad.upleft; - - default: - return dPad.none; - } - } -``` - -This bit of code uses a switch statement to see which state the D-Pad is in and ouputs the enum value accordingly. -This takes a little more work than a standard button or axis but it simplifies the output greatly - - - -**Rumble Control** - -> Not every controller supports rumble. You can check this if the Driver Station reports two extra sliders for controlling rumble manually -> Note: The Logitech F310 does support rumble but does *not* have the rumble motors -> Note: Setting up rumble for a controller that does not support rumble will not throw an error. It will be ignored when it tries to run - -Since there 2 types of rumble, you need to set up a case for each rumble motor. -This uses the `joystick.setRumble(RumbleType, double)` to use the rumble feature - -> Make sure you import `edu.wpi.first.wpilibj.GenericHID.RumbleType` to use rumble - -Ex: -```java -public void rumbleHigh() // High - { - joystick.setRumble(RumbleType.kRightRumble, 1); - } - -public void rumbleLow() // Low - { - joystick.setRumble(RumbleType.kLeftRumble, 1); - } - -public void letsGetReadyToRumble() // Both - { - joystick.setRumble(RumbleType.kBothRumble, 1); - } - -public void rumbleOff() // Off - { - joystick.setRumble(RumbleType.kBothRumble, 0); - } -``` - -> The values can be a double from 0 to 1. You can set your own values however this example just uses 1 and 0 for on and off - -**Setting Up A Deadband:** - -Setting up a deadband is mainly only used for a controller that has a slight drift to it. This is used to prevent drifting when in use -The deadband uses a custom value that you can change to whatever you may need to fix the drift on your controller with software - -Ex: -```java -public double deadBand(double value) - { - return Math.abs(value) < 0.175 ? 0 : value; - } -``` - -This sets up a deadband function with a deadband of plus or minus 0.175 -This is simplified by using a [ternary operator](https://github.com/J-The-Fox/FRC-Team-5098/wiki/Java-Operators#ternary-operator) - -```java -public double getLeftStickX() - { - return deadBand(joystick.getRawAxis(0)); - } -``` - -This is using the deadband funtion created earlier to add a deadband to this axis - -> The proccess is similar for both the standard controller and the joystick controller. Just make sure all the IDs are set correctly! \ No newline at end of file diff --git a/Example_Project/src/main/java/frc/controllers/Xbox360.java b/Example_Project/src/main/java/frc/controllers/Xbox360.java deleted file mode 100755 index a4bbd19..0000000 --- a/Example_Project/src/main/java/frc/controllers/Xbox360.java +++ /dev/null @@ -1,171 +0,0 @@ -package frc.controllers; - -import edu.wpi.first.wpilibj.GenericHID.RumbleType; -import edu.wpi.first.wpilibj.Joystick; -import java.lang.Math; - -public class Xbox360 -{ - - public Xbox360(int ID) - { - joystick = new Joystick(ID); - } - - Joystick joystick; - - - // Create a deadBand method for the controller as it drifts a little - public double deadBand(double value) - { - return Math.abs(value) < 0.175 ? 0 : value; - } - - public double getLeftStickX() - { - return deadBand(joystick.getRawAxis(0)); - } - - public double getLeftStickY() - { - return deadBand(joystick.getRawAxis(1)); - } - - public double getRightStickX() - { - return deadBand(joystick.getRawAxis(4)); - } - - public double getRightStickY() - { - return deadBand(joystick.getRawAxis(5)); - } - - public boolean getA() - { - return joystick.getRawButton(1); - } - - public boolean getB() - { - return joystick.getRawButton(2); - } - - public boolean getX() - { - return joystick.getRawButton(3); - } - - public boolean getY() - { - return joystick.getRawButton(4); - } - - public boolean getLB() - { - return joystick.getRawButton(5); - } - - public boolean getRB() - { - return joystick.getRawButton(6); - } - - public boolean getBack() - { - return joystick.getRawButton(7); - } - - public boolean getStart() - { - return joystick.getRawButton(8); - } - - public boolean getLeftStick() - { - return joystick.getRawButton(9); - } - - public boolean getRightStick() - { - return joystick.getRawButton(10); - } - - public double getLeftTrigger() - { - return joystick.getRawAxis(2); - } - - public double getRightTrigger() - { - return joystick.getRawAxis(3); - } - - public enum dPad { - up, - down, - left, - right, - upright, - upleft, - downright, - downleft, - none - } - - public dPad getPad() - { - switch (joystick.getPOV()) - { - case 0: - return dPad.up; - - case 360: - return dPad.up; - - case 90: - return dPad.right; - - case 180: - return dPad.down; - - case 270: - return dPad.left; - - case 45: - return dPad.upright; - - case 135: - return dPad.downright; - - case 225: - return dPad.downleft; - - case 315: - return dPad.upleft; - - default: - return dPad.none; - } - } - - public void rumbleHigh() - { - joystick.setRumble(RumbleType.kRightRumble, 1); - } - - public void rumbleLow() - { - joystick.setRumble(RumbleType.kLeftRumble, 1); - } - - public void letsGetReadyToRumble() - { - joystick.setRumble(RumbleType.kBothRumble, 1); - } - - public void rumbleOff() - { - joystick.setRumble(RumbleType.kBothRumble, 0); - } -} \ No newline at end of file diff --git a/Example_Project/src/main/java/frc/robot/Main.java b/Example_Project/src/main/java/frc/robot/Main.java deleted file mode 100644 index 8776e5d..0000000 --- a/Example_Project/src/main/java/frc/robot/Main.java +++ /dev/null @@ -1,25 +0,0 @@ -// 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/Example_Project/src/main/java/frc/robot/Robot.java b/Example_Project/src/main/java/frc/robot/Robot.java
deleted file mode 100644
index b2dc458..0000000
--- a/Example_Project/src/main/java/frc/robot/Robot.java
+++ /dev/null
@@ -1,127 +0,0 @@
-// 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 java.io.IOException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import edu.wpi.first.wpilibj.Filesystem;
-import edu.wpi.first.wpilibj.PneumaticsModuleType;
-import edu.wpi.first.wpilibj.TimedRobot;
-import edu.wpi.first.wpilibj.Compressor;
-import frc.CommonData;
-import frc.components.IComponent;
-import frc.components.ShuffleBoardController;
-import frc.settings.Settings;
-
-/**
- * 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 {
-
- // Read the robot_settings.json file and put it into the settings object.
- public static Settings settings;
- static {
- ObjectMapper mapper = new ObjectMapper();
- // Try to read the robot_settings.json file and put it into the settings object.
- try {
- var filepath = Filesystem.getDeployDirectory().toPath().resolve("robot_settings.json");
- settings = mapper.readValue(filepath.toFile(), Settings.class);
- }
- // If there is an error, print the error to the console.
- catch (IOException ex) {
- System.out.println(ex.toString());
- }
- }
-
- // Create a new compressor object to control the pneumatics.
-
- // This could possible be moved to the Pneumatics.java component.
- // I would like to see if it's possbible to see what types of a pnematic module is currently plugged in.
- // However I am not sure if that is possible. I may look into it in the future.
- Compressor compressor = new Compressor(settings.pneumaticsSettings.pneumaticsModuleID, PneumaticsModuleType.REVPH);
-
- // Create a new IComponent array and add all of the components to it.
- // This is used to call all the update methods in the periodic() method.
- IComponent[] RobotComponents = new IComponent[] {
- new ShuffleBoardController(settings.shuffleBoardSettings),
-
- };
-
- @Override
- public void robotInit() {
- // This is ran when the robot is first turned on. This is where you should add any initialization code.
- }
-
- @Override
- public void robotPeriodic() {
- // This is ran every 20ms while the robot is on. This is where you should add any code that needs to run constantly.
-
- // This calls all the update methods in the RobotComponents array to update all components.
- for (IComponent component : RobotComponents) {
- component.update();
- }
- }
-
- @Override
- public void autonomousInit() {
- // This is ran when the robot is first put into autonomous mode.
- // This is where you should add any code that needs to run when the robot is first put into autonomous mode.
- }
-
- @Override
- public void autonomousPeriodic() {
- // This is ran every 20ms while the robot is in autonomous mode.
-
- for (IComponent component : RobotComponents) {
- component.update();
- }
- }
-
- @Override
- public void teleopInit() {
- // This is ran when the robot is first put into teleop mode.
- // This is where you should add any code that needs to run when the robot is first put into teleop mode.
- }
-
- @Override
- public void teleopPeriodic() {
- // This is ran every 20ms while the robot is in teleop mode.
- }
-
- @Override
- public void disabledInit() {
- // This is ran when the robot is first put into disabled mode.
- }
-
- @Override
- public void disabledPeriodic() {
- // This is ran every 20ms while the robot is in disabled mode.
- }
-
- @Override
- public void testInit() {
- // This is ran when the robot is first put into test mode.
- }
-
- @Override
- public void testPeriodic() {
- // This is ran every 20ms while the robot is in test mode.
- }
-
- @Override
- public void simulationInit() {
- // This is ran when the robot is first put into simulation mode.
- }
-
- @Override
- public void simulationPeriodic() {
- // This is ran every 20ms while the robot is in simulation mode.
- }
-}
diff --git a/Example_Project/src/main/java/frc/robot/Utility.java b/Example_Project/src/main/java/frc/robot/Utility.java
deleted file mode 100755
index 8b6fae1..0000000
--- a/Example_Project/src/main/java/frc/robot/Utility.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package frc.robot;
-
-import java.lang.Math;
-
-public class Utility
-/**
- * This is the Utility Class. It contains methods and functions that don't fit into one specific class.
- * This is where you should add any methods or functions that don't fit into one specific class.
- *
- * The functions and methods in this class were created for the 2022 - 2023 season.
-*/
-{
- static int printCounter = 0;
-
- public static void printLn(String messageString)
- /**
- * This is a method that prints a message to the console every 50 times it is called.
- * It is used to prevent the console from being flooded with messages as well as to prevent log messages being lost due to the connection speed
- */
- {
- if (printCounter == 50)
- {
- System.out.println(messageString);
- printCounter = 0;
- }
- else
- {
- printCounter++;
- // Increment the print counter by 1
- }
- }
-
- public static double sigmoid(double x)
- /**
- * This is a sigmoid functinon. It is used to smooth out values as they approach 1 and 0.
- * It resembles an S shape.
- */
- {
- return 1 / (1 + Math.pow(Math.E, -x));
- }
-
- public static double clamp(double value, double min, double max)
- /**
- * This is a clamp function. It is used to limit a value between a minimum and a maximum.
- * If the value is above the maximum, it will be set to the maximum.
- * If the value is below the minimum, it will be set to the minimum.
- */
- {
- // This is a ternary operator. It is a short way of writing an if statement.
- return value < min ? min : value > max ? max
- : value;
- }
-
- public static double snapToEdge(double value, double min, double max, double threshold)
- {
- if (value < -threshold)
- {
- return min;
- }
- if (value > threshold)
- {
- return max;
- }
- return value;
- }
-}
\ No newline at end of file
diff --git a/Example_Project/src/main/java/frc/settings/NavXSettings.java b/Example_Project/src/main/java/frc/settings/NavXSettings.java
deleted file mode 100644
index dcca5b6..0000000
--- a/Example_Project/src/main/java/frc/settings/NavXSettings.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package frc.settings;
-
-public class NavXSettings {
-
-}
diff --git a/Example_Project/src/main/java/frc/settings/PneumaticsSettings.java b/Example_Project/src/main/java/frc/settings/PneumaticsSettings.java
deleted file mode 100644
index 4fe68b5..0000000
--- a/Example_Project/src/main/java/frc/settings/PneumaticsSettings.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package frc.settings;
-
-public class PneumaticsSettings {
-
- // Pneumatics Control Module IDs
- public int pneumaticsModuleID;
-
- // Solenoid IDs
- public int largeSolenoidForwardChannelID;
- public int largeSolenoidReverseChannelID;
- public int smallSolenoidForwardChannelID;
- public int smallSolenoidReverseChannelID;
-}
diff --git a/Example_Project/src/main/java/frc/settings/Settings.java b/Example_Project/src/main/java/frc/settings/Settings.java
deleted file mode 100644
index d490711..0000000
--- a/Example_Project/src/main/java/frc/settings/Settings.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package frc.settings;
-
-public class Settings {
-
- // Settings from the settings files in this directory
- public PneumaticsSettings pneumaticsSettings;
- public NavXSettings navXSettings;
- public ShuffleBoardSettings shuffleBoardSettings;
-
- // Controller IDs
- // We usually implement 2 controllers, an auxillary controller and a main controller.
- public int controllerID;
- public int auxControllerID;
-}
diff --git a/Example_Project/src/main/java/frc/settings/ShuffleBoardSettings.java b/Example_Project/src/main/java/frc/settings/ShuffleBoardSettings.java
deleted file mode 100644
index 519bd2e..0000000
--- a/Example_Project/src/main/java/frc/settings/ShuffleBoardSettings.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package frc.settings;
-
-public class ShuffleBoardSettings {
-
-
-}
diff --git a/Example_Project/src/main/java/frc/state_machine/State.java b/Example_Project/src/main/java/frc/state_machine/State.java
deleted file mode 100755
index 7a4fb03..0000000
--- a/Example_Project/src/main/java/frc/state_machine/State.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package frc.state_machine;
-
-public abstract class State
-{
- public void onEnter()
- {
- }
- public void onExit()
- {
- }
-
- public boolean isValid()
- {
- return true;
- }
-
- // Returns 'true' when state is finished
- public abstract boolean run();
-}
diff --git a/Example_Project/src/main/java/frc/state_machine/StateMachine.java b/Example_Project/src/main/java/frc/state_machine/StateMachine.java
deleted file mode 100755
index e5d0313..0000000
--- a/Example_Project/src/main/java/frc/state_machine/StateMachine.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package frc.state_machine;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * This is a state machine class. It is used to run a set of actions in order.
- * A state will be ran when the state is invalid.
- * The current state will keep running until the state is valid.
- * Once the state is valid, the state will be removed from the list and the next state will be ran.
- * Once the list is empty, the state machine will stop running.
- */
-
-public class StateMachine
-{
- State m_currentState;
- List
+ * It is advised to statically import this class (or one of its inner classes)
+ * wherever the constants are needed, to reduce verbosity.
+ *
* If you change your main robot class, change the parameter type.
*
+ * This runs after the mode specific periodic functions, but before
+ * LiveWindow and SmartDashboard integrated updating.
+ *