diff --git a/photon-lib/.clang-format b/.clang-format similarity index 100% rename from photon-lib/.clang-format rename to .clang-format diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index ede118092..0447d729a 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,3 +1,2 @@ # These owners will be the default owners for everything in the repo. * @PhotonVision/program-devs - diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 81525fadb..b17f36f8c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -31,7 +31,7 @@ jobs: steps: # Checkout code. - uses: actions/checkout@v1 - + # Setup Node.js - name: Setup Node.js uses: actions/setup-node@v1 @@ -61,7 +61,7 @@ jobs: # Fetch tags. - name: Fetch tags run: git fetch --tags --force - + # Install Java 11. - name: Install Java 11 uses: actions/setup-java@v1 @@ -81,7 +81,7 @@ jobs: # Generate Coverage Report. - name: Gradle Coverage run: ./gradlew jacocoTestReport --max-workers 1 - + # Publish Coverage Report. - name: Publish Server Coverage Report uses: codecov/codecov-action@v1 @@ -107,18 +107,18 @@ jobs: - uses: actions/setup-python@v2 with: python-version: '3.6' - + - name: Install dependencies run: | python -m pip install --upgrade pip pip install sphinx sphinx_rtd_theme sphinx-tabs sphinxext-opengraph doc8 pip install -r requirements.txt - + - name: Check the docs run: | make linkcheck make lint - + - name: Build the docs run: | make html @@ -132,7 +132,7 @@ jobs: photonserver-check-lint: # The type of runner that the job will run on. runs-on: ubuntu-latest - + steps: # Checkout code. - uses: actions/checkout@v1 @@ -141,7 +141,7 @@ jobs: - uses: actions/setup-java@v1 with: java-version: 11 - + # Check server code with Spotless. - run: | chmod +x gradlew @@ -241,11 +241,14 @@ jobs: with: python-version: 3.8 - name: Install clang-format - run: sudo apt-get update -q && sudo apt-get install clang-format-10 + run: | + sudo sh -c "echo 'deb http://archive.ubuntu.com/ubuntu/ $(lsb_release -cs)-proposed restricted main multiverse universe' >> /etc/apt/sources.list.d/proposed-repositories.list" + sudo apt-get update -q + sudo apt-get install -y clang-format-12 - name: Install wpiformat run: pip3 install wpiformat - name: Run - run: wpiformat -clang 10 -f photon-lib + run: wpiformat -clang 12 - name: Check Output run: git --no-pager diff --exit-code HEAD - name: Generate diff @@ -308,4 +311,3 @@ jobs: files: | photon-server/build/libs/*.jar if: github.event_name == 'push' - diff --git a/photon-lib/.styleguide b/.styleguide similarity index 68% rename from photon-lib/.styleguide rename to .styleguide index 02c108125..f9de9008f 100644 --- a/photon-lib/.styleguide +++ b/.styleguide @@ -9,6 +9,12 @@ cppSrcFileInclude { \.cpp$ } +modifiableFileExclude { + \.jpg$ + \.png$ + \.so$ +} + includeProject { ^photonLib/ } @@ -19,3 +25,7 @@ includeOtherLibs { ^units/ ^wpi/ } + +licenseUpdateExclude { + \.java$ +} diff --git a/photon-lib/.styleguide-license b/.styleguide-license similarity index 100% rename from photon-lib/.styleguide-license rename to .styleguide-license diff --git a/LicenseHeader.txt b/LicenseHeader.txt index d71928640..bcc3fc01e 100644 --- a/LicenseHeader.txt +++ b/LicenseHeader.txt @@ -14,4 +14,3 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - diff --git a/README.md b/README.md index cdb25af12..2df548766 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ A list of contributors is available in our documentation on ReadTheDocs. PhotonVision was forked from [Chameleon Vision](https://github.com/Chameleon-Vision/chameleon-vision/). Thank you to everyone who worked on the original project. -* [WPILib](https://github.com/wpilibsuite) - Specifically [cscore](https://github.com/wpilibsuite/allwpilib/tree/master/cscore), [CameraServer](https://github.com/wpilibsuite/allwpilib/tree/master/cameraserver), [NTCore](https://github.com/wpilibsuite/allwpilib/tree/master/ntcore), and [OpenCV](https://github.com/wpilibsuite/thirdparty-opencv). +* [WPILib](https://github.com/wpilibsuite) - Specifically [cscore](https://github.com/wpilibsuite/allwpilib/tree/master/cscore), [CameraServer](https://github.com/wpilibsuite/allwpilib/tree/master/cameraserver), [NTCore](https://github.com/wpilibsuite/allwpilib/tree/master/ntcore), and [OpenCV](https://github.com/wpilibsuite/thirdparty-opencv). * [Apache Commons](https://commons.apache.org/) - Specifically [Commons Math](https://commons.apache.org/proper/commons-math/), and [Commons Lang](https://commons.apache.org/proper/commons-lang/) @@ -27,5 +27,5 @@ PhotonVision was forked from [Chameleon Vision](https://github.com/Chameleon-Vis * [FasterXML](https://github.com/FasterXML) - Specifically [jackson](https://github.com/FasterXML/jackson) -## License +## License PhotonVision is licensed under the [GNU General Public License](https://www.gnu.org/licenses/gpl-3.0.html) diff --git a/build.gradle b/build.gradle index 978b93278..4e59baaf7 100644 --- a/build.gradle +++ b/build.gradle @@ -2,9 +2,9 @@ plugins { id "com.diffplug.gradle.spotless" version "3.28.0" id "com.github.johnrengelman.shadow" version "5.2.0" id "com.github.node-gradle.node" version "2.2.4" apply false - id "edu.wpi.first.GradleJni" version "0.10.1" - id "edu.wpi.first.GradleVsCode" version "0.12.0" - id "edu.wpi.first.NativeUtils" version "2021.1.1" apply false + id "edu.wpi.first.GradleJni" version "1.0.0" + id "edu.wpi.first.GradleVsCode" version "1.0.0" + id "edu.wpi.first.NativeUtils" version "2022.4.4" apply false id "edu.wpi.first.wpilib.repositories.WPILibRepositoriesPlugin" version "2020.2" id "org.hidetake.ssh" version "2.10.1" } @@ -22,8 +22,8 @@ allprojects { apply from: "versioningHelper.gradle" ext { - wpilibVersion = "2021.3.1" - opencvVersion = "3.4.7-5" + wpilibVersion = "2022.1.1-beta-2" + opencvVersion = "4.5.2-1" joglVersion = "2.4.0-rc-20200307" pubVersion = versionString isDev = pubVersion.startsWith("dev") diff --git a/codecov.yml b/codecov.yml index 66c42bd18..cbefb2da2 100644 --- a/codecov.yml +++ b/codecov.yml @@ -2,4 +2,4 @@ coverage: # Turning off commit status to prevent failed checks if coverage decreases status: project: no - patch: no + patch: no diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index cc4fdc293..7454180f2 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b16a683a7..ffed3a254 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip -distributionSha256Sum=3239b5ed86c3838a37d983ac100573f64c1f3fd8e1eb6c89fa5f9529b5ec091d +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 2fe81a7d9..4f906e0c8 100755 --- a/gradlew +++ b/gradlew @@ -82,6 +82,7 @@ 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 @@ -129,6 +130,7 @@ fi if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath diff --git a/gradlew.bat b/gradlew.bat index 9618d8d96..ac1b06f93 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,100 +1,89 @@ -@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 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%" == "0" goto init - -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 init - -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 - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -: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 %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="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! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@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%" == "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%"=="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! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/photon-client/public/index.html b/photon-client/public/index.html index f2431c6ae..9e16f901d 100644 --- a/photon-client/public/index.html +++ b/photon-client/public/index.html @@ -17,4 +17,4 @@ - \ No newline at end of file + diff --git a/photon-client/src/App.vue b/photon-client/src/App.vue index a79c8f8bd..fb7a93870 100644 --- a/photon-client/src/App.vue +++ b/photon-client/src/App.vue @@ -214,7 +214,7 @@ import Logs from "./views/LogsView" if (key === "logMessage") { this.logMessage(value["logMessage"], value["logLevel"]); } else if(key === "log"){ - this.logMessage(value["logMessage"]["logMessage"], value["logMessage"]["logLevel"]); + this.logMessage(value["logMessage"]["logMessage"], value["logMessage"]["logLevel"]); } else if (key === "updatePipelineResult") { this.$store.commit('mutatePipelineResults', value) } else if (this.$store.state.hasOwnProperty(key)) { @@ -343,4 +343,4 @@ import Logs from "./views/LogsView" font-size: 14px !important; } } - \ No newline at end of file + diff --git a/photon-client/src/components/common/cv-icon.vue b/photon-client/src/components/common/cv-icon.vue index bf48d65fc..bff41be36 100644 --- a/photon-client/src/components/common/cv-icon.vue +++ b/photon-client/src/components/common/cv-icon.vue @@ -51,4 +51,4 @@ .hover:hover { color: white !important; } - \ No newline at end of file + diff --git a/photon-client/src/components/common/cv-image.vue b/photon-client/src/components/common/cv-image.vue index 4a5d82421..e654466ea 100644 --- a/photon-client/src/components/common/cv-image.vue +++ b/photon-client/src/components/common/cv-image.vue @@ -59,4 +59,4 @@ } }, } - \ No newline at end of file + diff --git a/photon-client/src/components/common/cv-input.vue b/photon-client/src/components/common/cv-input.vue index 8675035eb..256cb9f08 100644 --- a/photon-client/src/components/common/cv-input.vue +++ b/photon-client/src/components/common/cv-input.vue @@ -61,4 +61,4 @@ s \ No newline at end of file + diff --git a/photon-client/src/components/common/cv-number-input.vue b/photon-client/src/components/common/cv-number-input.vue index 7448a7392..8cd3d244d 100644 --- a/photon-client/src/components/common/cv-number-input.vue +++ b/photon-client/src/components/common/cv-number-input.vue @@ -54,4 +54,4 @@ \ No newline at end of file + diff --git a/photon-client/src/components/common/cv-radio.vue b/photon-client/src/components/common/cv-radio.vue index 292d52c2d..98963deb5 100644 --- a/photon-client/src/components/common/cv-radio.vue +++ b/photon-client/src/components/common/cv-radio.vue @@ -41,4 +41,4 @@ \ No newline at end of file + diff --git a/photon-client/src/components/common/cv-range-slider.vue b/photon-client/src/components/common/cv-range-slider.vue index 1d25962a2..235c231bf 100644 --- a/photon-client/src/components/common/cv-range-slider.vue +++ b/photon-client/src/components/common/cv-range-slider.vue @@ -129,4 +129,4 @@ export default { \ No newline at end of file + diff --git a/photon-client/src/components/common/cv-select.vue b/photon-client/src/components/common/cv-select.vue index 145bf1779..02364dcc2 100644 --- a/photon-client/src/components/common/cv-select.vue +++ b/photon-client/src/components/common/cv-select.vue @@ -62,4 +62,4 @@ import TooltippedLabel from "./cv-tooltipped-label"; \ No newline at end of file + diff --git a/photon-client/src/components/common/cv-slider.vue b/photon-client/src/components/common/cv-slider.vue index ecb5a5d2c..2c7c8d639 100644 --- a/photon-client/src/components/common/cv-slider.vue +++ b/photon-client/src/components/common/cv-slider.vue @@ -105,4 +105,4 @@ export default { \ No newline at end of file + diff --git a/photon-client/src/components/common/cv-switch.vue b/photon-client/src/components/common/cv-switch.vue index 69b080233..19c15e91a 100644 --- a/photon-client/src/components/common/cv-switch.vue +++ b/photon-client/src/components/common/cv-switch.vue @@ -48,4 +48,4 @@ export default { \ No newline at end of file + diff --git a/photon-client/src/components/common/cv-tooltipped-label.vue b/photon-client/src/components/common/cv-tooltipped-label.vue index 8509018db..e21a1a8f2 100644 --- a/photon-client/src/components/common/cv-tooltipped-label.vue +++ b/photon-client/src/components/common/cv-tooltipped-label.vue @@ -24,4 +24,4 @@ // eslint-disable-next-line vue/require-prop-types props: ['text', 'tooltip'], } - \ No newline at end of file + diff --git a/photon-client/src/components/pipeline/3D/MiniMap.vue b/photon-client/src/components/pipeline/3D/MiniMap.vue index d17897b3a..9b2c68620 100644 --- a/photon-client/src/components/pipeline/3D/MiniMap.vue +++ b/photon-client/src/components/pipeline/3D/MiniMap.vue @@ -151,4 +151,4 @@ width: 80px; text-align: center; } - \ No newline at end of file + diff --git a/photon-client/src/components/pipeline/CameraAndPipelineSelect.vue b/photon-client/src/components/pipeline/CameraAndPipelineSelect.vue index 78e5b9553..5b4b986fa 100644 --- a/photon-client/src/components/pipeline/CameraAndPipelineSelect.vue +++ b/photon-client/src/components/pipeline/CameraAndPipelineSelect.vue @@ -405,4 +405,4 @@ export default { \ No newline at end of file + diff --git a/photon-client/src/components/pipeline/OutputTab/DualCalibration.vue b/photon-client/src/components/pipeline/OutputTab/DualCalibration.vue index 8348a6bd8..854e604d2 100644 --- a/photon-client/src/components/pipeline/OutputTab/DualCalibration.vue +++ b/photon-client/src/components/pipeline/OutputTab/DualCalibration.vue @@ -60,4 +60,4 @@ \ No newline at end of file + diff --git a/photon-client/src/components/pipeline/OutputTab/SingleCalibration.vue b/photon-client/src/components/pipeline/OutputTab/SingleCalibration.vue index 8c21279bb..0b4184b31 100644 --- a/photon-client/src/components/pipeline/OutputTab/SingleCalibration.vue +++ b/photon-client/src/components/pipeline/OutputTab/SingleCalibration.vue @@ -45,4 +45,4 @@ \ No newline at end of file + diff --git a/photon-client/src/plugins/ColorPicker.js b/photon-client/src/plugins/ColorPicker.js index 0078b058a..1c0bd0c74 100644 --- a/photon-client/src/plugins/ColorPicker.js +++ b/photon-client/src/plugins/ColorPicker.js @@ -122,4 +122,4 @@ function shrinkRange(range, color) { } -export default {initColorPicker, colorPickerClick, eyeDrop, expand, shrink} \ No newline at end of file +export default {initColorPicker, colorPickerClick, eyeDrop, expand, shrink} diff --git a/photon-client/src/scss/variables.scss b/photon-client/src/scss/variables.scss index 459264fae..f5b8f71dc 100644 --- a/photon-client/src/scss/variables.scss +++ b/photon-client/src/scss/variables.scss @@ -5,4 +5,4 @@ $body-font-family: $default-font; $heading-font-family: $default-font; .v-application { font-family: $default-font !important; -} \ No newline at end of file +} diff --git a/photon-client/src/store/index.js b/photon-client/src/store/index.js index efe859384..2ba1123ff 100644 --- a/photon-client/src/store/index.js +++ b/photon-client/src/store/index.js @@ -247,4 +247,4 @@ export default new Vuex.Store({ calibrationList: state => state.cameraSettings[state.currentCameraIndex].calibrations, pipelineType: state => state.cameraSettings[state.currentCameraIndex].currentPipelineSettings.pipelineType } -}) \ No newline at end of file +}) diff --git a/photon-client/src/store/modules/undoRedo.js b/photon-client/src/store/modules/undoRedo.js index 8e502f9df..ac89db508 100644 --- a/photon-client/src/store/modules/undoRedo.js +++ b/photon-client/src/store/modules/undoRedo.js @@ -69,4 +69,4 @@ export default { } } -}; \ No newline at end of file +}; diff --git a/photon-client/src/theme.js b/photon-client/src/theme.js index 2f4c333fc..a7e425c53 100644 --- a/photon-client/src/theme.js +++ b/photon-client/src/theme.js @@ -5,4 +5,4 @@ const theme = Object.freeze({ background: "#232C37", }); -export default theme; \ No newline at end of file +export default theme; diff --git a/photon-client/src/views/CamerasView.vue b/photon-client/src/views/CamerasView.vue index adaeb1462..d9256023c 100644 --- a/photon-client/src/views/CamerasView.vue +++ b/photon-client/src/views/CamerasView.vue @@ -563,4 +563,4 @@ export default { .v-data-table th, td { font-size: 1rem !important; } - \ No newline at end of file + diff --git a/photon-client/src/views/PipelineView.vue b/photon-client/src/views/PipelineView.vue index 9d69b8efa..cda3f3032 100644 --- a/photon-client/src/views/PipelineView.vue +++ b/photon-client/src/views/PipelineView.vue @@ -469,4 +469,4 @@ th { width: 80px; text-align: center; } - \ No newline at end of file + diff --git a/photon-client/src/views/PipelineViews/ContoursTab.vue b/photon-client/src/views/PipelineViews/ContoursTab.vue index eb3027f8e..671f5fe2f 100644 --- a/photon-client/src/views/PipelineViews/ContoursTab.vue +++ b/photon-client/src/views/PipelineViews/ContoursTab.vue @@ -285,4 +285,4 @@ export default { \ No newline at end of file + diff --git a/photon-client/src/views/PipelineViews/OutputTab.vue b/photon-client/src/views/PipelineViews/OutputTab.vue index ca5556705..807ea3c98 100644 --- a/photon-client/src/views/PipelineViews/OutputTab.vue +++ b/photon-client/src/views/PipelineViews/OutputTab.vue @@ -156,4 +156,4 @@ \ No newline at end of file + diff --git a/photon-client/src/views/PipelineViews/PnPTab.vue b/photon-client/src/views/PipelineViews/PnPTab.vue index 2543e9b2b..629e853de 100644 --- a/photon-client/src/views/PipelineViews/PnPTab.vue +++ b/photon-client/src/views/PipelineViews/PnPTab.vue @@ -60,7 +60,7 @@ }, data() { return { - targetList: ['2020 High Goal Outer', '2020 High Goal Inner', '2019 Dual Target', 'Power Cell (7in)', '2016 High Goal'], //Keep in sync with TargetModel.java + targetList: ['2020 High Goal Outer', '2020 High Goal Inner', '2019 Dual Target', 'Power Cell (7in)', '2016 High Goal'], //Keep in sync with TargetModel.java snackbar: { color: "Success", text: "" @@ -155,4 +155,4 @@ margin-left: auto; margin-right: auto; } - \ No newline at end of file + diff --git a/photon-client/src/views/PipelineViews/TargetsTab.vue b/photon-client/src/views/PipelineViews/TargetsTab.vue index 248b54b02..d3f22d654 100644 --- a/photon-client/src/views/PipelineViews/TargetsTab.vue +++ b/photon-client/src/views/PipelineViews/TargetsTab.vue @@ -97,4 +97,4 @@ .v-data-table td { font-family: monospace !important; } - \ No newline at end of file + diff --git a/photon-client/src/views/PipelineViews/ThresholdTab.vue b/photon-client/src/views/PipelineViews/ThresholdTab.vue index 99853896d..eaf25bd3c 100644 --- a/photon-client/src/views/PipelineViews/ThresholdTab.vue +++ b/photon-client/src/views/PipelineViews/ThresholdTab.vue @@ -232,4 +232,4 @@ export default { } } - \ No newline at end of file + diff --git a/photon-client/src/views/SettingsView.vue b/photon-client/src/views/SettingsView.vue index 67375ab61..0c8731030 100644 --- a/photon-client/src/views/SettingsView.vue +++ b/photon-client/src/views/SettingsView.vue @@ -85,4 +85,4 @@ height: auto !important; vertical-align: middle; } - \ No newline at end of file + diff --git a/photon-client/src/views/SettingsViews/General.vue b/photon-client/src/views/SettingsViews/General.vue index 6ff78cf35..4dcc757e9 100644 --- a/photon-client/src/views/SettingsViews/General.vue +++ b/photon-client/src/views/SettingsViews/General.vue @@ -234,7 +234,7 @@ export default { this.snackbar = { color: "error", text: "Error while uploading settings file! Could not process provided file.", - }; + }; } else if (err.request) { this.snackbar = { color: "error", @@ -276,4 +276,4 @@ export default { border-right: 1px solid; } - \ No newline at end of file + diff --git a/photon-client/src/views/SettingsViews/Lighting.vue b/photon-client/src/views/SettingsViews/Lighting.vue index ed6235f65..e65ac8d58 100644 --- a/photon-client/src/views/SettingsViews/Lighting.vue +++ b/photon-client/src/views/SettingsViews/Lighting.vue @@ -41,4 +41,4 @@ \ No newline at end of file + diff --git a/photon-core/.gitignore b/photon-core/.gitignore index 933a7e534..bad380c87 100644 --- a/photon-core/.gitignore +++ b/photon-core/.gitignore @@ -10,4 +10,4 @@ build/* photonvision/* photonvision_config/* -src/main/java/org/photonvision/PhotonVersion.java \ No newline at end of file +src/main/java/org/photonvision/PhotonVersion.java diff --git a/photon-core/build.gradle b/photon-core/build.gradle index 520f932d7..1e6550b1b 100644 --- a/photon-core/build.gradle +++ b/photon-core/build.gradle @@ -11,11 +11,11 @@ dependencies { implementation 'org.msgpack:jackson-dataformat-msgpack:0.8.20' // wpiutil - compile "edu.wpi.first.wpiutil:wpiutil-jni:$wpilibVersion:linuxaarch64bionic" - compile "edu.wpi.first.wpiutil:wpiutil-jni:$wpilibVersion:linuxraspbian" - compile "edu.wpi.first.wpiutil:wpiutil-jni:$wpilibVersion:linuxx86-64" - compile "edu.wpi.first.wpiutil:wpiutil-jni:$wpilibVersion:osxx86-64" - compile "edu.wpi.first.wpiutil:wpiutil-jni:$wpilibVersion:windowsx86-64" + implementation "edu.wpi.first.wpiutil:wpiutil-jni:$wpilibVersion:linuxaarch64bionic" + implementation "edu.wpi.first.wpiutil:wpiutil-jni:$wpilibVersion:linuxraspbian" + implementation "edu.wpi.first.wpiutil:wpiutil-jni:$wpilibVersion:linuxx86-64" + implementation "edu.wpi.first.wpiutil:wpiutil-jni:$wpilibVersion:osxx86-64" + implementation "edu.wpi.first.wpiutil:wpiutil-jni:$wpilibVersion:windowsx86-64" // JOGL stuff (currently we only distribute for aarch64, which is Pi 4) implementation "org.jogamp.gluegen:gluegen-rt:$joglVersion" @@ -25,7 +25,7 @@ dependencies { implementation "org.jogamp.jogl:jogl-all:$joglVersion:natives-linux-aarch64" // Zip - compile 'org.zeroturnaround:zt-zip:1.14' + implementation 'org.zeroturnaround:zt-zip:1.14' } task writeCurrentVersionJava { diff --git a/photon-core/settings.gradle b/photon-core/settings.gradle index 0533be7ae..993c9de12 100644 --- a/photon-core/settings.gradle +++ b/photon-core/settings.gradle @@ -1,2 +1 @@ rootProject.name = 'photon-core' - diff --git a/photon-core/src/main/java/org/photonvision/common/ProgramStatus.java b/photon-core/src/main/java/org/photonvision/common/ProgramStatus.java index a1ba6d091..1ad650315 100644 --- a/photon-core/src/main/java/org/photonvision/common/ProgramStatus.java +++ b/photon-core/src/main/java/org/photonvision/common/ProgramStatus.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common; public enum ProgramStatus { diff --git a/photon-core/src/main/java/org/photonvision/common/configuration/CameraConfiguration.java b/photon-core/src/main/java/org/photonvision/common/configuration/CameraConfiguration.java index 46cc14bba..80efdb84f 100644 --- a/photon-core/src/main/java/org/photonvision/common/configuration/CameraConfiguration.java +++ b/photon-core/src/main/java/org/photonvision/common/configuration/CameraConfiguration.java @@ -14,13 +14,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.configuration; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; -import edu.wpi.first.wpilibj.geometry.Rotation2d; +import edu.wpi.first.math.geometry.Rotation2d; import java.util.ArrayList; import java.util.List; import org.photonvision.common.logging.LogGroup; diff --git a/photon-core/src/main/java/org/photonvision/common/configuration/ConfigManager.java b/photon-core/src/main/java/org/photonvision/common/configuration/ConfigManager.java index 2492ac7a7..68629432f 100644 --- a/photon-core/src/main/java/org/photonvision/common/configuration/ConfigManager.java +++ b/photon-core/src/main/java/org/photonvision/common/configuration/ConfigManager.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.configuration; import com.fasterxml.jackson.core.JsonProcessingException; diff --git a/photon-core/src/main/java/org/photonvision/common/configuration/HardwareConfig.java b/photon-core/src/main/java/org/photonvision/common/configuration/HardwareConfig.java index 5272f4072..2d55d26c1 100644 --- a/photon-core/src/main/java/org/photonvision/common/configuration/HardwareConfig.java +++ b/photon-core/src/main/java/org/photonvision/common/configuration/HardwareConfig.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.configuration; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @@ -24,7 +23,6 @@ import java.util.List; @JsonIgnoreProperties(ignoreUnknown = true) public class HardwareConfig { - public final String deviceName; public final String deviceLogoPath; public final String supportURL; diff --git a/photon-core/src/main/java/org/photonvision/common/configuration/HardwareSettings.java b/photon-core/src/main/java/org/photonvision/common/configuration/HardwareSettings.java index f5578bb74..d55e01630 100644 --- a/photon-core/src/main/java/org/photonvision/common/configuration/HardwareSettings.java +++ b/photon-core/src/main/java/org/photonvision/common/configuration/HardwareSettings.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.configuration; public class HardwareSettings { diff --git a/photon-core/src/main/java/org/photonvision/common/configuration/NetworkConfig.java b/photon-core/src/main/java/org/photonvision/common/configuration/NetworkConfig.java index d7bd833c0..32afad3e1 100644 --- a/photon-core/src/main/java/org/photonvision/common/configuration/NetworkConfig.java +++ b/photon-core/src/main/java/org/photonvision/common/configuration/NetworkConfig.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.configuration; import com.fasterxml.jackson.annotation.JsonCreator; diff --git a/photon-core/src/main/java/org/photonvision/common/configuration/PhotonConfiguration.java b/photon-core/src/main/java/org/photonvision/common/configuration/PhotonConfiguration.java index 429327719..e7dc3b7a9 100644 --- a/photon-core/src/main/java/org/photonvision/common/configuration/PhotonConfiguration.java +++ b/photon-core/src/main/java/org/photonvision/common/configuration/PhotonConfiguration.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.configuration; import java.util.Collection; @@ -32,7 +31,6 @@ import org.photonvision.vision.processes.VisionSource; // TODO rename this class public class PhotonConfiguration { - private HardwareConfig hardwareConfig; private HardwareSettings hardwareSettings; private NetworkConfig networkConfig; diff --git a/photon-core/src/main/java/org/photonvision/common/dataflow/CVPipelineResultConsumer.java b/photon-core/src/main/java/org/photonvision/common/dataflow/CVPipelineResultConsumer.java index a51bf3574..7cb06d261 100644 --- a/photon-core/src/main/java/org/photonvision/common/dataflow/CVPipelineResultConsumer.java +++ b/photon-core/src/main/java/org/photonvision/common/dataflow/CVPipelineResultConsumer.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.dataflow; import java.util.function.Consumer; diff --git a/photon-core/src/main/java/org/photonvision/common/dataflow/DataChangeDestination.java b/photon-core/src/main/java/org/photonvision/common/dataflow/DataChangeDestination.java index 16a69dfe4..e2f720955 100644 --- a/photon-core/src/main/java/org/photonvision/common/dataflow/DataChangeDestination.java +++ b/photon-core/src/main/java/org/photonvision/common/dataflow/DataChangeDestination.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.dataflow; import java.util.ArrayList; diff --git a/photon-core/src/main/java/org/photonvision/common/dataflow/DataChangeService.java b/photon-core/src/main/java/org/photonvision/common/dataflow/DataChangeService.java index 72a5e0449..3aa783336 100644 --- a/photon-core/src/main/java/org/photonvision/common/dataflow/DataChangeService.java +++ b/photon-core/src/main/java/org/photonvision/common/dataflow/DataChangeService.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.dataflow; import java.util.concurrent.BlockingQueue; @@ -27,7 +26,6 @@ import org.photonvision.common.logging.Logger; @SuppressWarnings("rawtypes") public class DataChangeService { - private static final Logger logger = new Logger(DataChangeService.class, LogGroup.WebServer); private static class ThreadSafeSingleton { diff --git a/photon-core/src/main/java/org/photonvision/common/dataflow/DataChangeSource.java b/photon-core/src/main/java/org/photonvision/common/dataflow/DataChangeSource.java index c9ba1585f..05b3cbf4b 100644 --- a/photon-core/src/main/java/org/photonvision/common/dataflow/DataChangeSource.java +++ b/photon-core/src/main/java/org/photonvision/common/dataflow/DataChangeSource.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.dataflow; import java.util.ArrayList; diff --git a/photon-core/src/main/java/org/photonvision/common/dataflow/DataChangeSubscriber.java b/photon-core/src/main/java/org/photonvision/common/dataflow/DataChangeSubscriber.java index 9ebbd6105..e50813de9 100644 --- a/photon-core/src/main/java/org/photonvision/common/dataflow/DataChangeSubscriber.java +++ b/photon-core/src/main/java/org/photonvision/common/dataflow/DataChangeSubscriber.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.dataflow; import java.util.List; diff --git a/photon-core/src/main/java/org/photonvision/common/dataflow/events/DataChangeEvent.java b/photon-core/src/main/java/org/photonvision/common/dataflow/events/DataChangeEvent.java index 3f40aba73..557b259a1 100644 --- a/photon-core/src/main/java/org/photonvision/common/dataflow/events/DataChangeEvent.java +++ b/photon-core/src/main/java/org/photonvision/common/dataflow/events/DataChangeEvent.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.dataflow.events; import org.photonvision.common.dataflow.DataChangeDestination; diff --git a/photon-core/src/main/java/org/photonvision/common/dataflow/events/HTTPRequestEvent.java b/photon-core/src/main/java/org/photonvision/common/dataflow/events/HTTPRequestEvent.java index 5843ba1cc..135f655a4 100644 --- a/photon-core/src/main/java/org/photonvision/common/dataflow/events/HTTPRequestEvent.java +++ b/photon-core/src/main/java/org/photonvision/common/dataflow/events/HTTPRequestEvent.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.dataflow.events; import org.photonvision.common.dataflow.DataChangeDestination; diff --git a/photon-core/src/main/java/org/photonvision/common/dataflow/events/IncomingWebSocketEvent.java b/photon-core/src/main/java/org/photonvision/common/dataflow/events/IncomingWebSocketEvent.java index 0638f4446..1e18e78a6 100644 --- a/photon-core/src/main/java/org/photonvision/common/dataflow/events/IncomingWebSocketEvent.java +++ b/photon-core/src/main/java/org/photonvision/common/dataflow/events/IncomingWebSocketEvent.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.dataflow.events; import io.javalin.websocket.WsContext; @@ -23,7 +22,6 @@ import org.photonvision.common.dataflow.DataChangeDestination; import org.photonvision.common.dataflow.DataChangeSource; public class IncomingWebSocketEvent extends DataChangeEvent { - public final Integer cameraIndex; public final WsContext originContext; diff --git a/photon-core/src/main/java/org/photonvision/common/dataflow/events/OutgoingUIEvent.java b/photon-core/src/main/java/org/photonvision/common/dataflow/events/OutgoingUIEvent.java index efb3308dc..bfaa8256f 100644 --- a/photon-core/src/main/java/org/photonvision/common/dataflow/events/OutgoingUIEvent.java +++ b/photon-core/src/main/java/org/photonvision/common/dataflow/events/OutgoingUIEvent.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.dataflow.events; import io.javalin.websocket.WsContext; diff --git a/photon-core/src/main/java/org/photonvision/common/dataflow/networktables/NTDataChangeListener.java b/photon-core/src/main/java/org/photonvision/common/dataflow/networktables/NTDataChangeListener.java index e2ea43027..f037f9467 100644 --- a/photon-core/src/main/java/org/photonvision/common/dataflow/networktables/NTDataChangeListener.java +++ b/photon-core/src/main/java/org/photonvision/common/dataflow/networktables/NTDataChangeListener.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.dataflow.networktables; import edu.wpi.first.networktables.EntryListenerFlags; @@ -23,7 +22,6 @@ import edu.wpi.first.networktables.NetworkTableEntry; import java.util.function.Consumer; public class NTDataChangeListener { - private final NetworkTableEntry watchedEntry; private final int listenerID; diff --git a/photon-core/src/main/java/org/photonvision/common/dataflow/networktables/NTDataPublisher.java b/photon-core/src/main/java/org/photonvision/common/dataflow/networktables/NTDataPublisher.java index 710aebb25..f02808962 100644 --- a/photon-core/src/main/java/org/photonvision/common/dataflow/networktables/NTDataPublisher.java +++ b/photon-core/src/main/java/org/photonvision/common/dataflow/networktables/NTDataPublisher.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.dataflow.networktables; import edu.wpi.first.networktables.EntryNotification; @@ -33,7 +32,6 @@ import org.photonvision.vision.pipeline.result.CVPipelineResult; import org.photonvision.vision.target.TrackedTarget; public class NTDataPublisher implements CVPipelineResultConsumer { - private final NetworkTable rootTable = NetworkTablesManager.getInstance().kRootTable; private NetworkTable subTable; private NetworkTableEntry rawBytesEntry; diff --git a/photon-core/src/main/java/org/photonvision/common/dataflow/networktables/NetworkTablesManager.java b/photon-core/src/main/java/org/photonvision/common/dataflow/networktables/NetworkTablesManager.java index fa6b48ab2..e533e1418 100644 --- a/photon-core/src/main/java/org/photonvision/common/dataflow/networktables/NetworkTablesManager.java +++ b/photon-core/src/main/java/org/photonvision/common/dataflow/networktables/NetworkTablesManager.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.dataflow.networktables; import edu.wpi.first.networktables.LogMessage; @@ -29,7 +28,6 @@ import org.photonvision.common.scripting.ScriptEventType; import org.photonvision.common.scripting.ScriptManager; public class NetworkTablesManager { - private final NetworkTableInstance ntInstance = NetworkTableInstance.getDefault(); private final String kRootTableName = "/photonvision"; public final NetworkTable kRootTable = ntInstance.getTable(kRootTableName); @@ -48,7 +46,6 @@ public class NetworkTablesManager { private static final Logger logger = new Logger(NetworkTablesManager.class, LogGroup.General); private static class NTLogger implements Consumer { - private boolean hasReportedConnectionFailure = false; private long lastConnectMessageMillis = 0; diff --git a/photon-core/src/main/java/org/photonvision/common/dataflow/websocket/UIDataPublisher.java b/photon-core/src/main/java/org/photonvision/common/dataflow/websocket/UIDataPublisher.java index 0a9de0444..f6269000c 100644 --- a/photon-core/src/main/java/org/photonvision/common/dataflow/websocket/UIDataPublisher.java +++ b/photon-core/src/main/java/org/photonvision/common/dataflow/websocket/UIDataPublisher.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.dataflow.websocket; import java.util.ArrayList; diff --git a/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/CustomGPIO.java b/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/CustomGPIO.java index 8d381f24c..5eab43fdf 100644 --- a/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/CustomGPIO.java +++ b/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/CustomGPIO.java @@ -14,14 +14,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.hardware.GPIO; import org.photonvision.common.configuration.HardwareConfig; import org.photonvision.common.hardware.Platform; public class CustomGPIO extends GPIOBase { - private boolean currentState; private final int port; diff --git a/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/GPIOBase.java b/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/GPIOBase.java index a1d25be98..f2d603731 100644 --- a/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/GPIOBase.java +++ b/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/GPIOBase.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.hardware.GPIO; import java.util.Arrays; diff --git a/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioCommand.java b/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioCommand.java index 932674bb9..b25508942 100644 --- a/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioCommand.java +++ b/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioCommand.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.hardware.GPIO.pi; @SuppressWarnings("SpellCheckingInspection") diff --git a/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioException.java b/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioException.java index b325868a7..3b1f26e1a 100644 --- a/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioException.java +++ b/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioException.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.hardware.GPIO.pi; import java.util.HashMap; @@ -27,7 +26,6 @@ import java.util.HashMap; */ @SuppressWarnings({"SpellCheckingInspection", "unused", "RedundantSuppression"}) public class PigpioException extends Exception { - private int rc = -99999999; private static final long serialVersionUID = 443595760654129068L; diff --git a/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioPin.java b/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioPin.java index eccef041b..6899c4980 100644 --- a/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioPin.java +++ b/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioPin.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.hardware.GPIO.pi; import static org.photonvision.common.hardware.GPIO.pi.PigpioException.*; @@ -24,7 +23,6 @@ import org.photonvision.common.logging.LogGroup; import org.photonvision.common.logging.Logger; public class PigpioPin extends GPIOBase { - public static final Logger logger = new Logger(PigpioPin.class, LogGroup.General); private static final PigpioSocket piSocket = new PigpioSocket(); diff --git a/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioPulse.java b/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioPulse.java index 59e0bc0f8..e0b7897c9 100644 --- a/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioPulse.java +++ b/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioPulse.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.hardware.GPIO.pi; public class PigpioPulse { diff --git a/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioSocket.java b/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioSocket.java index d808c44ba..35c5dd459 100644 --- a/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioSocket.java +++ b/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioSocket.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.hardware.GPIO.pi; import static org.photonvision.common.hardware.GPIO.pi.PigpioException.*; diff --git a/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioSocketLock.java b/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioSocketLock.java index 7c7a0036a..528e77240 100644 --- a/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioSocketLock.java +++ b/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioSocketLock.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.hardware.GPIO.pi; import java.io.DataInputStream; diff --git a/photon-core/src/main/java/org/photonvision/common/hardware/HardwareManager.java b/photon-core/src/main/java/org/photonvision/common/hardware/HardwareManager.java index fbaebc4cc..9ed654668 100644 --- a/photon-core/src/main/java/org/photonvision/common/hardware/HardwareManager.java +++ b/photon-core/src/main/java/org/photonvision/common/hardware/HardwareManager.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.hardware; import edu.wpi.first.networktables.NetworkTableEntry; diff --git a/photon-core/src/main/java/org/photonvision/common/hardware/Platform.java b/photon-core/src/main/java/org/photonvision/common/hardware/Platform.java index b9b17e980..55436115e 100644 --- a/photon-core/src/main/java/org/photonvision/common/hardware/Platform.java +++ b/photon-core/src/main/java/org/photonvision/common/hardware/Platform.java @@ -14,10 +14,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.hardware; -import edu.wpi.first.wpiutil.RuntimeDetector; +import edu.wpi.first.util.RuntimeDetector; import java.io.IOException; import org.photonvision.common.util.ShellExec; diff --git a/photon-core/src/main/java/org/photonvision/common/hardware/StatusLED.java b/photon-core/src/main/java/org/photonvision/common/hardware/StatusLED.java index 0c10b3548..f601d40a8 100644 --- a/photon-core/src/main/java/org/photonvision/common/hardware/StatusLED.java +++ b/photon-core/src/main/java/org/photonvision/common/hardware/StatusLED.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.hardware; import java.util.List; diff --git a/photon-core/src/main/java/org/photonvision/common/hardware/VisionLED.java b/photon-core/src/main/java/org/photonvision/common/hardware/VisionLED.java index 880619e23..21c444dc2 100644 --- a/photon-core/src/main/java/org/photonvision/common/hardware/VisionLED.java +++ b/photon-core/src/main/java/org/photonvision/common/hardware/VisionLED.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.hardware; import edu.wpi.first.networktables.EntryNotification; diff --git a/photon-core/src/main/java/org/photonvision/common/hardware/metrics/CPUMetrics.java b/photon-core/src/main/java/org/photonvision/common/hardware/metrics/CPUMetrics.java index eff807a56..6f16e714d 100644 --- a/photon-core/src/main/java/org/photonvision/common/hardware/metrics/CPUMetrics.java +++ b/photon-core/src/main/java/org/photonvision/common/hardware/metrics/CPUMetrics.java @@ -14,11 +14,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.hardware.metrics; public class CPUMetrics extends MetricsBase { - private String cpuMemSplit = null; public String getMemory() { diff --git a/photon-core/src/main/java/org/photonvision/common/hardware/metrics/DiskMetrics.java b/photon-core/src/main/java/org/photonvision/common/hardware/metrics/DiskMetrics.java index e6b672ef9..079129a9e 100644 --- a/photon-core/src/main/java/org/photonvision/common/hardware/metrics/DiskMetrics.java +++ b/photon-core/src/main/java/org/photonvision/common/hardware/metrics/DiskMetrics.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.hardware.metrics; public class DiskMetrics extends MetricsBase { diff --git a/photon-core/src/main/java/org/photonvision/common/hardware/metrics/GPUMetrics.java b/photon-core/src/main/java/org/photonvision/common/hardware/metrics/GPUMetrics.java index 6319280a9..010bff61f 100644 --- a/photon-core/src/main/java/org/photonvision/common/hardware/metrics/GPUMetrics.java +++ b/photon-core/src/main/java/org/photonvision/common/hardware/metrics/GPUMetrics.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.hardware.metrics; public class GPUMetrics extends MetricsBase { diff --git a/photon-core/src/main/java/org/photonvision/common/hardware/metrics/MetricsBase.java b/photon-core/src/main/java/org/photonvision/common/hardware/metrics/MetricsBase.java index 192d76f61..32999da61 100644 --- a/photon-core/src/main/java/org/photonvision/common/hardware/metrics/MetricsBase.java +++ b/photon-core/src/main/java/org/photonvision/common/hardware/metrics/MetricsBase.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.hardware.metrics; import java.io.PrintWriter; diff --git a/photon-core/src/main/java/org/photonvision/common/hardware/metrics/MetricsPublisher.java b/photon-core/src/main/java/org/photonvision/common/hardware/metrics/MetricsPublisher.java index f28d082a3..fd3518477 100644 --- a/photon-core/src/main/java/org/photonvision/common/hardware/metrics/MetricsPublisher.java +++ b/photon-core/src/main/java/org/photonvision/common/hardware/metrics/MetricsPublisher.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.hardware.metrics; import java.util.HashMap; diff --git a/photon-core/src/main/java/org/photonvision/common/hardware/metrics/RAMMetrics.java b/photon-core/src/main/java/org/photonvision/common/hardware/metrics/RAMMetrics.java index bf0bd2b5a..8cc65cf2b 100644 --- a/photon-core/src/main/java/org/photonvision/common/hardware/metrics/RAMMetrics.java +++ b/photon-core/src/main/java/org/photonvision/common/hardware/metrics/RAMMetrics.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.hardware.metrics; public class RAMMetrics extends MetricsBase { diff --git a/photon-core/src/main/java/org/photonvision/common/logging/LogGroup.java b/photon-core/src/main/java/org/photonvision/common/logging/LogGroup.java index cfdd91861..1bd4181aa 100644 --- a/photon-core/src/main/java/org/photonvision/common/logging/LogGroup.java +++ b/photon-core/src/main/java/org/photonvision/common/logging/LogGroup.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.logging; public enum LogGroup { diff --git a/photon-core/src/main/java/org/photonvision/common/logging/LogLevel.java b/photon-core/src/main/java/org/photonvision/common/logging/LogLevel.java index 5d96d3aeb..d66cce151 100644 --- a/photon-core/src/main/java/org/photonvision/common/logging/LogLevel.java +++ b/photon-core/src/main/java/org/photonvision/common/logging/LogLevel.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.logging; public enum LogLevel { diff --git a/photon-core/src/main/java/org/photonvision/common/logging/Logger.java b/photon-core/src/main/java/org/photonvision/common/logging/Logger.java index 58bbe548c..220d502ca 100644 --- a/photon-core/src/main/java/org/photonvision/common/logging/Logger.java +++ b/photon-core/src/main/java/org/photonvision/common/logging/Logger.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.logging; import java.io.*; @@ -36,7 +35,6 @@ import org.photonvision.common.util.TimedTaskManager; @SuppressWarnings("unused") public class Logger { - public static final String ANSI_RESET = "\u001B[0m"; public static final String ANSI_BLACK = "\u001B[30m"; public static final String ANSI_RED = "\u001B[31m"; @@ -127,7 +125,6 @@ public class Logger { } public static void cleanLogs(Path folderToClean) { - LinkedList logFileList = new LinkedList<>(Arrays.asList(folderToClean.toFile().listFiles())); HashMap logFileStartDateMap = new HashMap<>(); diff --git a/photon-core/src/main/java/org/photonvision/common/networking/NetworkInterface.java b/photon-core/src/main/java/org/photonvision/common/networking/NetworkInterface.java index 8130dccb6..2dba02378 100644 --- a/photon-core/src/main/java/org/photonvision/common/networking/NetworkInterface.java +++ b/photon-core/src/main/java/org/photonvision/common/networking/NetworkInterface.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.networking; import java.net.InterfaceAddress; diff --git a/photon-core/src/main/java/org/photonvision/common/networking/NetworkManager.java b/photon-core/src/main/java/org/photonvision/common/networking/NetworkManager.java index 90d8b3aeb..34a326055 100644 --- a/photon-core/src/main/java/org/photonvision/common/networking/NetworkManager.java +++ b/photon-core/src/main/java/org/photonvision/common/networking/NetworkManager.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.networking; import org.photonvision.common.configuration.ConfigManager; @@ -24,7 +23,6 @@ import org.photonvision.common.logging.Logger; import org.photonvision.common.util.ShellExec; public class NetworkManager { - private static final Logger logger = new Logger(NetworkManager.class, LogGroup.General); private NetworkManager() {} diff --git a/photon-core/src/main/java/org/photonvision/common/networking/NetworkMode.java b/photon-core/src/main/java/org/photonvision/common/networking/NetworkMode.java index f5a12f1b7..39b33ebd1 100644 --- a/photon-core/src/main/java/org/photonvision/common/networking/NetworkMode.java +++ b/photon-core/src/main/java/org/photonvision/common/networking/NetworkMode.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.networking; public enum NetworkMode { diff --git a/photon-core/src/main/java/org/photonvision/common/scripting/ScriptCommandType.java b/photon-core/src/main/java/org/photonvision/common/scripting/ScriptCommandType.java index debc05c1b..699faf4c9 100644 --- a/photon-core/src/main/java/org/photonvision/common/scripting/ScriptCommandType.java +++ b/photon-core/src/main/java/org/photonvision/common/scripting/ScriptCommandType.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.scripting; public enum ScriptCommandType { diff --git a/photon-core/src/main/java/org/photonvision/common/scripting/ScriptConfig.java b/photon-core/src/main/java/org/photonvision/common/scripting/ScriptConfig.java index 684a1a882..5342add6b 100644 --- a/photon-core/src/main/java/org/photonvision/common/scripting/ScriptConfig.java +++ b/photon-core/src/main/java/org/photonvision/common/scripting/ScriptConfig.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.scripting; import com.fasterxml.jackson.annotation.JsonCreator; diff --git a/photon-core/src/main/java/org/photonvision/common/scripting/ScriptEvent.java b/photon-core/src/main/java/org/photonvision/common/scripting/ScriptEvent.java index a60dd566a..a14642cf3 100644 --- a/photon-core/src/main/java/org/photonvision/common/scripting/ScriptEvent.java +++ b/photon-core/src/main/java/org/photonvision/common/scripting/ScriptEvent.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.scripting; import java.io.IOException; diff --git a/photon-core/src/main/java/org/photonvision/common/scripting/ScriptEventType.java b/photon-core/src/main/java/org/photonvision/common/scripting/ScriptEventType.java index 3fe98bf44..f2a6ff381 100644 --- a/photon-core/src/main/java/org/photonvision/common/scripting/ScriptEventType.java +++ b/photon-core/src/main/java/org/photonvision/common/scripting/ScriptEventType.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.scripting; public enum ScriptEventType { diff --git a/photon-core/src/main/java/org/photonvision/common/scripting/ScriptManager.java b/photon-core/src/main/java/org/photonvision/common/scripting/ScriptManager.java index 253f863fd..ff8172dae 100644 --- a/photon-core/src/main/java/org/photonvision/common/scripting/ScriptManager.java +++ b/photon-core/src/main/java/org/photonvision/common/scripting/ScriptManager.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.scripting; import java.io.IOException; @@ -31,7 +30,6 @@ import org.photonvision.common.util.TimedTaskManager; import org.photonvision.common.util.file.JacksonUtils; public class ScriptManager { - private static final Logger logger = new Logger(ScriptManager.class, LogGroup.General); private ScriptManager() {} @@ -83,7 +81,6 @@ public class ScriptManager { } protected static class ScriptConfigManager { - // protected static final Path scriptConfigPath = // Paths.get(ConfigManager.SettingsPath.toString(), "scripts.json"); static final Path scriptConfigPath = Paths.get(""); // TODO: Waiting on config diff --git a/photon-core/src/main/java/org/photonvision/common/util/ColorHelper.java b/photon-core/src/main/java/org/photonvision/common/util/ColorHelper.java index 1ce4c55f1..7ff7657ff 100644 --- a/photon-core/src/main/java/org/photonvision/common/util/ColorHelper.java +++ b/photon-core/src/main/java/org/photonvision/common/util/ColorHelper.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.util; import java.awt.*; diff --git a/photon-core/src/main/java/org/photonvision/common/util/MemoryManager.java b/photon-core/src/main/java/org/photonvision/common/util/MemoryManager.java index 9a6d5525e..78a0acd64 100644 --- a/photon-core/src/main/java/org/photonvision/common/util/MemoryManager.java +++ b/photon-core/src/main/java/org/photonvision/common/util/MemoryManager.java @@ -14,11 +14,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.util; public class MemoryManager { - private static final long MEGABYTE_FACTOR = 1024L * 1024L; private int collectionThreshold; diff --git a/photon-core/src/main/java/org/photonvision/common/util/ReflectionUtils.java b/photon-core/src/main/java/org/photonvision/common/util/ReflectionUtils.java index f8c32905f..6b554e3aa 100644 --- a/photon-core/src/main/java/org/photonvision/common/util/ReflectionUtils.java +++ b/photon-core/src/main/java/org/photonvision/common/util/ReflectionUtils.java @@ -14,11 +14,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.util; public class ReflectionUtils { - public static StackTraceElement[] getFullStackTrace() { return Thread.currentThread().getStackTrace(); } diff --git a/photon-core/src/main/java/org/photonvision/common/util/SerializationUtils.java b/photon-core/src/main/java/org/photonvision/common/util/SerializationUtils.java index a211b545e..6846f84f5 100644 --- a/photon-core/src/main/java/org/photonvision/common/util/SerializationUtils.java +++ b/photon-core/src/main/java/org/photonvision/common/util/SerializationUtils.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.util; import java.util.HashMap; diff --git a/photon-core/src/main/java/org/photonvision/common/util/ShellExec.java b/photon-core/src/main/java/org/photonvision/common/util/ShellExec.java index 61676cab0..a0e5079be 100644 --- a/photon-core/src/main/java/org/photonvision/common/util/ShellExec.java +++ b/photon-core/src/main/java/org/photonvision/common/util/ShellExec.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.util; import java.io.*; diff --git a/photon-core/src/main/java/org/photonvision/common/util/TestUtils.java b/photon-core/src/main/java/org/photonvision/common/util/TestUtils.java index 23f69e221..5876fcb5d 100644 --- a/photon-core/src/main/java/org/photonvision/common/util/TestUtils.java +++ b/photon-core/src/main/java/org/photonvision/common/util/TestUtils.java @@ -14,11 +14,10 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.util; import com.fasterxml.jackson.databind.ObjectMapper; -import edu.wpi.cscore.CameraServerCvJNI; +import edu.wpi.first.cscore.CameraServerCvJNI; import java.awt.*; import java.io.File; import java.io.IOException; @@ -28,7 +27,6 @@ import org.opencv.highgui.HighGui; import org.photonvision.vision.calibration.CameraCalibrationCoefficients; public class TestUtils { - @SuppressWarnings("unused") public enum WPI2019Image { kCargoAngledDark48in(1.2192), @@ -135,7 +133,7 @@ public class TestUtils { } private static Path getResourcesFolderPath(boolean testMode) { - return Path.of(testMode ? "src/main/resources" : "../test-resources").toAbsolutePath(); + return Path.of("../test-resources").toAbsolutePath(); } public static Path getTestMode2019ImagePath() { @@ -232,7 +230,6 @@ public class TestUtils { HighGui.waitKey(timeoutMs); HighGui.destroyAllWindows(); } catch (HeadlessException ignored) { - } } diff --git a/photon-core/src/main/java/org/photonvision/common/util/TimedTaskManager.java b/photon-core/src/main/java/org/photonvision/common/util/TimedTaskManager.java index b3fa552ed..9641c9c08 100644 --- a/photon-core/src/main/java/org/photonvision/common/util/TimedTaskManager.java +++ b/photon-core/src/main/java/org/photonvision/common/util/TimedTaskManager.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.util; import java.util.concurrent.*; @@ -23,7 +22,6 @@ import org.photonvision.common.logging.LogGroup; import org.photonvision.common.logging.Logger; public class TimedTaskManager { - private static final Logger logger = new Logger(TimedTaskManager.class, LogGroup.General); private static class Singleton { diff --git a/photon-core/src/main/java/org/photonvision/common/util/file/FileUtils.java b/photon-core/src/main/java/org/photonvision/common/util/file/FileUtils.java index 24ab5adff..40ce70c83 100644 --- a/photon-core/src/main/java/org/photonvision/common/util/file/FileUtils.java +++ b/photon-core/src/main/java/org/photonvision/common/util/file/FileUtils.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.util.file; import java.io.File; @@ -33,7 +32,6 @@ import org.photonvision.common.logging.LogGroup; import org.photonvision.common.logging.Logger; public class FileUtils { - private FileUtils() {} private static final Logger logger = new Logger(FileUtils.class, LogGroup.General); diff --git a/photon-core/src/main/java/org/photonvision/common/util/file/JacksonUtils.java b/photon-core/src/main/java/org/photonvision/common/util/file/JacksonUtils.java index 243428372..086f43e14 100644 --- a/photon-core/src/main/java/org/photonvision/common/util/file/JacksonUtils.java +++ b/photon-core/src/main/java/org/photonvision/common/util/file/JacksonUtils.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.util.file; import com.fasterxml.jackson.core.json.JsonReadFeature; diff --git a/photon-core/src/main/java/org/photonvision/common/util/java/TriConsumer.java b/photon-core/src/main/java/org/photonvision/common/util/java/TriConsumer.java index 6f1dc67fb..66bcf62c7 100644 --- a/photon-core/src/main/java/org/photonvision/common/util/java/TriConsumer.java +++ b/photon-core/src/main/java/org/photonvision/common/util/java/TriConsumer.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.util.java; public interface TriConsumer { diff --git a/photon-core/src/main/java/org/photonvision/common/util/math/IPUtils.java b/photon-core/src/main/java/org/photonvision/common/util/math/IPUtils.java index f4127e782..f2a7af542 100644 --- a/photon-core/src/main/java/org/photonvision/common/util/math/IPUtils.java +++ b/photon-core/src/main/java/org/photonvision/common/util/math/IPUtils.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.util.math; import java.util.ArrayList; diff --git a/photon-core/src/main/java/org/photonvision/common/util/math/MathUtils.java b/photon-core/src/main/java/org/photonvision/common/util/math/MathUtils.java index b7c0f76f8..12d4eda26 100644 --- a/photon-core/src/main/java/org/photonvision/common/util/math/MathUtils.java +++ b/photon-core/src/main/java/org/photonvision/common/util/math/MathUtils.java @@ -14,10 +14,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.util.math; -import edu.wpi.first.wpiutil.WPIUtilJNI; +import edu.wpi.first.util.WPIUtilJNI; public class MathUtils { MathUtils() {} diff --git a/photon-core/src/main/java/org/photonvision/common/util/numbers/DoubleCouple.java b/photon-core/src/main/java/org/photonvision/common/util/numbers/DoubleCouple.java index 004d0a2af..a040e3ecc 100644 --- a/photon-core/src/main/java/org/photonvision/common/util/numbers/DoubleCouple.java +++ b/photon-core/src/main/java/org/photonvision/common/util/numbers/DoubleCouple.java @@ -14,13 +14,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.util.numbers; import org.opencv.core.Point; public class DoubleCouple extends NumberCouple { - public DoubleCouple() { super(0.0, 0.0); } diff --git a/photon-core/src/main/java/org/photonvision/common/util/numbers/IntegerCouple.java b/photon-core/src/main/java/org/photonvision/common/util/numbers/IntegerCouple.java index 5bfd133a9..31a0c7b90 100644 --- a/photon-core/src/main/java/org/photonvision/common/util/numbers/IntegerCouple.java +++ b/photon-core/src/main/java/org/photonvision/common/util/numbers/IntegerCouple.java @@ -14,11 +14,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.util.numbers; public class IntegerCouple extends NumberCouple { - public IntegerCouple() { super(0, 0); } diff --git a/photon-core/src/main/java/org/photonvision/common/util/numbers/NumberCouple.java b/photon-core/src/main/java/org/photonvision/common/util/numbers/NumberCouple.java index e4a204f99..4df991a1c 100644 --- a/photon-core/src/main/java/org/photonvision/common/util/numbers/NumberCouple.java +++ b/photon-core/src/main/java/org/photonvision/common/util/numbers/NumberCouple.java @@ -14,13 +14,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.util.numbers; import com.fasterxml.jackson.annotation.JsonIgnore; public abstract class NumberCouple { - protected T first; protected T second; diff --git a/photon-core/src/main/java/org/photonvision/common/util/numbers/NumberListUtils.java b/photon-core/src/main/java/org/photonvision/common/util/numbers/NumberListUtils.java index fd5b96532..3d724e350 100644 --- a/photon-core/src/main/java/org/photonvision/common/util/numbers/NumberListUtils.java +++ b/photon-core/src/main/java/org/photonvision/common/util/numbers/NumberListUtils.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.util.numbers; import java.math.BigDecimal; @@ -25,7 +24,6 @@ import java.util.StringJoiner; @SuppressWarnings("unused") public class NumberListUtils { - /** * @param collection an ArrayList of Comparable objects * @return the median of collection diff --git a/photon-core/src/main/java/org/photonvision/raspi/PicamJNI.java b/photon-core/src/main/java/org/photonvision/raspi/PicamJNI.java index c96e32c89..c58e70189 100644 --- a/photon-core/src/main/java/org/photonvision/raspi/PicamJNI.java +++ b/photon-core/src/main/java/org/photonvision/raspi/PicamJNI.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.raspi; import java.io.File; @@ -28,7 +27,6 @@ import org.photonvision.common.logging.LogGroup; import org.photonvision.common.logging.Logger; public class PicamJNI { - private static boolean libraryLoaded = false; private static Logger logger = new Logger(PicamJNI.class, LogGroup.Camera); diff --git a/photon-core/src/main/java/org/photonvision/vision/calibration/CameraCalibrationCoefficients.java b/photon-core/src/main/java/org/photonvision/vision/calibration/CameraCalibrationCoefficients.java index cf7017656..84e8da65b 100644 --- a/photon-core/src/main/java/org/photonvision/vision/calibration/CameraCalibrationCoefficients.java +++ b/photon-core/src/main/java/org/photonvision/vision/calibration/CameraCalibrationCoefficients.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.calibration; import com.fasterxml.jackson.annotation.JsonCreator; diff --git a/photon-core/src/main/java/org/photonvision/vision/calibration/JsonMat.java b/photon-core/src/main/java/org/photonvision/vision/calibration/JsonMat.java index 60b4a524b..2219af588 100644 --- a/photon-core/src/main/java/org/photonvision/vision/calibration/JsonMat.java +++ b/photon-core/src/main/java/org/photonvision/vision/calibration/JsonMat.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.calibration; import com.fasterxml.jackson.annotation.JsonIgnore; diff --git a/photon-core/src/main/java/org/photonvision/vision/camera/CameraQuirk.java b/photon-core/src/main/java/org/photonvision/vision/camera/CameraQuirk.java index fe5043f13..81e600a27 100644 --- a/photon-core/src/main/java/org/photonvision/vision/camera/CameraQuirk.java +++ b/photon-core/src/main/java/org/photonvision/vision/camera/CameraQuirk.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.camera; public enum CameraQuirk { diff --git a/photon-core/src/main/java/org/photonvision/vision/camera/CameraType.java b/photon-core/src/main/java/org/photonvision/vision/camera/CameraType.java index 8ce16ca27..3bd4f6a1a 100644 --- a/photon-core/src/main/java/org/photonvision/vision/camera/CameraType.java +++ b/photon-core/src/main/java/org/photonvision/vision/camera/CameraType.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.camera; public enum CameraType { diff --git a/photon-core/src/main/java/org/photonvision/vision/camera/FileVisionSource.java b/photon-core/src/main/java/org/photonvision/vision/camera/FileVisionSource.java index e089083fc..7f6768f79 100644 --- a/photon-core/src/main/java/org/photonvision/vision/camera/FileVisionSource.java +++ b/photon-core/src/main/java/org/photonvision/vision/camera/FileVisionSource.java @@ -14,11 +14,10 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.camera; -import edu.wpi.cscore.VideoMode; -import edu.wpi.cscore.VideoMode.PixelFormat; +import edu.wpi.first.cscore.VideoMode; +import edu.wpi.first.cscore.VideoMode.PixelFormat; import java.nio.file.Path; import java.util.HashMap; import org.photonvision.common.configuration.CameraConfiguration; @@ -29,7 +28,6 @@ import org.photonvision.vision.processes.VisionSource; import org.photonvision.vision.processes.VisionSourceSettables; public class FileVisionSource extends VisionSource { - private final FileFrameProvider frameProvider; private final FileSourceSettables settables; @@ -73,7 +71,6 @@ public class FileVisionSource extends VisionSource { } private static class FileSourceSettables extends VisionSourceSettables { - private final VideoMode videoMode; private final HashMap videoModes = new HashMap<>(); diff --git a/photon-core/src/main/java/org/photonvision/vision/camera/QuirkyCamera.java b/photon-core/src/main/java/org/photonvision/vision/camera/QuirkyCamera.java index 737585f28..a4e2da954 100644 --- a/photon-core/src/main/java/org/photonvision/vision/camera/QuirkyCamera.java +++ b/photon-core/src/main/java/org/photonvision/vision/camera/QuirkyCamera.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.camera; import java.util.HashMap; @@ -22,7 +21,6 @@ import java.util.List; import java.util.Objects; public class QuirkyCamera { - private static final List quirkyCameras = List.of( new QuirkyCamera(0x2000, 0x1415, CameraQuirk.Gain, CameraQuirk.FPSCap100), // PS3Eye diff --git a/photon-core/src/main/java/org/photonvision/vision/camera/USBCameraSource.java b/photon-core/src/main/java/org/photonvision/vision/camera/USBCameraSource.java index 652a0e25b..f22ed6eff 100644 --- a/photon-core/src/main/java/org/photonvision/vision/camera/USBCameraSource.java +++ b/photon-core/src/main/java/org/photonvision/vision/camera/USBCameraSource.java @@ -14,14 +14,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.camera; -import edu.wpi.cscore.CvSink; -import edu.wpi.cscore.UsbCamera; -import edu.wpi.cscore.VideoException; -import edu.wpi.cscore.VideoMode; import edu.wpi.first.cameraserver.CameraServer; +import edu.wpi.first.cscore.CvSink; +import edu.wpi.first.cscore.UsbCamera; +import edu.wpi.first.cscore.VideoException; +import edu.wpi.first.cscore.VideoMode; import java.util.*; import java.util.stream.Collectors; import org.photonvision.common.configuration.CameraConfiguration; diff --git a/photon-core/src/main/java/org/photonvision/vision/camera/ZeroCopyPicamSource.java b/photon-core/src/main/java/org/photonvision/vision/camera/ZeroCopyPicamSource.java index 995ad8b58..e90cb5c6d 100644 --- a/photon-core/src/main/java/org/photonvision/vision/camera/ZeroCopyPicamSource.java +++ b/photon-core/src/main/java/org/photonvision/vision/camera/ZeroCopyPicamSource.java @@ -14,10 +14,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.camera; -import edu.wpi.cscore.VideoMode; +import edu.wpi.first.cscore.VideoMode; import java.util.HashMap; import org.photonvision.common.configuration.CameraConfiguration; import org.photonvision.common.configuration.ConfigManager; @@ -82,7 +81,6 @@ public class ZeroCopyPicamSource extends VisionSource { } public static class PicamSettables extends VisionSourceSettables { - private FPSRatedVideoMode currentVideoMode; private double lastExposure; private int lastBrightness; diff --git a/photon-core/src/main/java/org/photonvision/vision/frame/Frame.java b/photon-core/src/main/java/org/photonvision/vision/frame/Frame.java index fd029b483..5fe07c00d 100644 --- a/photon-core/src/main/java/org/photonvision/vision/frame/Frame.java +++ b/photon-core/src/main/java/org/photonvision/vision/frame/Frame.java @@ -14,10 +14,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.frame; -import edu.wpi.first.wpilibj.geometry.Rotation2d; +import edu.wpi.first.math.geometry.Rotation2d; import org.photonvision.common.util.math.MathUtils; import org.photonvision.vision.opencv.CVMat; import org.photonvision.vision.opencv.Releasable; diff --git a/photon-core/src/main/java/org/photonvision/vision/frame/FrameConsumer.java b/photon-core/src/main/java/org/photonvision/vision/frame/FrameConsumer.java index c22fe707e..96af8cdc8 100644 --- a/photon-core/src/main/java/org/photonvision/vision/frame/FrameConsumer.java +++ b/photon-core/src/main/java/org/photonvision/vision/frame/FrameConsumer.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.frame; import java.util.function.Consumer; diff --git a/photon-core/src/main/java/org/photonvision/vision/frame/FrameDivisor.java b/photon-core/src/main/java/org/photonvision/vision/frame/FrameDivisor.java index b44ca78d1..2f8d17c10 100644 --- a/photon-core/src/main/java/org/photonvision/vision/frame/FrameDivisor.java +++ b/photon-core/src/main/java/org/photonvision/vision/frame/FrameDivisor.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.frame; public enum FrameDivisor { diff --git a/photon-core/src/main/java/org/photonvision/vision/frame/FrameProvider.java b/photon-core/src/main/java/org/photonvision/vision/frame/FrameProvider.java index 22b4e178f..42ecfe38f 100644 --- a/photon-core/src/main/java/org/photonvision/vision/frame/FrameProvider.java +++ b/photon-core/src/main/java/org/photonvision/vision/frame/FrameProvider.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.frame; import java.util.function.Supplier; diff --git a/photon-core/src/main/java/org/photonvision/vision/frame/FrameStaticProperties.java b/photon-core/src/main/java/org/photonvision/vision/frame/FrameStaticProperties.java index 6cdc9f157..0324e44a4 100644 --- a/photon-core/src/main/java/org/photonvision/vision/frame/FrameStaticProperties.java +++ b/photon-core/src/main/java/org/photonvision/vision/frame/FrameStaticProperties.java @@ -14,11 +14,10 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.frame; -import edu.wpi.cscore.VideoMode; -import edu.wpi.first.wpilibj.geometry.Rotation2d; +import edu.wpi.first.cscore.VideoMode; +import edu.wpi.first.math.geometry.Rotation2d; import org.opencv.core.Point; import org.photonvision.common.util.numbers.DoubleCouple; import org.photonvision.vision.calibration.CameraCalibrationCoefficients; @@ -83,7 +82,6 @@ public class FrameStaticProperties { public static DoubleCouple calculateHorizontalVerticalFoV( double diagonalFoV, int imageWidth, int imageHeight) { - double diagonalView = Math.toRadians(diagonalFoV); double diagonalAspect = Math.hypot(imageWidth, imageHeight); diff --git a/photon-core/src/main/java/org/photonvision/vision/frame/consumer/DummyFrameConsumer.java b/photon-core/src/main/java/org/photonvision/vision/frame/consumer/DummyFrameConsumer.java index 1e9449a35..9e185c1ce 100644 --- a/photon-core/src/main/java/org/photonvision/vision/frame/consumer/DummyFrameConsumer.java +++ b/photon-core/src/main/java/org/photonvision/vision/frame/consumer/DummyFrameConsumer.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.frame.consumer; import org.photonvision.vision.frame.Frame; diff --git a/photon-core/src/main/java/org/photonvision/vision/frame/consumer/FileSaveFrameConsumer.java b/photon-core/src/main/java/org/photonvision/vision/frame/consumer/FileSaveFrameConsumer.java index 61274e73c..feaadfc59 100644 --- a/photon-core/src/main/java/org/photonvision/vision/frame/consumer/FileSaveFrameConsumer.java +++ b/photon-core/src/main/java/org/photonvision/vision/frame/consumer/FileSaveFrameConsumer.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.frame.consumer; import edu.wpi.first.networktables.NetworkTable; @@ -34,7 +33,6 @@ import org.photonvision.common.util.TimedTaskManager; import org.photonvision.vision.frame.Frame; public class FileSaveFrameConsumer implements Consumer { - // Formatters to generate unique, timestamped file names private static String FILE_PATH = ConfigManager.getInstance().getImageSavePath().toString(); private static String FILE_EXTENSION = ".jpg"; @@ -66,7 +64,6 @@ public class FileSaveFrameConsumer implements Consumer { public void accept(Frame frame) { if (frame != null && !frame.image.getMat().empty()) { - if (lock.tryLock()) { boolean curCommand = entry.getBoolean(false); if (curCommand && !prevCommand) { diff --git a/photon-core/src/main/java/org/photonvision/vision/frame/consumer/MJPGFrameConsumer.java b/photon-core/src/main/java/org/photonvision/vision/frame/consumer/MJPGFrameConsumer.java index ebdd01230..7928b812a 100644 --- a/photon-core/src/main/java/org/photonvision/vision/frame/consumer/MJPGFrameConsumer.java +++ b/photon-core/src/main/java/org/photonvision/vision/frame/consumer/MJPGFrameConsumer.java @@ -14,15 +14,14 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.frame.consumer; -import edu.wpi.cscore.CameraServerJNI; -import edu.wpi.cscore.CvSource; -import edu.wpi.cscore.MjpegServer; -import edu.wpi.cscore.VideoEvent; -import edu.wpi.cscore.VideoListener; -import edu.wpi.cscore.VideoMode; +import edu.wpi.first.cscore.CameraServerJNI; +import edu.wpi.first.cscore.CvSource; +import edu.wpi.first.cscore.MjpegServer; +import edu.wpi.first.cscore.VideoEvent; +import edu.wpi.first.cscore.VideoListener; +import edu.wpi.first.cscore.VideoMode; import edu.wpi.first.networktables.NetworkTable; import edu.wpi.first.networktables.NetworkTableInstance; import java.util.ArrayList; @@ -31,7 +30,6 @@ import org.photonvision.vision.frame.Frame; import org.photonvision.vision.frame.FrameDivisor; public class MJPGFrameConsumer { - private CvSource cvSource; private MjpegServer mjpegServer; diff --git a/photon-core/src/main/java/org/photonvision/vision/frame/provider/AcceleratedPicamFrameProvider.java b/photon-core/src/main/java/org/photonvision/vision/frame/provider/AcceleratedPicamFrameProvider.java index 8ce20cd79..2936dd825 100644 --- a/photon-core/src/main/java/org/photonvision/vision/frame/provider/AcceleratedPicamFrameProvider.java +++ b/photon-core/src/main/java/org/photonvision/vision/frame/provider/AcceleratedPicamFrameProvider.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.frame.provider; import org.opencv.core.Mat; @@ -26,7 +25,6 @@ import org.photonvision.vision.opencv.CVMat; import org.photonvision.vision.processes.VisionSourceSettables; public class AcceleratedPicamFrameProvider implements FrameProvider { - private final VisionSourceSettables settables; private CVMat mat; diff --git a/photon-core/src/main/java/org/photonvision/vision/frame/provider/FileFrameProvider.java b/photon-core/src/main/java/org/photonvision/vision/frame/provider/FileFrameProvider.java index 1d9cd605b..f31855674 100644 --- a/photon-core/src/main/java/org/photonvision/vision/frame/provider/FileFrameProvider.java +++ b/photon-core/src/main/java/org/photonvision/vision/frame/provider/FileFrameProvider.java @@ -14,10 +14,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.frame.provider; -import edu.wpi.first.wpilibj.geometry.Rotation2d; +import edu.wpi.first.math.geometry.Rotation2d; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; diff --git a/photon-core/src/main/java/org/photonvision/vision/frame/provider/NetworkFrameProvider.java b/photon-core/src/main/java/org/photonvision/vision/frame/provider/NetworkFrameProvider.java index 26cf1aca3..e3a1c6cc0 100644 --- a/photon-core/src/main/java/org/photonvision/vision/frame/provider/NetworkFrameProvider.java +++ b/photon-core/src/main/java/org/photonvision/vision/frame/provider/NetworkFrameProvider.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.frame.provider; import org.apache.commons.lang3.NotImplementedException; diff --git a/photon-core/src/main/java/org/photonvision/vision/frame/provider/USBFrameProvider.java b/photon-core/src/main/java/org/photonvision/vision/frame/provider/USBFrameProvider.java index c93c740d9..df981b01c 100644 --- a/photon-core/src/main/java/org/photonvision/vision/frame/provider/USBFrameProvider.java +++ b/photon-core/src/main/java/org/photonvision/vision/frame/provider/USBFrameProvider.java @@ -14,10 +14,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.frame.provider; -import edu.wpi.cscore.CvSink; +import edu.wpi.first.cscore.CvSink; import org.photonvision.common.util.math.MathUtils; import org.photonvision.vision.frame.Frame; import org.photonvision.vision.frame.FrameProvider; diff --git a/photon-core/src/main/java/org/photonvision/vision/opencv/CVMat.java b/photon-core/src/main/java/org/photonvision/vision/opencv/CVMat.java index e58f0d11d..e264f45b9 100644 --- a/photon-core/src/main/java/org/photonvision/vision/opencv/CVMat.java +++ b/photon-core/src/main/java/org/photonvision/vision/opencv/CVMat.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.opencv; import java.util.HashMap; diff --git a/photon-core/src/main/java/org/photonvision/vision/opencv/CVShape.java b/photon-core/src/main/java/org/photonvision/vision/opencv/CVShape.java index 71f21cc1d..c5db96aea 100644 --- a/photon-core/src/main/java/org/photonvision/vision/opencv/CVShape.java +++ b/photon-core/src/main/java/org/photonvision/vision/opencv/CVShape.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.opencv; import org.jetbrains.annotations.Nullable; diff --git a/photon-core/src/main/java/org/photonvision/vision/opencv/Contour.java b/photon-core/src/main/java/org/photonvision/vision/opencv/Contour.java index 398e3c34d..d34f222d7 100644 --- a/photon-core/src/main/java/org/photonvision/vision/opencv/Contour.java +++ b/photon-core/src/main/java/org/photonvision/vision/opencv/Contour.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.opencv; import java.util.Comparator; @@ -31,7 +30,6 @@ import org.opencv.imgproc.Moments; import org.photonvision.common.util.math.MathUtils; public class Contour implements Releasable { - public static final Comparator SortByMomentsX = Comparator.comparingDouble( (contour) -> contour.getMoments().get_m10() / contour.getMoments().get_m00()); diff --git a/photon-core/src/main/java/org/photonvision/vision/opencv/ContourGroupingMode.java b/photon-core/src/main/java/org/photonvision/vision/opencv/ContourGroupingMode.java index 86c801169..2ae1a0eae 100644 --- a/photon-core/src/main/java/org/photonvision/vision/opencv/ContourGroupingMode.java +++ b/photon-core/src/main/java/org/photonvision/vision/opencv/ContourGroupingMode.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.opencv; public enum ContourGroupingMode { diff --git a/photon-core/src/main/java/org/photonvision/vision/opencv/ContourIntersectionDirection.java b/photon-core/src/main/java/org/photonvision/vision/opencv/ContourIntersectionDirection.java index d3f97d61e..19a05bef1 100644 --- a/photon-core/src/main/java/org/photonvision/vision/opencv/ContourIntersectionDirection.java +++ b/photon-core/src/main/java/org/photonvision/vision/opencv/ContourIntersectionDirection.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.opencv; public enum ContourIntersectionDirection { diff --git a/photon-core/src/main/java/org/photonvision/vision/opencv/ContourShape.java b/photon-core/src/main/java/org/photonvision/vision/opencv/ContourShape.java index 4eac4d847..1886ed2bb 100644 --- a/photon-core/src/main/java/org/photonvision/vision/opencv/ContourShape.java +++ b/photon-core/src/main/java/org/photonvision/vision/opencv/ContourShape.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.opencv; import java.util.EnumSet; diff --git a/photon-core/src/main/java/org/photonvision/vision/opencv/ContourSortMode.java b/photon-core/src/main/java/org/photonvision/vision/opencv/ContourSortMode.java index d4cf359e4..3831712b5 100644 --- a/photon-core/src/main/java/org/photonvision/vision/opencv/ContourSortMode.java +++ b/photon-core/src/main/java/org/photonvision/vision/opencv/ContourSortMode.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.opencv; import java.util.Comparator; diff --git a/photon-core/src/main/java/org/photonvision/vision/opencv/DualMat.java b/photon-core/src/main/java/org/photonvision/vision/opencv/DualMat.java index f2adb4a92..1fc172af2 100644 --- a/photon-core/src/main/java/org/photonvision/vision/opencv/DualMat.java +++ b/photon-core/src/main/java/org/photonvision/vision/opencv/DualMat.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.opencv; import org.opencv.core.Mat; diff --git a/photon-core/src/main/java/org/photonvision/vision/opencv/DualOffsetValues.java b/photon-core/src/main/java/org/photonvision/vision/opencv/DualOffsetValues.java index c7b2ac04f..80e8b1d5a 100644 --- a/photon-core/src/main/java/org/photonvision/vision/opencv/DualOffsetValues.java +++ b/photon-core/src/main/java/org/photonvision/vision/opencv/DualOffsetValues.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.opencv; import org.opencv.core.Point; diff --git a/photon-core/src/main/java/org/photonvision/vision/opencv/ImageFlipMode.java b/photon-core/src/main/java/org/photonvision/vision/opencv/ImageFlipMode.java index 6fa456e7a..06c46c45d 100644 --- a/photon-core/src/main/java/org/photonvision/vision/opencv/ImageFlipMode.java +++ b/photon-core/src/main/java/org/photonvision/vision/opencv/ImageFlipMode.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.opencv; public enum ImageFlipMode { diff --git a/photon-core/src/main/java/org/photonvision/vision/opencv/ImageRotationMode.java b/photon-core/src/main/java/org/photonvision/vision/opencv/ImageRotationMode.java index e72dd50e2..e031fd21d 100644 --- a/photon-core/src/main/java/org/photonvision/vision/opencv/ImageRotationMode.java +++ b/photon-core/src/main/java/org/photonvision/vision/opencv/ImageRotationMode.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.opencv; public enum ImageRotationMode { diff --git a/photon-core/src/main/java/org/photonvision/vision/opencv/Releasable.java b/photon-core/src/main/java/org/photonvision/vision/opencv/Releasable.java index dc7667888..7fd23e819 100644 --- a/photon-core/src/main/java/org/photonvision/vision/opencv/Releasable.java +++ b/photon-core/src/main/java/org/photonvision/vision/opencv/Releasable.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.opencv; public interface Releasable { diff --git a/photon-core/src/main/java/org/photonvision/vision/pipe/CVPipe.java b/photon-core/src/main/java/org/photonvision/vision/pipe/CVPipe.java index 95538c07f..c02604230 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipe/CVPipe.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipe/CVPipe.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipe; /** @@ -26,7 +25,6 @@ package org.photonvision.vision.pipe; * @param

Parameters type for the pipe */ public abstract class CVPipe { - protected CVPipeResult result = new CVPipeResult<>(); protected P params; diff --git a/photon-core/src/main/java/org/photonvision/vision/pipe/MutatingPipe.java b/photon-core/src/main/java/org/photonvision/vision/pipe/MutatingPipe.java index 14e8f5ea3..ed20880ab 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipe/MutatingPipe.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipe/MutatingPipe.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipe; public abstract class MutatingPipe extends CVPipe {} diff --git a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/BlurPipe.java b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/BlurPipe.java index 885ede841..696f70c5a 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/BlurPipe.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/BlurPipe.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipe.impl; import org.opencv.core.Mat; diff --git a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/CalculateFPSPipe.java b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/CalculateFPSPipe.java index 1e709fae8..06270abef 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/CalculateFPSPipe.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/CalculateFPSPipe.java @@ -14,16 +14,14 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipe.impl; -import edu.wpi.first.wpilibj.LinearFilter; +import edu.wpi.first.math.filter.LinearFilter; import org.apache.commons.lang3.time.StopWatch; import org.photonvision.vision.pipe.CVPipe; public class CalculateFPSPipe extends CVPipe { - private LinearFilter fpsFilter = LinearFilter.movingAverage(20); StopWatch clock = new StopWatch(); diff --git a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/Calibrate3dPipe.java b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/Calibrate3dPipe.java index 0d7283a96..f23aac210 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/Calibrate3dPipe.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/Calibrate3dPipe.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipe.impl; import com.fasterxml.jackson.core.JsonProcessingException; @@ -36,7 +35,6 @@ public class Calibrate3dPipe List>, CameraCalibrationCoefficients, Calibrate3dPipe.CalibratePipeParams> { - // Camera matrix stores the center of the image and focal length across the x and y-axis in a 3x3 // matrix private Mat cameraMatrix = new Mat(); diff --git a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/Collect2dTargetsPipe.java b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/Collect2dTargetsPipe.java index 19129d1eb..9f7264fc3 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/Collect2dTargetsPipe.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/Collect2dTargetsPipe.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipe.impl; import java.util.ArrayList; @@ -29,7 +28,6 @@ import org.photonvision.vision.target.*; public class Collect2dTargetsPipe extends CVPipe< List, List, Collect2dTargetsPipe.Collect2dTargetsParams> { - /** * Processes this pipeline. * diff --git a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/CornerDetectionPipe.java b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/CornerDetectionPipe.java index f4c5c485c..21098412c 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/CornerDetectionPipe.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/CornerDetectionPipe.java @@ -14,10 +14,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipe.impl; -import edu.wpi.first.wpilibj.geometry.Translation2d; +import edu.wpi.first.math.geometry.Translation2d; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; @@ -33,7 +32,6 @@ public class CornerDetectionPipe List, List, CornerDetectionPipe.CornerDetectionPipeParameters> { - Comparator leftRightComparator = Comparator.comparingDouble(point -> point.x); Comparator verticalComparator = Comparator.comparingDouble(point -> point.y); MatOfPoint2f polyOutput = new MatOfPoint2f(); diff --git a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/Draw2dCrosshairPipe.java b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/Draw2dCrosshairPipe.java index c47b3bc44..55e9186df 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/Draw2dCrosshairPipe.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/Draw2dCrosshairPipe.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipe.impl; import java.awt.Color; @@ -35,7 +34,6 @@ import org.photonvision.vision.target.TrackedTarget; public class Draw2dCrosshairPipe extends MutatingPipe< Pair>, Draw2dCrosshairPipe.Draw2dCrosshairParams> { - @Override protected Void process(Pair> in) { if (!params.shouldDraw) return null; diff --git a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/Draw2dTargetsPipe.java b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/Draw2dTargetsPipe.java index 1752af0a2..c8e8cb6fc 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/Draw2dTargetsPipe.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/Draw2dTargetsPipe.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipe.impl; import java.awt.*; @@ -34,7 +33,6 @@ import org.photonvision.vision.target.TrackedTarget; public class Draw2dTargetsPipe extends MutatingPipe>, Draw2dTargetsPipe.Draw2dTargetsParams> { - MatOfPoint tempMat = new MatOfPoint(); private static final Logger logger = new Logger(Draw2dTargetsPipe.class, LogGroup.General); @@ -53,7 +51,6 @@ public class Draw2dTargetsPipe || params.showMaximumBox || params.showRotatedBox || params.showShape)) { - var centroidColour = ColorHelper.colorToScalar(params.centroidColor); var maximumBoxColour = ColorHelper.colorToScalar(params.maximumBoxColor); var rotatedBoxColour = ColorHelper.colorToScalar(params.rotatedBoxColor); @@ -147,7 +144,6 @@ public class Draw2dTargetsPipe } if (params.showCentroid) { - Point centroid = target.getTargetOffsetPoint().clone(); dividePoint(centroid); var crosshairRadius = (int) (imageSize * params.kPixelsToCentroidRadius); diff --git a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/Draw3dTargetsPipe.java b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/Draw3dTargetsPipe.java index 5bf002dc8..2313e2543 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/Draw3dTargetsPipe.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/Draw3dTargetsPipe.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipe.impl; import java.awt.*; @@ -37,7 +36,6 @@ import org.photonvision.vision.target.TrackedTarget; public class Draw3dTargetsPipe extends MutatingPipe>, Draw3dTargetsPipe.Draw3dContoursParams> { - Logger logger = new Logger(Draw3dTargetsPipe.class, LogGroup.VisionModule); @Override @@ -45,7 +43,6 @@ public class Draw3dTargetsPipe if (!params.shouldDraw) return null; for (var target : in.getRight()) { - // draw convex hull var pointMat = new MatOfPoint(); divideMat2f(target.m_mainContour.getConvexHull(), pointMat); diff --git a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/DrawCornerDetectionPipe.java b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/DrawCornerDetectionPipe.java index 544f0a646..0685fadbf 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/DrawCornerDetectionPipe.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/DrawCornerDetectionPipe.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipe.impl; import java.util.List; @@ -27,7 +26,6 @@ import org.photonvision.vision.target.TrackedTarget; public class DrawCornerDetectionPipe extends MutatingPipe>, DrawCornerDetectionPipe.DrawCornerParams> { - @Override protected Void process(Pair> in) { Mat image = in.getLeft(); diff --git a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/ErodeDilatePipe.java b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/ErodeDilatePipe.java index 9d09a5d19..baafccb68 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/ErodeDilatePipe.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/ErodeDilatePipe.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipe.impl; import org.opencv.core.Mat; diff --git a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FilterContoursPipe.java b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FilterContoursPipe.java index ec5d74369..ccd1c4808 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FilterContoursPipe.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FilterContoursPipe.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipe.impl; import java.util.ArrayList; @@ -28,7 +27,6 @@ import org.photonvision.vision.pipe.CVPipe; public class FilterContoursPipe extends CVPipe, List, FilterContoursPipe.FilterContoursParams> { - List m_filteredContours = new ArrayList<>(); @Override diff --git a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FilterShapesPipe.java b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FilterShapesPipe.java index e0df8d3d8..9784930ef 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FilterShapesPipe.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FilterShapesPipe.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipe.impl; import java.util.ArrayList; @@ -26,7 +25,6 @@ import org.photonvision.vision.pipe.CVPipe; public class FilterShapesPipe extends CVPipe, List, FilterShapesPipe.FilterShapesPipeParams> { - List outputList = new ArrayList<>(); /** diff --git a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FindBoardCornersPipe.java b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FindBoardCornersPipe.java index 49764fd86..6e2109d14 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FindBoardCornersPipe.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FindBoardCornersPipe.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipe.impl; import java.util.Objects; @@ -117,7 +116,6 @@ public class FindBoardCornersPipe */ @Override protected Triple process(Pair in) { - // Create the object points createObjectPoints(); @@ -158,7 +156,6 @@ public class FindBoardCornersPipe private double getApproxMinSpacing(MatOfPoint2f inPoints) { double minSpacing = Double.MAX_VALUE; for (int pointIdx = 0; pointIdx < inPoints.height() - 1; pointIdx += 2) { - // +1 idx Neighbor distance double[] startPoint = inPoints.get(pointIdx, 0); double[] endPoint = inPoints.get(pointIdx + 1, 0); @@ -293,7 +290,6 @@ public class FindBoardCornersPipe } public static class FindCornersPipeParams { - private final int boardHeight; private final int boardWidth; private final UICalibrationData.BoardType type; diff --git a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FindCirclesPipe.java b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FindCirclesPipe.java index 1779e689f..36283a9c6 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FindCirclesPipe.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FindCirclesPipe.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipe.impl; import java.util.ArrayList; @@ -30,7 +29,6 @@ import org.photonvision.vision.pipe.CVPipe; public class FindCirclesPipe extends CVPipe>, List, FindCirclesPipe.FindCirclePipeParams> { - // Output vector of found circles. Each vector is encoded as 3 or 4 element floating-point vector // (x,y,radius) or (x,y,radius,votes) . private final Mat circles = new Mat(); diff --git a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FindContoursPipe.java b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FindContoursPipe.java index 5ce32c9d6..70532f72b 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FindContoursPipe.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FindContoursPipe.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipe.impl; import java.util.ArrayList; @@ -28,7 +27,6 @@ import org.photonvision.vision.pipe.CVPipe; public class FindContoursPipe extends CVPipe, FindContoursPipe.FindContoursParams> { - private final List m_foundContours = new ArrayList<>(); @Override diff --git a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FindPolygonPipe.java b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FindPolygonPipe.java index 4929ee5b6..8ee392f8e 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FindPolygonPipe.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FindPolygonPipe.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipe.impl; import java.util.ArrayList; @@ -50,7 +49,6 @@ public class FindPolygonPipe } private CVShape getShape(Contour in) { - int corners = getCorners(in); /*The contourShape enum has predefined shapes for Circles, Triangles, and Quads diff --git a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/GPUAcceleratedHSVPipe.java b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/GPUAcceleratedHSVPipe.java index a2df7190f..02f664d0b 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/GPUAcceleratedHSVPipe.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/GPUAcceleratedHSVPipe.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipe.impl; import static com.jogamp.opengl.GL.*; @@ -35,7 +34,6 @@ import org.photonvision.common.logging.Logger; import org.photonvision.vision.pipe.CVPipe; public class GPUAcceleratedHSVPipe extends CVPipe { - private static final String k_vertexShader = String.join( "\n", @@ -252,7 +250,6 @@ public class GPUAcceleratedHSVPipe extends CVPipe { IntBuffer status = GLBuffers.newDirectIntBuffer(1); gl.glGetProgramiv(programId, GL_LINK_STATUS, status); if (status.get(0) == GL_FALSE) { - IntBuffer infoLogLength = GLBuffers.newDirectIntBuffer(1); gl.glGetProgramiv(programId, GL_INFO_LOG_LENGTH, infoLogLength); diff --git a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/GroupContoursPipe.java b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/GroupContoursPipe.java index 258a11afa..e0519f0cb 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/GroupContoursPipe.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/GroupContoursPipe.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipe.impl; import java.util.ArrayList; @@ -28,7 +27,6 @@ import org.photonvision.vision.target.PotentialTarget; public class GroupContoursPipe extends CVPipe, List, GroupContoursPipe.GroupContoursParams> { - private final List m_targets = new ArrayList<>(); @Override diff --git a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/HSVPipe.java b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/HSVPipe.java index 3c10a8e1a..cbe916fb2 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/HSVPipe.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/HSVPipe.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipe.impl; import org.opencv.core.Core; diff --git a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/OutputMatPipe.java b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/OutputMatPipe.java index 0880307a4..f51002d04 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/OutputMatPipe.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/OutputMatPipe.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipe.impl; import org.opencv.core.Mat; @@ -22,7 +21,6 @@ import org.opencv.imgproc.Imgproc; import org.photonvision.vision.pipe.MutatingPipe; public class OutputMatPipe extends MutatingPipe { - @Override protected Void process(Mat in) { // convert input mat diff --git a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/ResizeImagePipe.java b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/ResizeImagePipe.java index 29f036016..227174815 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/ResizeImagePipe.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/ResizeImagePipe.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipe.impl; import org.opencv.core.Mat; @@ -25,7 +24,6 @@ import org.photonvision.vision.pipe.MutatingPipe; /** Pipe that resizes an image to a given resolution */ public class ResizeImagePipe extends MutatingPipe { - /** * Process this pipe * diff --git a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/RotateImagePipe.java b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/RotateImagePipe.java index e32ec6cef..8fa7a471f 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/RotateImagePipe.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/RotateImagePipe.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipe.impl; import org.opencv.core.Core; @@ -24,7 +23,6 @@ import org.photonvision.vision.pipe.MutatingPipe; /** Pipe that rotates an image to a given orientation */ public class RotateImagePipe extends MutatingPipe { - public RotateImagePipe() { setParams(RotateImageParams.DEFAULT); } diff --git a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/SolvePNPPipe.java b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/SolvePNPPipe.java index f760905f3..dad7320bd 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/SolvePNPPipe.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/SolvePNPPipe.java @@ -14,12 +14,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipe.impl; -import edu.wpi.first.wpilibj.geometry.Rotation2d; -import edu.wpi.first.wpilibj.geometry.Transform2d; -import edu.wpi.first.wpilibj.geometry.Translation2d; +import edu.wpi.first.math.geometry.Rotation2d; +import edu.wpi.first.math.geometry.Transform2d; +import edu.wpi.first.math.geometry.Translation2d; import java.util.List; import org.opencv.calib3d.Calib3d; import org.opencv.core.Core; @@ -35,7 +34,6 @@ import org.photonvision.vision.target.TrackedTarget; public class SolvePNPPipe extends CVPipe, List, SolvePNPPipe.SolvePNPPipeParams> { - private static final Logger logger = new Logger(SolvePNPPipe.class, LogGroup.VisionModule); private final MatOfPoint2f imagePoints = new MatOfPoint2f(); diff --git a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/SortContoursPipe.java b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/SortContoursPipe.java index 066db5cb0..d104689e9 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/SortContoursPipe.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/SortContoursPipe.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipe.impl; import java.util.ArrayList; @@ -28,7 +27,6 @@ import org.photonvision.vision.target.PotentialTarget; public class SortContoursPipe extends CVPipe< List, List, SortContoursPipe.SortContoursParams> { - private final List m_sortedContours = new ArrayList<>(); @Override diff --git a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/SpeckleRejectPipe.java b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/SpeckleRejectPipe.java index c08a2cb8e..b1cef4950 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/SpeckleRejectPipe.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/SpeckleRejectPipe.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipe.impl; import java.util.ArrayList; @@ -24,7 +23,6 @@ import org.photonvision.vision.pipe.CVPipe; public class SpeckleRejectPipe extends CVPipe, List, SpeckleRejectPipe.SpeckleRejectParams> { - private final List m_despeckledContours = new ArrayList<>(); @Override diff --git a/photon-core/src/main/java/org/photonvision/vision/pipeline/AdvancedPipelineSettings.java b/photon-core/src/main/java/org/photonvision/vision/pipeline/AdvancedPipelineSettings.java index 56522d6d3..2e45c4e40 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipeline/AdvancedPipelineSettings.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipeline/AdvancedPipelineSettings.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipeline; import java.util.Objects; @@ -31,7 +30,6 @@ import org.photonvision.vision.target.TargetOffsetPointEdge; import org.photonvision.vision.target.TargetOrientation; public class AdvancedPipelineSettings extends CVPipelineSettings { - public AdvancedPipelineSettings() { ledMode = true; } diff --git a/photon-core/src/main/java/org/photonvision/vision/pipeline/CVPipeline.java b/photon-core/src/main/java/org/photonvision/vision/pipeline/CVPipeline.java index 53b035ce2..000063821 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipeline/CVPipeline.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipeline/CVPipeline.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipeline; import java.util.List; diff --git a/photon-core/src/main/java/org/photonvision/vision/pipeline/CVPipelineSettings.java b/photon-core/src/main/java/org/photonvision/vision/pipeline/CVPipelineSettings.java index 82fa44f00..d1f0b3e1c 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipeline/CVPipelineSettings.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipeline/CVPipelineSettings.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipeline; import com.fasterxml.jackson.annotation.JsonSubTypes; diff --git a/photon-core/src/main/java/org/photonvision/vision/pipeline/Calibrate3dPipeline.java b/photon-core/src/main/java/org/photonvision/vision/pipeline/Calibrate3dPipeline.java index 7811002bd..fbc48123d 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipeline/Calibrate3dPipeline.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipeline/Calibrate3dPipeline.java @@ -14,10 +14,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipeline; -import edu.wpi.first.wpilibj.util.Units; +import edu.wpi.first.math.util.Units; import java.nio.file.Path; import java.util.ArrayList; import java.util.Collections; @@ -47,7 +46,6 @@ import org.photonvision.vision.pipeline.result.CVPipelineResult; public class Calibrate3dPipeline extends CVPipeline { - // For loggging private static final Logger logger = new Logger(Calibrate3dPipeline.class, LogGroup.General); diff --git a/photon-core/src/main/java/org/photonvision/vision/pipeline/Calibration3dPipelineSettings.java b/photon-core/src/main/java/org/photonvision/vision/pipeline/Calibration3dPipelineSettings.java index ace018430..3dd0b1b00 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipeline/Calibration3dPipelineSettings.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipeline/Calibration3dPipelineSettings.java @@ -14,10 +14,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipeline; -import edu.wpi.first.wpilibj.util.Units; +import edu.wpi.first.math.util.Units; import org.opencv.core.Size; public class Calibration3dPipelineSettings extends AdvancedPipelineSettings { diff --git a/photon-core/src/main/java/org/photonvision/vision/pipeline/ColoredShapePipeline.java b/photon-core/src/main/java/org/photonvision/vision/pipeline/ColoredShapePipeline.java index 8b98b7cd0..598f4b92e 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipeline/ColoredShapePipeline.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipeline/ColoredShapePipeline.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipeline; import java.util.Arrays; @@ -37,7 +36,6 @@ import org.photonvision.vision.target.TrackedTarget; @SuppressWarnings({"DuplicatedCode"}) public class ColoredShapePipeline extends CVPipeline { - private final RotateImagePipe rotateImagePipe = new RotateImagePipe(); private final ErodeDilatePipe erodeDilatePipe = new ErodeDilatePipe(); private final HSVPipe hsvPipe = new HSVPipe(); @@ -67,7 +65,6 @@ public class ColoredShapePipeline @Override protected void setPipeParamsImpl() { - DualOffsetValues dualOffsetValues = new DualOffsetValues( settings.offsetDualPointA, diff --git a/photon-core/src/main/java/org/photonvision/vision/pipeline/ColoredShapePipelineSettings.java b/photon-core/src/main/java/org/photonvision/vision/pipeline/ColoredShapePipelineSettings.java index c1568f0f7..40a67a56c 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipeline/ColoredShapePipelineSettings.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipeline/ColoredShapePipelineSettings.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipeline; import com.fasterxml.jackson.annotation.JsonTypeName; diff --git a/photon-core/src/main/java/org/photonvision/vision/pipeline/DriverModePipeline.java b/photon-core/src/main/java/org/photonvision/vision/pipeline/DriverModePipeline.java index 2a17e4136..86df43648 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipeline/DriverModePipeline.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipeline/DriverModePipeline.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipeline; import java.util.List; @@ -33,7 +32,6 @@ import org.photonvision.vision.pipeline.result.DriverModePipelineResult; public class DriverModePipeline extends CVPipeline { - private final RotateImagePipe rotateImagePipe = new RotateImagePipe(); private final Draw2dCrosshairPipe draw2dCrosshairPipe = new Draw2dCrosshairPipe(); private final CalculateFPSPipe calculateFPSPipe = new CalculateFPSPipe(); diff --git a/photon-core/src/main/java/org/photonvision/vision/pipeline/DriverModePipelineSettings.java b/photon-core/src/main/java/org/photonvision/vision/pipeline/DriverModePipelineSettings.java index 25911458e..1011bead7 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipeline/DriverModePipelineSettings.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipeline/DriverModePipelineSettings.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipeline; import com.fasterxml.jackson.annotation.JsonTypeName; diff --git a/photon-core/src/main/java/org/photonvision/vision/pipeline/OutputStreamPipeline.java b/photon-core/src/main/java/org/photonvision/vision/pipeline/OutputStreamPipeline.java index 6c5b92259..623ec30d9 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipeline/OutputStreamPipeline.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipeline/OutputStreamPipeline.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipeline; import java.util.List; @@ -33,7 +32,6 @@ import org.photonvision.vision.target.TrackedTarget; * shall not get its settings saved, nor shall it be managed by PipelineManager */ public class OutputStreamPipeline { - private final OutputMatPipe outputMatPipe = new OutputMatPipe(); private final Draw2dCrosshairPipe draw2dCrosshairPipe = new Draw2dCrosshairPipe(); private final Draw2dTargetsPipe draw2dTargetsPipe = new Draw2dTargetsPipe(); @@ -45,7 +43,6 @@ public class OutputStreamPipeline { protected void setPipeParams( FrameStaticProperties frameStaticProperties, AdvancedPipelineSettings settings) { - var dualOffsetValues = new DualOffsetValues( settings.offsetDualPointA, diff --git a/photon-core/src/main/java/org/photonvision/vision/pipeline/PipelineProfiler.java b/photon-core/src/main/java/org/photonvision/vision/pipeline/PipelineProfiler.java index 8a0508666..934036201 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipeline/PipelineProfiler.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipeline/PipelineProfiler.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipeline; import org.photonvision.common.logging.LogGroup; @@ -22,7 +21,6 @@ import org.photonvision.common.logging.Logger; import org.photonvision.common.util.math.MathUtils; public class PipelineProfiler { - private static boolean shouldLog; private static final Logger reflectiveLogger = diff --git a/photon-core/src/main/java/org/photonvision/vision/pipeline/PipelineType.java b/photon-core/src/main/java/org/photonvision/vision/pipeline/PipelineType.java index 28e497a1b..502cce9b2 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipeline/PipelineType.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipeline/PipelineType.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipeline; @SuppressWarnings("rawtypes") diff --git a/photon-core/src/main/java/org/photonvision/vision/pipeline/ReflectivePipeline.java b/photon-core/src/main/java/org/photonvision/vision/pipeline/ReflectivePipeline.java index 5800c5a42..9e0ca5b20 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipeline/ReflectivePipeline.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipeline/ReflectivePipeline.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipeline; import java.util.List; @@ -35,7 +34,6 @@ import org.photonvision.vision.target.TrackedTarget; /** Represents a pipeline for tracking retro-reflective targets. */ @SuppressWarnings({"DuplicatedCode"}) public class ReflectivePipeline extends CVPipeline { - private final RotateImagePipe rotateImagePipe = new RotateImagePipe(); private final HSVPipe hsvPipe = new HSVPipe(); private final FindContoursPipe findContoursPipe = new FindContoursPipe(); @@ -60,7 +58,6 @@ public class ReflectivePipeline extends CVPipeline. */ - package org.photonvision.vision.pipeline; import com.fasterxml.jackson.annotation.JsonTypeName; diff --git a/photon-core/src/main/java/org/photonvision/vision/pipeline/UICalibrationData.java b/photon-core/src/main/java/org/photonvision/vision/pipeline/UICalibrationData.java index 287e27197..74790474e 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipeline/UICalibrationData.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipeline/UICalibrationData.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipeline; import java.util.Map; diff --git a/photon-core/src/main/java/org/photonvision/vision/pipeline/result/BytePackable.java b/photon-core/src/main/java/org/photonvision/vision/pipeline/result/BytePackable.java index c729d35f6..9f15184dc 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipeline/result/BytePackable.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipeline/result/BytePackable.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipeline.result; @SuppressWarnings("PointlessBitwiseExpression") diff --git a/photon-core/src/main/java/org/photonvision/vision/pipeline/result/CVPipelineResult.java b/photon-core/src/main/java/org/photonvision/vision/pipeline/result/CVPipelineResult.java index 4f902ab00..f8dfb3b9e 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipeline/result/CVPipelineResult.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipeline/result/CVPipelineResult.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipeline.result; import java.util.Collections; diff --git a/photon-core/src/main/java/org/photonvision/vision/pipeline/result/DriverModePipelineResult.java b/photon-core/src/main/java/org/photonvision/vision/pipeline/result/DriverModePipelineResult.java index 609a3f448..5da88acc3 100644 --- a/photon-core/src/main/java/org/photonvision/vision/pipeline/result/DriverModePipelineResult.java +++ b/photon-core/src/main/java/org/photonvision/vision/pipeline/result/DriverModePipelineResult.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipeline.result; import java.util.List; diff --git a/photon-core/src/main/java/org/photonvision/vision/processes/Data.java b/photon-core/src/main/java/org/photonvision/vision/processes/Data.java index c146a0e27..2bdb19b0d 100644 --- a/photon-core/src/main/java/org/photonvision/vision/processes/Data.java +++ b/photon-core/src/main/java/org/photonvision/vision/processes/Data.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.processes; import org.photonvision.vision.opencv.Releasable; diff --git a/photon-core/src/main/java/org/photonvision/vision/processes/PipelineManager.java b/photon-core/src/main/java/org/photonvision/vision/processes/PipelineManager.java index 3fe138f8b..e22056a2f 100644 --- a/photon-core/src/main/java/org/photonvision/vision/processes/PipelineManager.java +++ b/photon-core/src/main/java/org/photonvision/vision/processes/PipelineManager.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.processes; import java.util.ArrayList; diff --git a/photon-core/src/main/java/org/photonvision/vision/processes/VisionModule.java b/photon-core/src/main/java/org/photonvision/vision/processes/VisionModule.java index 803f2f460..5fe6a8a26 100644 --- a/photon-core/src/main/java/org/photonvision/vision/processes/VisionModule.java +++ b/photon-core/src/main/java/org/photonvision/vision/processes/VisionModule.java @@ -14,11 +14,10 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.processes; -import edu.wpi.first.wpilibj.geometry.Rotation2d; -import edu.wpi.first.wpilibj.util.Units; +import edu.wpi.first.math.geometry.Rotation2d; +import edu.wpi.first.math.util.Units; import io.javalin.websocket.WsContext; import java.util.*; import org.photonvision.common.configuration.CameraConfiguration; @@ -57,7 +56,6 @@ import org.photonvision.vision.target.TrackedTarget; * provide info on settings changes. VisionModuleManager holds a list of all current vision modules. */ public class VisionModule { - private static final int streamFPSCap = 30; private final Logger logger; diff --git a/photon-core/src/main/java/org/photonvision/vision/processes/VisionModuleChangeSubscriber.java b/photon-core/src/main/java/org/photonvision/vision/processes/VisionModuleChangeSubscriber.java index 1966a40f8..923054275 100644 --- a/photon-core/src/main/java/org/photonvision/vision/processes/VisionModuleChangeSubscriber.java +++ b/photon-core/src/main/java/org/photonvision/vision/processes/VisionModuleChangeSubscriber.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.processes; import java.util.ArrayList; @@ -35,7 +34,6 @@ import org.photonvision.vision.target.RobotOffsetPointOperation; @SuppressWarnings("unchecked") public class VisionModuleChangeSubscriber extends DataChangeSubscriber { - private final VisionModule parentModule; private final Logger logger; diff --git a/photon-core/src/main/java/org/photonvision/vision/processes/VisionModuleManager.java b/photon-core/src/main/java/org/photonvision/vision/processes/VisionModuleManager.java index 0075e9825..168fb531e 100644 --- a/photon-core/src/main/java/org/photonvision/vision/processes/VisionModuleManager.java +++ b/photon-core/src/main/java/org/photonvision/vision/processes/VisionModuleManager.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.processes; import java.util.*; @@ -22,7 +21,6 @@ import java.util.stream.Collectors; /** VisionModuleManager has many VisionModules, and provides camera configuration data to them. */ public class VisionModuleManager { - private static class ThreadSafeSingleton { private static final VisionModuleManager INSTANCE = new VisionModuleManager(); } diff --git a/photon-core/src/main/java/org/photonvision/vision/processes/VisionRunner.java b/photon-core/src/main/java/org/photonvision/vision/processes/VisionRunner.java index 1f415e5de..979dc4e5c 100644 --- a/photon-core/src/main/java/org/photonvision/vision/processes/VisionRunner.java +++ b/photon-core/src/main/java/org/photonvision/vision/processes/VisionRunner.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.processes; import java.util.function.Consumer; @@ -30,7 +29,6 @@ import org.photonvision.vision.pipeline.result.CVPipelineResult; /** VisionRunner has a frame supplier, a pipeline supplier, and a result consumer */ @SuppressWarnings("rawtypes") public class VisionRunner { - private final Logger logger; private final Thread visionProcessThread; private final Supplier frameSupplier; diff --git a/photon-core/src/main/java/org/photonvision/vision/processes/VisionSource.java b/photon-core/src/main/java/org/photonvision/vision/processes/VisionSource.java index 1dfcf66cb..d78f1a367 100644 --- a/photon-core/src/main/java/org/photonvision/vision/processes/VisionSource.java +++ b/photon-core/src/main/java/org/photonvision/vision/processes/VisionSource.java @@ -14,14 +14,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.processes; import org.photonvision.common.configuration.CameraConfiguration; import org.photonvision.vision.frame.FrameProvider; public abstract class VisionSource { - protected final CameraConfiguration cameraConfiguration; protected VisionSource(CameraConfiguration cameraConfiguration) { diff --git a/photon-core/src/main/java/org/photonvision/vision/processes/VisionSourceManager.java b/photon-core/src/main/java/org/photonvision/vision/processes/VisionSourceManager.java index 49b5f54b1..f45480b34 100644 --- a/photon-core/src/main/java/org/photonvision/vision/processes/VisionSourceManager.java +++ b/photon-core/src/main/java/org/photonvision/vision/processes/VisionSourceManager.java @@ -14,11 +14,10 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.processes; -import edu.wpi.cscore.UsbCamera; -import edu.wpi.cscore.UsbCameraInfo; +import edu.wpi.first.cscore.UsbCamera; +import edu.wpi.first.cscore.UsbCameraInfo; import java.util.*; import java.util.concurrent.CopyOnWriteArrayList; import java.util.function.Supplier; @@ -36,7 +35,6 @@ import org.photonvision.vision.camera.USBCameraSource; import org.photonvision.vision.camera.ZeroCopyPicamSource; public class VisionSourceManager { - private static final Logger logger = new Logger(VisionSourceManager.class, LogGroup.Camera); private static final List deviceBlacklist = List.of("bcm2835-isp"); diff --git a/photon-core/src/main/java/org/photonvision/vision/processes/VisionSourceSettables.java b/photon-core/src/main/java/org/photonvision/vision/processes/VisionSourceSettables.java index 9dbb2ee0c..664cad8ee 100644 --- a/photon-core/src/main/java/org/photonvision/vision/processes/VisionSourceSettables.java +++ b/photon-core/src/main/java/org/photonvision/vision/processes/VisionSourceSettables.java @@ -14,11 +14,10 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.processes; -import edu.wpi.cscore.VideoMode; -import edu.wpi.first.wpilibj.geometry.Rotation2d; +import edu.wpi.first.cscore.VideoMode; +import edu.wpi.first.math.geometry.Rotation2d; import java.util.HashMap; import org.photonvision.common.configuration.CameraConfiguration; import org.photonvision.common.logging.LogGroup; diff --git a/photon-core/src/main/java/org/photonvision/vision/target/PotentialTarget.java b/photon-core/src/main/java/org/photonvision/vision/target/PotentialTarget.java index 5e1ae399e..deb3de569 100644 --- a/photon-core/src/main/java/org/photonvision/vision/target/PotentialTarget.java +++ b/photon-core/src/main/java/org/photonvision/vision/target/PotentialTarget.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.target; import java.util.ArrayList; diff --git a/photon-core/src/main/java/org/photonvision/vision/target/RobotOffsetPointMode.java b/photon-core/src/main/java/org/photonvision/vision/target/RobotOffsetPointMode.java index caa5bf331..434e2de6f 100644 --- a/photon-core/src/main/java/org/photonvision/vision/target/RobotOffsetPointMode.java +++ b/photon-core/src/main/java/org/photonvision/vision/target/RobotOffsetPointMode.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.target; public enum RobotOffsetPointMode { diff --git a/photon-core/src/main/java/org/photonvision/vision/target/RobotOffsetPointOperation.java b/photon-core/src/main/java/org/photonvision/vision/target/RobotOffsetPointOperation.java index 34f2ad249..0e69fe9d8 100644 --- a/photon-core/src/main/java/org/photonvision/vision/target/RobotOffsetPointOperation.java +++ b/photon-core/src/main/java/org/photonvision/vision/target/RobotOffsetPointOperation.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.target; public enum RobotOffsetPointOperation { diff --git a/photon-core/src/main/java/org/photonvision/vision/target/TargetCalculations.java b/photon-core/src/main/java/org/photonvision/vision/target/TargetCalculations.java index c0633a2e5..d8bead93c 100644 --- a/photon-core/src/main/java/org/photonvision/vision/target/TargetCalculations.java +++ b/photon-core/src/main/java/org/photonvision/vision/target/TargetCalculations.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.target; import org.opencv.core.Point; diff --git a/photon-core/src/main/java/org/photonvision/vision/target/TargetModel.java b/photon-core/src/main/java/org/photonvision/vision/target/TargetModel.java index da505b72f..7b0ac40df 100644 --- a/photon-core/src/main/java/org/photonvision/vision/target/TargetModel.java +++ b/photon-core/src/main/java/org/photonvision/vision/target/TargetModel.java @@ -14,13 +14,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.target; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; -import edu.wpi.first.wpilibj.util.Units; +import edu.wpi.first.math.util.Units; import java.util.ArrayList; import java.util.List; import org.opencv.core.MatOfPoint3f; diff --git a/photon-core/src/main/java/org/photonvision/vision/target/TargetOffsetPointEdge.java b/photon-core/src/main/java/org/photonvision/vision/target/TargetOffsetPointEdge.java index add407ea3..eccf287ec 100644 --- a/photon-core/src/main/java/org/photonvision/vision/target/TargetOffsetPointEdge.java +++ b/photon-core/src/main/java/org/photonvision/vision/target/TargetOffsetPointEdge.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.target; public enum TargetOffsetPointEdge { diff --git a/photon-core/src/main/java/org/photonvision/vision/target/TargetOrientation.java b/photon-core/src/main/java/org/photonvision/vision/target/TargetOrientation.java index 0820f0304..61b19c7f8 100644 --- a/photon-core/src/main/java/org/photonvision/vision/target/TargetOrientation.java +++ b/photon-core/src/main/java/org/photonvision/vision/target/TargetOrientation.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.target; public enum TargetOrientation { diff --git a/photon-core/src/main/java/org/photonvision/vision/target/TrackedTarget.java b/photon-core/src/main/java/org/photonvision/vision/target/TrackedTarget.java index 333ec0f56..ae7527e78 100644 --- a/photon-core/src/main/java/org/photonvision/vision/target/TrackedTarget.java +++ b/photon-core/src/main/java/org/photonvision/vision/target/TrackedTarget.java @@ -14,10 +14,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.target; -import edu.wpi.first.wpilibj.geometry.Transform2d; +import edu.wpi.first.math.geometry.Transform2d; import java.util.HashMap; import java.util.List; import org.opencv.core.Mat; diff --git a/photon-core/src/test/java/org/photonvision/common/BenchmarkTest.java b/photon-core/src/test/java/org/photonvision/common/BenchmarkTest.java index bbf83c6e6..9e1f1395b 100644 --- a/photon-core/src/test/java/org/photonvision/common/BenchmarkTest.java +++ b/photon-core/src/test/java/org/photonvision/common/BenchmarkTest.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common; import java.util.ArrayList; diff --git a/photon-core/src/test/java/org/photonvision/common/ShapeBenchmarkTest.java b/photon-core/src/test/java/org/photonvision/common/ShapeBenchmarkTest.java index 062a67b2c..61b3db7bf 100644 --- a/photon-core/src/test/java/org/photonvision/common/ShapeBenchmarkTest.java +++ b/photon-core/src/test/java/org/photonvision/common/ShapeBenchmarkTest.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common; /* * Copyright (C) 2020 Photon Vision. diff --git a/photon-core/src/test/java/org/photonvision/common/configuration/ConfigTest.java b/photon-core/src/test/java/org/photonvision/common/configuration/ConfigTest.java index a4477d9e9..4af8b4ae6 100644 --- a/photon-core/src/test/java/org/photonvision/common/configuration/ConfigTest.java +++ b/photon-core/src/test/java/org/photonvision/common/configuration/ConfigTest.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.configuration; import java.io.File; @@ -35,7 +34,6 @@ import org.photonvision.vision.pipeline.ReflectivePipelineSettings; import org.photonvision.vision.target.TargetModel; public class ConfigTest { - private static ConfigManager configMgr; private static final CameraConfiguration cameraConfig = new CameraConfiguration("TestCamera", "/dev/video420"); @@ -87,7 +85,6 @@ public class ConfigTest { @Test @Order(2) public void deserializeConfig() { - var reflectivePipelineSettings = configMgr.getConfig().getCameraConfigurations().get("TestCamera").pipelineSettings.get(0); var coloredShapePipelineSettings = diff --git a/photon-core/src/test/java/org/photonvision/common/configuration/NetworkConfigTest.java b/photon-core/src/test/java/org/photonvision/common/configuration/NetworkConfigTest.java index 181598bc3..bea4513c6 100644 --- a/photon-core/src/test/java/org/photonvision/common/configuration/NetworkConfigTest.java +++ b/photon-core/src/test/java/org/photonvision/common/configuration/NetworkConfigTest.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.configuration; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/photon-core/src/test/java/org/photonvision/common/util/LogFileManagementTest.java b/photon-core/src/test/java/org/photonvision/common/util/LogFileManagementTest.java index e591ef7bc..9a9d4f29b 100644 --- a/photon-core/src/test/java/org/photonvision/common/util/LogFileManagementTest.java +++ b/photon-core/src/test/java/org/photonvision/common/util/LogFileManagementTest.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.util; import java.io.File; @@ -32,10 +31,8 @@ import org.photonvision.common.configuration.ConfigManager; import org.photonvision.common.logging.Logger; public class LogFileManagementTest { - @Test public void fileCleanupTest() throws IOException { - // Ensure we instantiate the new log correctly ConfigManager.getInstance(); diff --git a/photon-core/src/test/java/org/photonvision/common/util/TimedTaskManagerTest.java b/photon-core/src/test/java/org/photonvision/common/util/TimedTaskManagerTest.java index 2b8d31de5..b193db25c 100644 --- a/photon-core/src/test/java/org/photonvision/common/util/TimedTaskManagerTest.java +++ b/photon-core/src/test/java/org/photonvision/common/util/TimedTaskManagerTest.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.util; import java.util.concurrent.atomic.AtomicInteger; @@ -22,7 +21,6 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; public class TimedTaskManagerTest { - @Test public void atomicIntegerIncrementTest() throws InterruptedException { AtomicInteger i = new AtomicInteger(); diff --git a/photon-core/src/test/java/org/photonvision/hardware/HardwareConfigTest.java b/photon-core/src/test/java/org/photonvision/hardware/HardwareConfigTest.java index af484140f..ac0f81718 100644 --- a/photon-core/src/test/java/org/photonvision/hardware/HardwareConfigTest.java +++ b/photon-core/src/test/java/org/photonvision/hardware/HardwareConfigTest.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.hardware; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -28,7 +27,6 @@ import org.photonvision.common.hardware.GPIO.CustomGPIO; import org.photonvision.common.util.TestUtils; public class HardwareConfigTest { - @Test public void loadJson() { try { diff --git a/photon-core/src/test/java/org/photonvision/hardware/HardwareManagerTest.java b/photon-core/src/test/java/org/photonvision/hardware/HardwareManagerTest.java index 25a582119..3746c0c99 100644 --- a/photon-core/src/test/java/org/photonvision/hardware/HardwareManagerTest.java +++ b/photon-core/src/test/java/org/photonvision/hardware/HardwareManagerTest.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.hardware; import org.junit.jupiter.api.Assumptions; @@ -27,7 +26,6 @@ import org.photonvision.common.logging.LogGroup; import org.photonvision.common.logging.Logger; public class HardwareManagerTest { - public static final Logger logger = new Logger(HardwareManager.class, LogGroup.General); @Test diff --git a/photon-core/src/test/java/org/photonvision/hardware/HardwareTest.java b/photon-core/src/test/java/org/photonvision/hardware/HardwareTest.java index b2a13cf4d..fd6610d52 100644 --- a/photon-core/src/test/java/org/photonvision/hardware/HardwareTest.java +++ b/photon-core/src/test/java/org/photonvision/hardware/HardwareTest.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.hardware; import static org.junit.jupiter.api.Assertions.*; @@ -29,7 +28,6 @@ import org.photonvision.common.hardware.metrics.GPUMetrics; import org.photonvision.common.hardware.metrics.RAMMetrics; public class HardwareTest { - @Test public void testHardware() { CPUMetrics cpuMetrics = new CPUMetrics(); diff --git a/photon-core/src/test/java/org/photonvision/vision/QuirkyCameraTest.java b/photon-core/src/test/java/org/photonvision/vision/QuirkyCameraTest.java index 45517ee02..0deb30605 100644 --- a/photon-core/src/test/java/org/photonvision/vision/QuirkyCameraTest.java +++ b/photon-core/src/test/java/org/photonvision/vision/QuirkyCameraTest.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision; import java.util.HashMap; diff --git a/photon-core/src/test/java/org/photonvision/vision/frame/provider/AcceleratedPicamFrameProviderTest.java b/photon-core/src/test/java/org/photonvision/vision/frame/provider/AcceleratedPicamFrameProviderTest.java index a62285438..b6d0559d7 100644 --- a/photon-core/src/test/java/org/photonvision/vision/frame/provider/AcceleratedPicamFrameProviderTest.java +++ b/photon-core/src/test/java/org/photonvision/vision/frame/provider/AcceleratedPicamFrameProviderTest.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.frame.provider; import java.io.IOException; diff --git a/photon-core/src/test/java/org/photonvision/vision/frame/provider/FileFrameProviderTest.java b/photon-core/src/test/java/org/photonvision/vision/frame/provider/FileFrameProviderTest.java index dfe31f289..ab2f5d40e 100644 --- a/photon-core/src/test/java/org/photonvision/vision/frame/provider/FileFrameProviderTest.java +++ b/photon-core/src/test/java/org/photonvision/vision/frame/provider/FileFrameProviderTest.java @@ -14,12 +14,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.frame.provider; import static org.junit.jupiter.api.Assertions.*; -import edu.wpi.cscore.CameraServerCvJNI; +import edu.wpi.first.cscore.CameraServerCvJNI; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; @@ -29,10 +28,8 @@ import org.photonvision.common.util.TestUtils; import org.photonvision.vision.frame.Frame; public class FileFrameProviderTest { - @BeforeAll public static void initPath() { - try { CameraServerCvJNI.forceLoad(); } catch (IOException e) { diff --git a/photon-core/src/test/java/org/photonvision/vision/opencv/ContourTest.java b/photon-core/src/test/java/org/photonvision/vision/opencv/ContourTest.java index 6e6c6fb17..eb38bf437 100644 --- a/photon-core/src/test/java/org/photonvision/vision/opencv/ContourTest.java +++ b/photon-core/src/test/java/org/photonvision/vision/opencv/ContourTest.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.opencv; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/photon-core/src/test/java/org/photonvision/vision/pipeline/Calibrate3dPipeTest.java b/photon-core/src/test/java/org/photonvision/vision/pipeline/Calibrate3dPipeTest.java index 2beadbb7e..32e8ab195 100644 --- a/photon-core/src/test/java/org/photonvision/vision/pipeline/Calibrate3dPipeTest.java +++ b/photon-core/src/test/java/org/photonvision/vision/pipeline/Calibrate3dPipeTest.java @@ -14,13 +14,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipeline; import static org.junit.jupiter.api.Assertions.*; -import edu.wpi.first.wpilibj.geometry.Rotation2d; -import edu.wpi.first.wpilibj.util.Units; +import edu.wpi.first.math.geometry.Rotation2d; +import edu.wpi.first.math.util.Units; import java.io.File; import java.nio.file.Path; import java.util.ArrayList; @@ -30,10 +29,10 @@ import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Triple; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.opencv.calib3d.Calib3d; import org.opencv.core.Mat; import org.opencv.core.Size; import org.opencv.imgcodecs.Imgcodecs; -import org.opencv.imgproc.Imgproc; import org.photonvision.common.util.TestUtils; import org.photonvision.vision.calibration.CameraCalibrationCoefficients; import org.photonvision.vision.camera.QuirkyCamera; @@ -87,7 +86,6 @@ public class Calibrate3dPipeTest { @Test public void calibrationPipelineTest() { - int startMatCount = CVMat.getMatCount(); File dir = new File(TestUtils.getDotBoardImagesPath().toAbsolutePath().toString()); @@ -249,7 +247,6 @@ public class Calibrate3dPipeTest { double boardGridSize_m, double expectedXCenter, double expectedYCenter) { - int startMatCount = CVMat.getMatCount(); File[] directoryListing = rootFolder.listFiles(); @@ -333,7 +330,7 @@ public class Calibrate3dPipeTest { if (file.isFile()) { Mat raw = Imgcodecs.imread(file.getAbsolutePath()); Mat undistorted = new Mat(new Size(imgRes.width * 2, imgRes.height * 2), raw.type()); - Imgproc.undistort( + Calib3d.undistort( raw, undistorted, cal.cameraIntrinsics.getAsMat(), cal.cameraExtrinsics.getAsMat()); TestUtils.showImage(undistorted, "undistorted " + file.getName(), 1); raw.release(); diff --git a/photon-core/src/test/java/org/photonvision/vision/pipeline/CirclePNPTest.java b/photon-core/src/test/java/org/photonvision/vision/pipeline/CirclePNPTest.java index c38433d8c..bbe3f6146 100644 --- a/photon-core/src/test/java/org/photonvision/vision/pipeline/CirclePNPTest.java +++ b/photon-core/src/test/java/org/photonvision/vision/pipeline/CirclePNPTest.java @@ -14,12 +14,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipeline; import static org.junit.jupiter.api.Assertions.*; -import edu.wpi.first.wpilibj.geometry.Rotation2d; +import edu.wpi.first.math.geometry.Rotation2d; import java.util.stream.Collectors; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -37,7 +36,6 @@ import org.photonvision.vision.target.TargetModel; import org.photonvision.vision.target.TrackedTarget; public class CirclePNPTest { - private static final String LIFECAM_240P_CAL_FILE = "lifecam240p.json"; private static final String LIFECAM_480P_CAL_FILE = "lifecam480p.json"; diff --git a/photon-core/src/test/java/org/photonvision/vision/pipeline/ColoredShapePipelineTest.java b/photon-core/src/test/java/org/photonvision/vision/pipeline/ColoredShapePipelineTest.java index c774a43ad..8f5d3680a 100644 --- a/photon-core/src/test/java/org/photonvision/vision/pipeline/ColoredShapePipelineTest.java +++ b/photon-core/src/test/java/org/photonvision/vision/pipeline/ColoredShapePipelineTest.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipeline; import org.junit.jupiter.api.Test; @@ -28,7 +27,6 @@ import org.photonvision.vision.opencv.ContourShape; import org.photonvision.vision.pipeline.result.CVPipelineResult; public class ColoredShapePipelineTest { - public static void testTriangleDetection( ColoredShapePipeline pipeline, ColoredShapePipelineSettings settings, Frame frame) { pipeline.settings = settings; @@ -72,7 +70,6 @@ public class ColoredShapePipelineTest { @Test public static void testPowercellDetection( ColoredShapePipelineSettings settings, ColoredShapePipeline pipeline) { - settings.hsvHue.set(10, 40); settings.hsvSaturation.set(100, 255); settings.hsvValue.set(100, 255); diff --git a/photon-core/src/test/java/org/photonvision/vision/pipeline/PipelineProfilerTest.java b/photon-core/src/test/java/org/photonvision/vision/pipeline/PipelineProfilerTest.java index 11b410f88..1d6eece9e 100644 --- a/photon-core/src/test/java/org/photonvision/vision/pipeline/PipelineProfilerTest.java +++ b/photon-core/src/test/java/org/photonvision/vision/pipeline/PipelineProfilerTest.java @@ -14,14 +14,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipeline; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; public class PipelineProfilerTest { - @Test public void reflectiveProfile() { long[] invalidNanos = new long[20]; diff --git a/photon-core/src/test/java/org/photonvision/vision/pipeline/ReflectivePipelineTest.java b/photon-core/src/test/java/org/photonvision/vision/pipeline/ReflectivePipelineTest.java index e47df81ed..f2dcd1339 100644 --- a/photon-core/src/test/java/org/photonvision/vision/pipeline/ReflectivePipelineTest.java +++ b/photon-core/src/test/java/org/photonvision/vision/pipeline/ReflectivePipelineTest.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipeline; import org.junit.jupiter.api.Assertions; @@ -29,7 +28,6 @@ import org.photonvision.vision.opencv.ContourIntersectionDirection; import org.photonvision.vision.pipeline.result.CVPipelineResult; public class ReflectivePipelineTest { - @Test public void test2019() { TestUtils.loadLibraries(); diff --git a/photon-core/src/test/java/org/photonvision/vision/pipeline/SolvePNPTest.java b/photon-core/src/test/java/org/photonvision/vision/pipeline/SolvePNPTest.java index 5b5c61ace..a341202f2 100644 --- a/photon-core/src/test/java/org/photonvision/vision/pipeline/SolvePNPTest.java +++ b/photon-core/src/test/java/org/photonvision/vision/pipeline/SolvePNPTest.java @@ -14,14 +14,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.pipeline; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -import edu.wpi.first.wpilibj.geometry.Rotation2d; -import edu.wpi.first.wpilibj.util.Units; +import edu.wpi.first.math.geometry.Rotation2d; +import edu.wpi.first.math.util.Units; import java.util.stream.Collectors; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; @@ -40,7 +39,6 @@ import org.photonvision.vision.target.TargetModel; import org.photonvision.vision.target.TrackedTarget; public class SolvePNPTest { - private static final String LIFECAM_240P_CAL_FILE = "lifecam240p.json"; private static final String LIFECAM_480P_CAL_FILE = "lifecam480p.json"; diff --git a/photon-core/src/test/java/org/photonvision/vision/processes/PipelineManagerTest.java b/photon-core/src/test/java/org/photonvision/vision/processes/PipelineManagerTest.java index 30fbf74f0..67bfa20b5 100644 --- a/photon-core/src/test/java/org/photonvision/vision/processes/PipelineManagerTest.java +++ b/photon-core/src/test/java/org/photonvision/vision/processes/PipelineManagerTest.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.processes; import java.util.ArrayList; @@ -26,7 +25,6 @@ import org.photonvision.vision.pipeline.DriverModePipelineSettings; import org.photonvision.vision.pipeline.PipelineType; public class PipelineManagerTest { - @Test public void testUniqueName() { TestUtils.loadLibraries(); diff --git a/photon-core/src/test/java/org/photonvision/vision/processes/VisionModuleManagerTest.java b/photon-core/src/test/java/org/photonvision/vision/processes/VisionModuleManagerTest.java index 99ffe1d3b..8caaa09e6 100644 --- a/photon-core/src/test/java/org/photonvision/vision/processes/VisionModuleManagerTest.java +++ b/photon-core/src/test/java/org/photonvision/vision/processes/VisionModuleManagerTest.java @@ -14,13 +14,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.processes; import static org.junit.jupiter.api.Assertions.assertTrue; -import edu.wpi.cscore.VideoMode; -import edu.wpi.first.wpilibj.geometry.Rotation2d; +import edu.wpi.first.cscore.VideoMode; +import edu.wpi.first.math.geometry.Rotation2d; import java.util.Arrays; import java.util.HashMap; import java.util.List; @@ -36,14 +35,12 @@ import org.photonvision.vision.frame.provider.FileFrameProvider; import org.photonvision.vision.pipeline.result.CVPipelineResult; public class VisionModuleManagerTest { - @BeforeEach public void init() { TestUtils.loadLibraries(); } private static class TestSource extends VisionSource { - private final FrameProvider provider; public TestSource(FrameProvider provider, CameraConfiguration cameraConfiguration) { @@ -68,7 +65,6 @@ public class VisionModuleManagerTest { } private static class TestSettables extends VisionSourceSettables { - protected TestSettables(CameraConfiguration configuration) { super(configuration); } diff --git a/photon-core/src/test/java/org/photonvision/vision/processes/VisionSourceManagerTest.java b/photon-core/src/test/java/org/photonvision/vision/processes/VisionSourceManagerTest.java index af6831a3a..04b126ccd 100644 --- a/photon-core/src/test/java/org/photonvision/vision/processes/VisionSourceManagerTest.java +++ b/photon-core/src/test/java/org/photonvision/vision/processes/VisionSourceManagerTest.java @@ -14,13 +14,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.processes; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; -import edu.wpi.cscore.UsbCameraInfo; +import edu.wpi.first.cscore.UsbCameraInfo; import java.util.ArrayList; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/photon-core/src/test/java/org/photonvision/vision/target/TargetCalculationsTest.java b/photon-core/src/test/java/org/photonvision/vision/target/TargetCalculationsTest.java index 6afcba9d6..72df9cad5 100644 --- a/photon-core/src/test/java/org/photonvision/vision/target/TargetCalculationsTest.java +++ b/photon-core/src/test/java/org/photonvision/vision/target/TargetCalculationsTest.java @@ -14,12 +14,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.target; import static org.junit.jupiter.api.Assertions.assertEquals; -import edu.wpi.first.wpilibj.geometry.Rotation2d; +import edu.wpi.first.math.geometry.Rotation2d; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/photon-core/src/test/java/org/photonvision/vision/target/TrackedTargetTest.java b/photon-core/src/test/java/org/photonvision/vision/target/TrackedTargetTest.java index 5d4b2095f..f58f35572 100644 --- a/photon-core/src/test/java/org/photonvision/vision/target/TrackedTargetTest.java +++ b/photon-core/src/test/java/org/photonvision/vision/target/TrackedTargetTest.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.vision.target; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/photon-lib/build.gradle b/photon-lib/build.gradle index 33f9441ea..8bd671ce6 100644 --- a/photon-lib/build.gradle +++ b/photon-lib/build.gradle @@ -16,7 +16,7 @@ def jniPlatforms = ['linuxaarch64bionic', 'linuxraspbian', 'linuxx86-64', 'osxx8 // Apply Java configuration dependencies { - compile project(":photon-targeting") + implementation project(":photon-targeting") // WPILib non-JNI dependencies implementation "edu.wpi.first.cscore:cscore-java:$wpilibVersion" @@ -24,15 +24,15 @@ dependencies { implementation "edu.wpi.first.wpilibj:wpilibj-java:$wpilibVersion" implementation "edu.wpi.first.wpiutil:wpiutil-java:$wpilibVersion" implementation "edu.wpi.first.wpimath:wpimath-java:$wpilibVersion" - implementation "edu.wpi.first.thirdparty.frc2020.opencv:opencv-java:3.4.7-2" + implementation "edu.wpi.first.thirdparty.frc2022.opencv:opencv-java:$opencvVersion" // NTCore implementation "edu.wpi.first.ntcore:ntcore-java:$wpilibVersion" - jniPlatforms.each { compile "edu.wpi.first.ntcore:ntcore-jni:$wpilibVersion:$it" } + jniPlatforms.each { implementation "edu.wpi.first.ntcore:ntcore-jni:$wpilibVersion:$it" } // HAL implementation "edu.wpi.first.hal:hal-java:$wpilibVersion" - jniPlatforms.each {compile "edu.wpi.first.hal:hal-jni:$wpilibVersion:$it"} + jniPlatforms.each { implementation "edu.wpi.first.hal:hal-jni:$wpilibVersion:$it"} // Junit testImplementation("org.junit.jupiter:junit-jupiter-api:5.6.2") diff --git a/photon-lib/src/main/java/org/photonvision/PhotonCamera.java b/photon-lib/src/main/java/org/photonvision/PhotonCamera.java index d3a7914df..5b3b23475 100644 --- a/photon-lib/src/main/java/org/photonvision/PhotonCamera.java +++ b/photon-lib/src/main/java/org/photonvision/PhotonCamera.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision; import edu.wpi.first.networktables.NetworkTable; diff --git a/photon-lib/src/main/java/org/photonvision/PhotonTargetSortMode.java b/photon-lib/src/main/java/org/photonvision/PhotonTargetSortMode.java index a173cd5cf..5bd93819e 100644 --- a/photon-lib/src/main/java/org/photonvision/PhotonTargetSortMode.java +++ b/photon-lib/src/main/java/org/photonvision/PhotonTargetSortMode.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision; import java.util.Comparator; diff --git a/photon-lib/src/main/java/org/photonvision/PhotonUtils.java b/photon-lib/src/main/java/org/photonvision/PhotonUtils.java index d1b5182f2..753485e7f 100644 --- a/photon-lib/src/main/java/org/photonvision/PhotonUtils.java +++ b/photon-lib/src/main/java/org/photonvision/PhotonUtils.java @@ -14,13 +14,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision; -import edu.wpi.first.wpilibj.geometry.Pose2d; -import edu.wpi.first.wpilibj.geometry.Rotation2d; -import edu.wpi.first.wpilibj.geometry.Transform2d; -import edu.wpi.first.wpilibj.geometry.Translation2d; +import edu.wpi.first.math.geometry.Pose2d; +import edu.wpi.first.math.geometry.Rotation2d; +import edu.wpi.first.math.geometry.Transform2d; +import edu.wpi.first.math.geometry.Translation2d; public final class PhotonUtils { private PhotonUtils() { @@ -35,7 +34,7 @@ public final class PhotonUtils { * for there to exist a height differential between goal and camera. The larger this differential, * the more accurate the distance estimate will be. * - *

Units can be converted using the {@link edu.wpi.first.wpilibj.util.Units} class. + *

Units can be converted using the {@link edu.wpi.first.math.util.Units} class. * * @param cameraHeightMeters The physical height of the camera off the floor in meters. * @param targetHeightMeters The physical height of the target off the floor in meters. This diff --git a/photon-lib/src/main/java/org/photonvision/SimPhotonCamera.java b/photon-lib/src/main/java/org/photonvision/SimPhotonCamera.java index a972c82d7..ce7369793 100644 --- a/photon-lib/src/main/java/org/photonvision/SimPhotonCamera.java +++ b/photon-lib/src/main/java/org/photonvision/SimPhotonCamera.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision; import edu.wpi.first.networktables.NetworkTable; diff --git a/photon-lib/src/main/java/org/photonvision/SimVisionSystem.java b/photon-lib/src/main/java/org/photonvision/SimVisionSystem.java index a8ff9c265..9981ba901 100644 --- a/photon-lib/src/main/java/org/photonvision/SimVisionSystem.java +++ b/photon-lib/src/main/java/org/photonvision/SimVisionSystem.java @@ -14,12 +14,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision; -import edu.wpi.first.wpilibj.geometry.Pose2d; -import edu.wpi.first.wpilibj.geometry.Transform2d; -import edu.wpi.first.wpilibj.util.Units; +import edu.wpi.first.math.geometry.Pose2d; +import edu.wpi.first.math.geometry.Transform2d; +import edu.wpi.first.math.util.Units; import java.util.ArrayList; import org.photonvision.targeting.PhotonTrackedTarget; diff --git a/photon-lib/src/main/java/org/photonvision/SimVisionTarget.java b/photon-lib/src/main/java/org/photonvision/SimVisionTarget.java index 7d0064afc..332afe00e 100644 --- a/photon-lib/src/main/java/org/photonvision/SimVisionTarget.java +++ b/photon-lib/src/main/java/org/photonvision/SimVisionTarget.java @@ -14,10 +14,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision; -import edu.wpi.first.wpilibj.geometry.Pose2d; +import edu.wpi.first.math.geometry.Pose2d; public class SimVisionTarget { Pose2d targetPos; diff --git a/photon-lib/src/main/native/cpp/photonlib/PhotonCamera.cpp b/photon-lib/src/main/native/cpp/photonlib/PhotonCamera.cpp index e50302507..dd925f972 100644 --- a/photon-lib/src/main/native/cpp/photonlib/PhotonCamera.cpp +++ b/photon-lib/src/main/native/cpp/photonlib/PhotonCamera.cpp @@ -48,7 +48,7 @@ PhotonPipelineResult PhotonCamera::GetLatestResult() const { std::shared_ptr ntvalue = rawBytesEntry.GetValue(); if (!ntvalue) return result; - std::string value = ntvalue->GetRaw(); + std::string value{ntvalue->GetRaw()}; std::vector bytes{value.begin(), value.end()}; photonlib::Packet packet{bytes}; diff --git a/photon-lib/src/main/native/cpp/photonlib/PhotonPipelineResult.cpp b/photon-lib/src/main/native/cpp/photonlib/PhotonPipelineResult.cpp index 5f4b726fa..294f4576a 100644 --- a/photon-lib/src/main/native/cpp/photonlib/PhotonPipelineResult.cpp +++ b/photon-lib/src/main/native/cpp/photonlib/PhotonPipelineResult.cpp @@ -19,7 +19,7 @@ namespace photonlib { PhotonPipelineResult::PhotonPipelineResult( - units::second_t latency, wpi::ArrayRef targets) + units::second_t latency, wpi::span targets) : latency(latency), targets(targets.data(), targets.data() + targets.size()) {} @@ -33,7 +33,7 @@ bool PhotonPipelineResult::operator!=(const PhotonPipelineResult& other) const { Packet& operator<<(Packet& packet, const PhotonPipelineResult& result) { // Encode latency and number of targets. - packet << result.latency.to() * 1000 + packet << result.latency.value() * 1000 << static_cast(result.targets.size()); // Encode the information of each target. diff --git a/photon-lib/src/main/native/cpp/photonlib/PhotonTrackedTarget.cpp b/photon-lib/src/main/native/cpp/photonlib/PhotonTrackedTarget.cpp index d5005e747..ef0b52e6a 100644 --- a/photon-lib/src/main/native/cpp/photonlib/PhotonTrackedTarget.cpp +++ b/photon-lib/src/main/native/cpp/photonlib/PhotonTrackedTarget.cpp @@ -39,9 +39,9 @@ bool PhotonTrackedTarget::operator!=(const PhotonTrackedTarget& other) const { Packet& operator<<(Packet& packet, const PhotonTrackedTarget& target) { return packet << target.yaw << target.pitch << target.area << target.skew - << target.cameraToTarget.Translation().X().to() - << target.cameraToTarget.Translation().Y().to() - << target.cameraToTarget.Rotation().Degrees().to(); + << target.cameraToTarget.Translation().X().value() + << target.cameraToTarget.Translation().Y().value() + << target.cameraToTarget.Rotation().Degrees().value(); } Packet& operator>>(Packet& packet, PhotonTrackedTarget& target) { diff --git a/photon-lib/src/main/native/cpp/photonlib/SimPhotonCamera.cpp b/photon-lib/src/main/native/cpp/photonlib/SimPhotonCamera.cpp index ce8f4e2c6..ac8e71abb 100644 --- a/photon-lib/src/main/native/cpp/photonlib/SimPhotonCamera.cpp +++ b/photon-lib/src/main/native/cpp/photonlib/SimPhotonCamera.cpp @@ -26,7 +26,7 @@ SimPhotonCamera::SimPhotonCamera(const std::string& cameraName) : PhotonCamera(cameraName) {} void SimPhotonCamera::SubmitProcessedFrame( - units::second_t latency, wpi::ArrayRef tgtList) { + units::second_t latency, wpi::span tgtList) { if (!GetDriverMode()) { // Clear the current packet. simPacket.Clear(); @@ -34,8 +34,8 @@ void SimPhotonCamera::SubmitProcessedFrame( // Create the new result and pump it into the packet simPacket << PhotonPipelineResult(latency, tgtList); - rawBytesEntry.SetRaw( - wpi::StringRef(simPacket.GetData().data(), simPacket.GetData().size())); + rawBytesEntry.SetRaw(std::string_view{simPacket.GetData().data(), + simPacket.GetData().size()}); } } diff --git a/photon-lib/src/main/native/cpp/photonlib/SimVisionSystem.cpp b/photon-lib/src/main/native/cpp/photonlib/SimVisionSystem.cpp index 971dc6fb0..aa8b8b854 100644 --- a/photon-lib/src/main/native/cpp/photonlib/SimVisionSystem.cpp +++ b/photon-lib/src/main/native/cpp/photonlib/SimVisionSystem.cpp @@ -21,6 +21,7 @@ #include #include +#include namespace photonlib { @@ -73,36 +74,34 @@ void SimVisionSystem::ProcessFrame(frc::Pose2d robotPose) { units::meter_t distHypot = units::math::hypot(distAlongGround, distVertical); - double area = tgt.tgtArea.to() / GetM2PerPx(distAlongGround); + double area = tgt.tgtArea.value() / GetM2PerPx(distAlongGround); // 2D yaw mode considers the target as a point, and should ignore target // rotation. // Photon reports it in the correct robot reference frame. // IE: targets to the left of the image should report negative yaw. - units::degree_t yawAngle = - -1.0 * units::math::atan2(camToTargetTrans.Translation().Y(), - camToTargetTrans.Translation().X()); + units::degree_t yawAngle = -units::math::atan2( + camToTargetTrans.Translation().Y(), camToTargetTrans.Translation().X()); units::degree_t pitchAngle = units::math::atan2(distVertical, distAlongGround) - camPitch; if (CamCanSeeTarget(distHypot, yawAngle, pitchAngle, area)) { - PhotonTrackedTarget newTgt = - PhotonTrackedTarget(yawAngle.to(), pitchAngle.to(), - area, 0.0, camToTargetTrans); + PhotonTrackedTarget newTgt = PhotonTrackedTarget( + yawAngle.value(), pitchAngle.value(), area, 0.0, camToTargetTrans); visibleTgtList.push_back(newTgt); } } units::second_t procDelay(0.0); // Future - tie this to something meaningful - cam.SubmitProcessedFrame( - procDelay, wpi::MutableArrayRef(visibleTgtList)); + cam.SubmitProcessedFrame(procDelay, + wpi::span(visibleTgtList)); } double SimVisionSystem::GetM2PerPx(units::meter_t dist) { - double heightMPerPx = 2 * dist.to() * - units::math::tan(camVertFOV / 2) / cameraResHeight; - double widthMPerPx = 2 * dist.to() * - units::math::tan(camHorizFOV / 2) / cameraResWidth; + double heightMPerPx = + 2 * dist.value() * units::math::tan(camVertFOV / 2) / cameraResHeight; + double widthMPerPx = + 2 * dist.value() * units::math::tan(camHorizFOV / 2) / cameraResWidth; return widthMPerPx * heightMPerPx; } diff --git a/photon-lib/src/main/native/include/photonlib/PhotonPipelineResult.h b/photon-lib/src/main/native/include/photonlib/PhotonPipelineResult.h index 413d2529e..f1e906b56 100644 --- a/photon-lib/src/main/native/include/photonlib/PhotonPipelineResult.h +++ b/photon-lib/src/main/native/include/photonlib/PhotonPipelineResult.h @@ -19,10 +19,10 @@ #include -#include +#include #include -#include #include +#include #include "photonlib/Packet.h" #include "photonlib/PhotonTrackedTarget.h" @@ -44,7 +44,7 @@ class PhotonPipelineResult { * @param targets The list of targets identified by the pipeline. */ PhotonPipelineResult(units::second_t latency, - wpi::ArrayRef targets); + wpi::span targets); /** * Returns the best target in this pipeline result. If there are no targets, @@ -55,7 +55,8 @@ class PhotonPipelineResult { */ PhotonTrackedTarget GetBestTarget() const { if (!HasTargets() && !HAS_WARNED) { - ::frc::DriverStation::ReportError( + FRC_ReportError( + frc::warn::Warning, "{}", "This PhotonPipelineResult object has no targets associated with it! " "Please check HasTargets() before calling this method. For more " "information, please review the PhotonLib documentation at " @@ -81,7 +82,7 @@ class PhotonPipelineResult { * Returns a reference to the vector of targets. * @return A reference to the vector of targets. */ - const wpi::ArrayRef GetTargets() const { + const wpi::span GetTargets() const { return targets; } diff --git a/photon-lib/src/main/native/include/photonlib/SimPhotonCamera.h b/photon-lib/src/main/native/include/photonlib/SimPhotonCamera.h index 1a53138b4..c82efd86d 100644 --- a/photon-lib/src/main/native/include/photonlib/SimPhotonCamera.h +++ b/photon-lib/src/main/native/include/photonlib/SimPhotonCamera.h @@ -21,8 +21,8 @@ #include #include -#include #include +#include #include "photonlib/Packet.h" #include "photonlib/PhotonCamera.h" @@ -56,7 +56,7 @@ class SimPhotonCamera : public PhotonCamera { * @param tgtList Set of targets detected */ void SubmitProcessedFrame(units::second_t latency, - wpi::ArrayRef tgtList); + wpi::span tgtList); private: mutable Packet simPacket; diff --git a/photon-lib/src/main/native/include/photonlib/SimVisionSystem.h b/photon-lib/src/main/native/include/photonlib/SimVisionSystem.h index 419ac63f6..479d7793b 100644 --- a/photon-lib/src/main/native/include/photonlib/SimVisionSystem.h +++ b/photon-lib/src/main/native/include/photonlib/SimVisionSystem.h @@ -25,7 +25,6 @@ #include #include #include -#include #include #include "photonlib/SimPhotonCamera.h" diff --git a/photon-lib/src/test/java/org/photonvision/PacketTest.java b/photon-lib/src/test/java/org/photonvision/PacketTest.java index 0b4d5a7f3..55d231257 100644 --- a/photon-lib/src/test/java/org/photonvision/PacketTest.java +++ b/photon-lib/src/test/java/org/photonvision/PacketTest.java @@ -14,12 +14,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision; -import edu.wpi.first.wpilibj.geometry.Rotation2d; -import edu.wpi.first.wpilibj.geometry.Transform2d; -import edu.wpi.first.wpilibj.geometry.Translation2d; +import edu.wpi.first.math.geometry.Rotation2d; +import edu.wpi.first.math.geometry.Transform2d; +import edu.wpi.first.math.geometry.Translation2d; import java.util.ArrayList; import java.util.List; import org.junit.jupiter.api.Assertions; diff --git a/photon-lib/src/test/java/org/photonvision/PhotonCameraTest.java b/photon-lib/src/test/java/org/photonvision/PhotonCameraTest.java index b405415bd..299f37df8 100644 --- a/photon-lib/src/test/java/org/photonvision/PhotonCameraTest.java +++ b/photon-lib/src/test/java/org/photonvision/PhotonCameraTest.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision; import org.junit.jupiter.api.Assertions; diff --git a/photon-lib/src/test/java/org/photonvision/PhotonUtilTest.java b/photon-lib/src/test/java/org/photonvision/PhotonUtilTest.java index 85e652c3a..812f31632 100644 --- a/photon-lib/src/test/java/org/photonvision/PhotonUtilTest.java +++ b/photon-lib/src/test/java/org/photonvision/PhotonUtilTest.java @@ -14,13 +14,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision; -import edu.wpi.first.wpilibj.geometry.Pose2d; -import edu.wpi.first.wpilibj.geometry.Rotation2d; -import edu.wpi.first.wpilibj.geometry.Transform2d; -import edu.wpi.first.wpilibj.util.Units; +import edu.wpi.first.math.geometry.Pose2d; +import edu.wpi.first.math.geometry.Rotation2d; +import edu.wpi.first.math.geometry.Transform2d; +import edu.wpi.first.math.util.Units; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; diff --git a/photon-lib/src/test/java/org/photonvision/PhotonVersionTest.java b/photon-lib/src/test/java/org/photonvision/PhotonVersionTest.java index 86e750f30..2a7de07ac 100644 --- a/photon-lib/src/test/java/org/photonvision/PhotonVersionTest.java +++ b/photon-lib/src/test/java/org/photonvision/PhotonVersionTest.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision; import java.util.regex.Matcher; diff --git a/photon-lib/src/test/java/org/photonvision/SimVisionSystemTest.java b/photon-lib/src/test/java/org/photonvision/SimVisionSystemTest.java index 520ebe731..f5e7442c3 100644 --- a/photon-lib/src/test/java/org/photonvision/SimVisionSystemTest.java +++ b/photon-lib/src/test/java/org/photonvision/SimVisionSystemTest.java @@ -14,18 +14,17 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -import edu.wpi.first.wpilibj.geometry.Pose2d; -import edu.wpi.first.wpilibj.geometry.Rotation2d; -import edu.wpi.first.wpilibj.geometry.Transform2d; -import edu.wpi.first.wpilibj.geometry.Translation2d; -import edu.wpi.first.wpilibj.util.Units; +import edu.wpi.first.math.geometry.Pose2d; +import edu.wpi.first.math.geometry.Rotation2d; +import edu.wpi.first.math.geometry.Transform2d; +import edu.wpi.first.math.geometry.Translation2d; +import edu.wpi.first.math.util.Units; import java.util.List; import java.util.stream.Stream; import org.junit.jupiter.api.Assertions; @@ -214,7 +213,7 @@ class SimVisionSystemTest { // If the camera is pitched down by 10 degrees, the target should appear // in the upper part of the image (ie, pitch positive). Therefor, // pass/fail involves -1.0. - assertEquals(tgt.getPitch(), -1.0 * testPitch, 0.0001); + assertEquals(tgt.getPitch(), -testPitch, 0.0001); } private static Stream distCalCParamProvider() { diff --git a/photon-lib/src/test/native/cpp/SimVisionSystemTest.cpp b/photon-lib/src/test/native/cpp/SimVisionSystemTest.cpp index a1673fce0..da0437c5c 100644 --- a/photon-lib/src/test/native/cpp/SimVisionSystemTest.cpp +++ b/photon-lib/src/test/native/cpp/SimVisionSystemTest.cpp @@ -64,7 +64,7 @@ TEST_P(SimVisionSystemDistParamTest, DistanceAligned) { .GetCameraRelativePose() .Translation() .Norm() - .to(), + .value(), dist); } @@ -294,7 +294,7 @@ TEST_P(SimVisionSystemCameraPitchParamTest, CameraPitch) { // If the camera is pitched down by 10 degrees, the target should appear // in the upper part of the image (ie, pitch positive). Therefor, // pass/fail involves -1.0. - EXPECT_DOUBLE_EQ(tgt.GetPitch(), -1.0 * testPitch); + EXPECT_DOUBLE_EQ(tgt.GetPitch(), -testPitch); } class SimVisionSystemDistCalcParamTest @@ -350,7 +350,7 @@ TEST_P(SimVisionSystemDistCalcParamTest, DistanceCalc) { units::meter_t distMeas = photonlib::PhotonUtils::CalculateDistanceToTarget( units::meter_t(testHeight), units::meter_t(testDist), units::degree_t(testPitch), units::degree_t(tgt.GetPitch())); - EXPECT_DOUBLE_EQ(distMeas.to(), testDist); + EXPECT_DOUBLE_EQ(distMeas.value(), testDist); } TEST(SimVisionSystemTest, MultipleTargets) { diff --git a/photon-server/.gitignore b/photon-server/.gitignore index 2e0905a34..4faca75e2 100644 --- a/photon-server/.gitignore +++ b/photon-server/.gitignore @@ -8,4 +8,4 @@ bin/* build build/* photonvision/* -photonvision_config/* \ No newline at end of file +photonvision_config/* diff --git a/photon-server/build.gradle b/photon-server/build.gradle index d6731cfbc..08dbd4f24 100644 --- a/photon-server/build.gradle +++ b/photon-server/build.gradle @@ -19,7 +19,7 @@ dependencies { implementation "org.msgpack:msgpack-core:0.8.20" implementation "org.msgpack:jackson-dataformat-msgpack:0.8.20" - compile "org.slf4j:slf4j-simple:1.8.0-beta4" + implementation "org.slf4j:slf4j-simple:1.8.0-beta4" } shadowJar { @@ -75,8 +75,8 @@ remotes { } } -import java.io.*; -import java.net.*; +import java.io.*; +import java.net.*; task findDeployTarget { doLast { @@ -138,4 +138,3 @@ task deploy { } } } - diff --git a/photon-server/netTest.json b/photon-server/netTest.json index a28a23a86..dcfbb1247 100644 --- a/photon-server/netTest.json +++ b/photon-server/netTest.json @@ -1 +1 @@ -{"teamNumber":0,"connectionType":"DHCP","staticIp":"","hostname":"photonvision","runNTServer":false,"shouldManage":false} \ No newline at end of file +{"teamNumber":0,"connectionType":"DHCP","staticIp":"","hostname":"photonvision","runNTServer":false,"shouldManage":false} diff --git a/photon-server/settings.gradle b/photon-server/settings.gradle index 8771f3c13..541fb9afd 100644 --- a/photon-server/settings.gradle +++ b/photon-server/settings.gradle @@ -1,2 +1 @@ rootProject.name = 'photon-server' - diff --git a/photon-server/src/main/java/org/photonvision/Main.java b/photon-server/src/main/java/org/photonvision/Main.java index 98e51c542..99000b068 100644 --- a/photon-server/src/main/java/org/photonvision/Main.java +++ b/photon-server/src/main/java/org/photonvision/Main.java @@ -14,10 +14,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision; -import edu.wpi.cscore.CameraServerCvJNI; +import edu.wpi.first.cscore.CameraServerCvJNI; import java.util.ArrayList; import org.apache.commons.cli.*; import org.photonvision.common.configuration.CameraConfiguration; diff --git a/photon-server/src/main/java/org/photonvision/server/RequestHandler.java b/photon-server/src/main/java/org/photonvision/server/RequestHandler.java index 43c79dc22..fa58bb88e 100644 --- a/photon-server/src/main/java/org/photonvision/server/RequestHandler.java +++ b/photon-server/src/main/java/org/photonvision/server/RequestHandler.java @@ -14,12 +14,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.server; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import edu.wpi.first.wpilibj.geometry.Rotation2d; +import edu.wpi.first.math.geometry.Rotation2d; import io.javalin.http.Context; import java.io.File; import java.io.FileInputStream; @@ -49,7 +48,6 @@ public class RequestHandler { public static void onSettingUpload(Context ctx) { var file = ctx.uploadedFile("zipData"); if (file != null) { - // Copy the file from the client to a temporary location var tempFilePath = new File(Path.of(System.getProperty("java.io.tmpdir"), file.getFilename()).toString()); diff --git a/photon-server/src/main/java/org/photonvision/server/Server.java b/photon-server/src/main/java/org/photonvision/server/Server.java index e0370324b..c2a321e15 100644 --- a/photon-server/src/main/java/org/photonvision/server/Server.java +++ b/photon-server/src/main/java/org/photonvision/server/Server.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.server; import io.javalin.Javalin; @@ -25,7 +24,6 @@ public class Server { private static final Logger logger = new Logger(Server.class, LogGroup.WebServer); public static void main(int port) { - Javalin app = Javalin.create( config -> { diff --git a/photon-server/src/main/java/org/photonvision/server/SocketHandler.java b/photon-server/src/main/java/org/photonvision/server/SocketHandler.java index 708444b98..b0ead57dc 100644 --- a/photon-server/src/main/java/org/photonvision/server/SocketHandler.java +++ b/photon-server/src/main/java/org/photonvision/server/SocketHandler.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.server; import com.fasterxml.jackson.core.JsonProcessingException; @@ -43,7 +42,6 @@ import org.photonvision.vision.pipeline.PipelineType; @SuppressWarnings("rawtypes") public class SocketHandler { - private final Logger logger = new Logger(SocketHandler.class, LogGroup.WebServer); private final List users = new CopyOnWriteArrayList<>(); private final ObjectMapper objectMapper = new ObjectMapper(new MessagePackFactory()); diff --git a/photon-server/src/main/java/org/photonvision/server/SocketMessageType.java b/photon-server/src/main/java/org/photonvision/server/SocketMessageType.java index ff5ba3a36..935069619 100644 --- a/photon-server/src/main/java/org/photonvision/server/SocketMessageType.java +++ b/photon-server/src/main/java/org/photonvision/server/SocketMessageType.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.server; import java.util.EnumSet; diff --git a/photon-server/src/main/java/org/photonvision/server/UIInboundSubscriber.java b/photon-server/src/main/java/org/photonvision/server/UIInboundSubscriber.java index 8666edb09..14d147485 100644 --- a/photon-server/src/main/java/org/photonvision/server/UIInboundSubscriber.java +++ b/photon-server/src/main/java/org/photonvision/server/UIInboundSubscriber.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.server; import java.util.Collections; @@ -29,7 +28,6 @@ import org.photonvision.common.dataflow.events.OutgoingUIEvent; import org.photonvision.common.logging.Logger; public class UIInboundSubscriber extends DataChangeSubscriber { - public UIInboundSubscriber() { super( Collections.singletonList(DataChangeSource.DCS_WEBSOCKET), diff --git a/photon-server/src/main/java/org/photonvision/server/UIOutboundSubscriber.java b/photon-server/src/main/java/org/photonvision/server/UIOutboundSubscriber.java index a71b92822..72561f369 100644 --- a/photon-server/src/main/java/org/photonvision/server/UIOutboundSubscriber.java +++ b/photon-server/src/main/java/org/photonvision/server/UIOutboundSubscriber.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.server; import com.fasterxml.jackson.core.JsonProcessingException; diff --git a/photon-server/src/main/java/org/photonvision/server/UISettings.java b/photon-server/src/main/java/org/photonvision/server/UISettings.java index f4361c267..90e417e8e 100644 --- a/photon-server/src/main/java/org/photonvision/server/UISettings.java +++ b/photon-server/src/main/java/org/photonvision/server/UISettings.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.server; import org.photonvision.common.configuration.CameraConfiguration; diff --git a/photon-server/src/main/resources/calibration/lifecam240p.json b/photon-server/src/main/resources/calibration/lifecam240p.json index 349c450c8..954a1cc45 100644 --- a/photon-server/src/main/resources/calibration/lifecam240p.json +++ b/photon-server/src/main/resources/calibration/lifecam240p.json @@ -31,4 +31,4 @@ -1.462385758978924 ] } -} \ No newline at end of file +} diff --git a/photon-server/src/main/resources/calibration/lifecam480p.json b/photon-server/src/main/resources/calibration/lifecam480p.json index fff629bf6..a9a6ae4e4 100644 --- a/photon-server/src/main/resources/calibration/lifecam480p.json +++ b/photon-server/src/main/resources/calibration/lifecam480p.json @@ -31,4 +31,4 @@ 1.9833437176538498 ] } -} \ No newline at end of file +} diff --git a/photon-server/test.json b/photon-server/test.json index 10c0c2e72..173b493aa 100644 --- a/photon-server/test.json +++ b/photon-server/test.json @@ -1 +1 @@ -{"baseName":"aaaaaa","uniqueName":"aaaaaa","nickname":"aaaaaa","FOV":70.0,"path":"dev/vid","cameraType":"UsbCamera","currentPipelineIndex":0,"camPitch":{"radians":0.0},"calibrations":[], "cameraLEDs":[]} \ No newline at end of file +{"baseName":"aaaaaa","uniqueName":"aaaaaa","nickname":"aaaaaa","FOV":70.0,"path":"dev/vid","cameraType":"UsbCamera","currentPipelineIndex":0,"camPitch":{"radians":0.0},"calibrations":[], "cameraLEDs":[]} diff --git a/photon-targeting/.gitignore b/photon-targeting/.gitignore index 933a7e534..bad380c87 100644 --- a/photon-targeting/.gitignore +++ b/photon-targeting/.gitignore @@ -10,4 +10,4 @@ build/* photonvision/* photonvision_config/* -src/main/java/org/photonvision/PhotonVersion.java \ No newline at end of file +src/main/java/org/photonvision/PhotonVersion.java diff --git a/photon-targeting/settings.gradle b/photon-targeting/settings.gradle index 674b1ce85..68f151259 100644 --- a/photon-targeting/settings.gradle +++ b/photon-targeting/settings.gradle @@ -1,2 +1 @@ rootProject.name = 'photon-targeting' - diff --git a/photon-targeting/src/main/java/org/photonvision/common/dataflow/structures/Packet.java b/photon-targeting/src/main/java/org/photonvision/common/dataflow/structures/Packet.java index 479b09458..cb8056f0b 100644 --- a/photon-targeting/src/main/java/org/photonvision/common/dataflow/structures/Packet.java +++ b/photon-targeting/src/main/java/org/photonvision/common/dataflow/structures/Packet.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.dataflow.structures; /** A packet that holds byte-packed data to be sent over NetworkTables. */ diff --git a/photon-targeting/src/main/java/org/photonvision/common/hardware/VisionLEDMode.java b/photon-targeting/src/main/java/org/photonvision/common/hardware/VisionLEDMode.java index af95fc2cb..73e9ed295 100644 --- a/photon-targeting/src/main/java/org/photonvision/common/hardware/VisionLEDMode.java +++ b/photon-targeting/src/main/java/org/photonvision/common/hardware/VisionLEDMode.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.common.hardware; public enum VisionLEDMode { diff --git a/photon-targeting/src/main/java/org/photonvision/targeting/PhotonPipelineResult.java b/photon-targeting/src/main/java/org/photonvision/targeting/PhotonPipelineResult.java index 308964468..d9dcc435a 100644 --- a/photon-targeting/src/main/java/org/photonvision/targeting/PhotonPipelineResult.java +++ b/photon-targeting/src/main/java/org/photonvision/targeting/PhotonPipelineResult.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.targeting; import java.util.ArrayList; @@ -24,7 +23,6 @@ import org.photonvision.common.dataflow.structures.Packet; /** Represents a pipeline result from a PhotonCamera. */ public class PhotonPipelineResult { - private static boolean HAS_WARNED = false; // Targets to store. diff --git a/photon-targeting/src/main/java/org/photonvision/targeting/PhotonTrackedTarget.java b/photon-targeting/src/main/java/org/photonvision/targeting/PhotonTrackedTarget.java index 002c73724..fa141884c 100644 --- a/photon-targeting/src/main/java/org/photonvision/targeting/PhotonTrackedTarget.java +++ b/photon-targeting/src/main/java/org/photonvision/targeting/PhotonTrackedTarget.java @@ -14,12 +14,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision.targeting; -import edu.wpi.first.wpilibj.geometry.Rotation2d; -import edu.wpi.first.wpilibj.geometry.Transform2d; -import edu.wpi.first.wpilibj.geometry.Translation2d; +import edu.wpi.first.math.geometry.Rotation2d; +import edu.wpi.first.math.geometry.Transform2d; +import edu.wpi.first.math.geometry.Translation2d; import java.util.Objects; import org.photonvision.common.dataflow.structures.Packet; diff --git a/photonlib-cpp-examples/build.gradle b/photonlib-cpp-examples/build.gradle index d071fa61f..5ba609699 100644 --- a/photonlib-cpp-examples/build.gradle +++ b/photonlib-cpp-examples/build.gradle @@ -38,7 +38,7 @@ model { binaries.all { binary -> lib project: ':photon-lib', library: 'Photon', linkage: 'shared' if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { - nativeUtils.useRequiredLibrary(binary, 'netcomm_shared', 'chipobject_shared', 'visa_shared', 'ni_runtime_shared') + nativeUtils.useRequiredLibrary(binary, 'ni_link_libraries', 'ni_runtime_libraries') } } sources { @@ -62,4 +62,4 @@ model { ext { exampleDirectory = new File("$projectDir/src/main/java/edu/wpi/first/wpilibj/examples/") exampleFile = new File("$projectDir/src/main/java/edu/wpi/first/wpilibj/examples/examples.json") -} \ No newline at end of file +} diff --git a/photonlib-cpp-examples/settings.gradle b/photonlib-cpp-examples/settings.gradle index 325404797..016e831a1 100644 --- a/photonlib-cpp-examples/settings.gradle +++ b/photonlib-cpp-examples/settings.gradle @@ -1 +1 @@ -rootproject.name = 'photonlib-cpp-examples' \ No newline at end of file +rootproject.name = 'photonlib-cpp-examples' diff --git a/photonlib-cpp-examples/src/main/cpp/examples/aimandrange/cpp/Robot.cpp b/photonlib-cpp-examples/src/main/cpp/examples/aimandrange/cpp/Robot.cpp index e1d3f041e..4998a036b 100644 --- a/photonlib-cpp-examples/src/main/cpp/examples/aimandrange/cpp/Robot.cpp +++ b/photonlib-cpp-examples/src/main/cpp/examples/aimandrange/cpp/Robot.cpp @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2018-2020 Photon Vision. +/* + * Copyright (C) Photon Vision. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,24 +26,24 @@ void Robot::TeleopPeriodic() { if (xboxController.GetAButton()) { // Vision-alignment mode // Query the latest result from PhotonVision - const auto &result = camera.GetLatestResult(); + const auto& result = camera.GetLatestResult(); if (result.HasTargets()) { // First calculate range - units::meter_t range = - photonlib::PhotonUtils::CalculateDistanceToTarget( - CAMERA_HEIGHT, TARGET_HEIGHT, CAMERA_PITCH, - units::degree_t{result.GetBestTarget().GetPitch()}); + units::meter_t range = photonlib::PhotonUtils::CalculateDistanceToTarget( + CAMERA_HEIGHT, TARGET_HEIGHT, CAMERA_PITCH, + units::degree_t{result.GetBestTarget().GetPitch()}); // Use this range as the measurement we give to the PID controller. - // -1.0 required to ensure positive PID controller effort _increases_ range - forwardSpeed = -1.0* forwardController.Calculate( - range.to(), GOAL_RANGE_METERS.to()); + // -1.0 required to ensure positive PID controller effort _increases_ + // range + forwardSpeed = -forwardController.Calculate(range.value(), + GOAL_RANGE_METERS.value()); // Also calculate angular power // -1.0 required to ensure positive PID controller effort _increases_ yaw - rotationSpeed = -1.0 * turnController.Calculate( - result.GetBestTarget().GetYaw(), 0); + rotationSpeed = + -turnController.Calculate(result.GetBestTarget().GetYaw(), 0); } else { // If we have no targets, stay still. forwardSpeed = 0; @@ -51,10 +51,8 @@ void Robot::TeleopPeriodic() { } } else { // Manual Driver Mode - forwardSpeed = - -1.0 * xboxController.GetY(frc::GenericHID::JoystickHand::kRightHand); - rotationSpeed = - xboxController.GetX(frc::GenericHID::JoystickHand::kLeftHand); + forwardSpeed = -xboxController.GetRightY(); + rotationSpeed = xboxController.GetLeftX(); } // Use our forward/turn speeds to control the drivetrain diff --git a/photonlib-cpp-examples/src/main/cpp/examples/aimandrange/include/Robot.h b/photonlib-cpp-examples/src/main/cpp/examples/aimandrange/include/Robot.h index 9a42f4fcf..a290efb22 100644 --- a/photonlib-cpp-examples/src/main/cpp/examples/aimandrange/include/Robot.h +++ b/photonlib-cpp-examples/src/main/cpp/examples/aimandrange/include/Robot.h @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2018-2020 Photon Vision. +/* + * Copyright (C) Photon Vision. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,19 +19,19 @@ #include -#include #include #include #include #include +#include #include #include class Robot : public frc::TimedRobot { -public: + public: void TeleopPeriodic() override; -private: + private: // Constants such as camera and target height stored. Change per robot and // goal! const units::meter_t CAMERA_HEIGHT = 24_in; diff --git a/photonlib-cpp-examples/src/main/cpp/examples/aimattarget/cpp/Robot.cpp b/photonlib-cpp-examples/src/main/cpp/examples/aimattarget/cpp/Robot.cpp index 281fd7eba..10235d980 100644 --- a/photonlib-cpp-examples/src/main/cpp/examples/aimattarget/cpp/Robot.cpp +++ b/photonlib-cpp-examples/src/main/cpp/examples/aimattarget/cpp/Robot.cpp @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2018-2020 Photon Vision. +/* + * Copyright (C) Photon Vision. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,8 +20,7 @@ #include void Robot::TeleopPeriodic() { - double forwardSpeed = - -1.0 * xboxController.GetY(frc::GenericHID::JoystickHand::kRightHand); + double forwardSpeed = -xboxController.GetRightY(); double rotationSpeed; if (xboxController.GetAButton()) { @@ -31,15 +30,14 @@ void Robot::TeleopPeriodic() { if (result.HasTargets()) { // Rotation speed is the output of the PID controller - rotationSpeed = -1.0 * controller.Calculate(result.GetBestTarget().GetYaw(), 0); + rotationSpeed = -controller.Calculate(result.GetBestTarget().GetYaw(), 0); } else { // If we have no targets, stay still. rotationSpeed = 0; } } else { // Manual Driver Mode - rotationSpeed = - xboxController.GetX(frc::GenericHID::JoystickHand::kLeftHand); + rotationSpeed = xboxController.GetLeftX(); } // Use our forward/turn speeds to control the drivetrain diff --git a/photonlib-cpp-examples/src/main/cpp/examples/aimattarget/include/Robot.h b/photonlib-cpp-examples/src/main/cpp/examples/aimattarget/include/Robot.h index b0cac12a4..cac6332d8 100644 --- a/photonlib-cpp-examples/src/main/cpp/examples/aimattarget/include/Robot.h +++ b/photonlib-cpp-examples/src/main/cpp/examples/aimattarget/include/Robot.h @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2018-2020 Photon Vision. +/* + * Copyright (C) Photon Vision. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,19 +19,19 @@ #include -#include #include #include #include #include +#include #include #include class Robot : public frc::TimedRobot { -public: + public: void TeleopPeriodic() override; -private: + private: // Change this to match the name of your camera photonlib::PhotonCamera camera{"photonvision"}; // PID constants should be tuned per robot diff --git a/photonlib-cpp-examples/src/main/cpp/examples/getinrange/cpp/Robot.cpp b/photonlib-cpp-examples/src/main/cpp/examples/getinrange/cpp/Robot.cpp index 7e88193bf..b8cc02aa7 100644 --- a/photonlib-cpp-examples/src/main/cpp/examples/getinrange/cpp/Robot.cpp +++ b/photonlib-cpp-examples/src/main/cpp/examples/getinrange/cpp/Robot.cpp @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2018-2020 Photon Vision. +/* + * Copyright (C) Photon Vision. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,8 +21,7 @@ void Robot::TeleopPeriodic() { double forwardSpeed; - double rotationSpeed = - xboxController.GetX(frc::GenericHID::JoystickHand::kLeftHand); + double rotationSpeed = xboxController.GetLeftX(); if (xboxController.GetAButton()) { // Vision-alignment mode @@ -36,16 +35,15 @@ void Robot::TeleopPeriodic() { units::degree_t{result.GetBestTarget().GetPitch()}); // Use this range as the measurement we give to the PID controller. - forwardSpeed = -1.0 * controller.Calculate(range.to(), - GOAL_RANGE_METERS.to()); + forwardSpeed = + -controller.Calculate(range.value(), GOAL_RANGE_METERS.value()); } else { // If we have no targets, stay still. forwardSpeed = 0; } } else { // Manual Driver Mode - forwardSpeed = - -1.0 * xboxController.GetY(frc::GenericHID::JoystickHand::kRightHand); + forwardSpeed = -xboxController.GetRightY(); } // Use our forward/turn speeds to control the drivetrain diff --git a/photonlib-cpp-examples/src/main/cpp/examples/getinrange/include/Robot.h b/photonlib-cpp-examples/src/main/cpp/examples/getinrange/include/Robot.h index 10272a4af..452d9ad7a 100644 --- a/photonlib-cpp-examples/src/main/cpp/examples/getinrange/include/Robot.h +++ b/photonlib-cpp-examples/src/main/cpp/examples/getinrange/include/Robot.h @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2018-2020 Photon Vision. +/* + * Copyright (C) Photon Vision. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,19 +19,19 @@ #include -#include #include #include #include #include +#include #include #include class Robot : public frc::TimedRobot { -public: + public: void TeleopPeriodic() override; -private: + private: // Constants such as camera and target height stored. Change per robot and // goal! const units::meter_t CAMERA_HEIGHT = 24_in; diff --git a/photonlib-cpp-examples/src/main/cpp/examples/simaimandrange/cpp/Robot.cpp b/photonlib-cpp-examples/src/main/cpp/examples/simaimandrange/cpp/Robot.cpp index 3658933b7..ea343872f 100644 --- a/photonlib-cpp-examples/src/main/cpp/examples/simaimandrange/cpp/Robot.cpp +++ b/photonlib-cpp-examples/src/main/cpp/examples/simaimandrange/cpp/Robot.cpp @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2018-2020 Photon Vision. +/* + * Copyright (C) Photon Vision. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,24 +26,24 @@ void Robot::TeleopPeriodic() { if (xboxController.GetAButton()) { // Vision-alignment mode // Query the latest result from PhotonVision - const auto &result = camera.GetLatestResult(); + const auto& result = camera.GetLatestResult(); if (result.HasTargets()) { // First calculate range - units::meter_t range = - photonlib::PhotonUtils::CalculateDistanceToTarget( - CAMERA_HEIGHT, TARGET_HEIGHT, CAMERA_PITCH, - units::degree_t{result.GetBestTarget().GetPitch()}); + units::meter_t range = photonlib::PhotonUtils::CalculateDistanceToTarget( + CAMERA_HEIGHT, TARGET_HEIGHT, CAMERA_PITCH, + units::degree_t{result.GetBestTarget().GetPitch()}); // Use this range as the measurement we give to the PID controller. - // -1.0 required to ensure positive PID controller effort _increases_ range - forwardSpeed = -1.0* forwardController.Calculate( - range.to(), GOAL_RANGE_METERS.to()); + // -1.0 required to ensure positive PID controller effort _increases_ + // range + forwardSpeed = -forwardController.Calculate(range.value(), + GOAL_RANGE_METERS.value()); // Also calculate angular power // -1.0 required to ensure positive PID controller effort _increases_ yaw - rotationSpeed = -1.0 * turnController.Calculate( - result.GetBestTarget().GetYaw(), 0); + rotationSpeed = + -turnController.Calculate(result.GetBestTarget().GetYaw(), 0); } else { // If we have no targets, stay still. forwardSpeed = 0; @@ -51,22 +51,16 @@ void Robot::TeleopPeriodic() { } } else { // Manual Driver Mode - forwardSpeed = - -1.0 * xboxController.GetY(frc::GenericHID::JoystickHand::kRightHand); - rotationSpeed = - xboxController.GetX(frc::GenericHID::JoystickHand::kLeftHand); + forwardSpeed = -xboxController.GetRightY(); + rotationSpeed = xboxController.GetLeftX(); } // Use our forward/turn speeds to control the drivetrain drive.ArcadeDrive(forwardSpeed, rotationSpeed); } -void Robot::SimulationPeriodic() { - dtSim.update(); -} +void Robot::SimulationPeriodic() { dtSim.update(); } #ifndef RUNNING_FRC_TESTS int main() { return frc::StartRobot(); } #endif - - diff --git a/photonlib-cpp-examples/src/main/cpp/examples/simaimandrange/cpp/sim/DrivetrainSim.cpp b/photonlib-cpp-examples/src/main/cpp/examples/simaimandrange/cpp/sim/DrivetrainSim.cpp index 818bc24d8..59a537787 100644 --- a/photonlib-cpp-examples/src/main/cpp/examples/simaimandrange/cpp/sim/DrivetrainSim.cpp +++ b/photonlib-cpp-examples/src/main/cpp/examples/simaimandrange/cpp/sim/DrivetrainSim.cpp @@ -1,43 +1,43 @@ -/** - * Copyright (C) 2018-2020 Photon Vision. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "DrivetrainSim.h" - -/** -* Perform all periodic drivetrain simulation related tasks to advance our simulation of robot -* physics forward by a single 20ms step. -*/ -void DrivetrainSim::update(){ - - double leftMotorCmd = 0; - double rightMotorCmd = 0; - - if (frc::DriverStation::GetInstance().IsEnabled() && !frc::RobotController::IsBrownedOut()) { - leftMotorCmd = leftLeader.GetSpeed(); - rightMotorCmd = rightLeader.GetSpeed(); - } - - m_drivetrainSimulator.SetInputs( - units::volt_t(leftMotorCmd * frc::RobotController::GetInputVoltage()), - units::volt_t(-rightMotorCmd * frc::RobotController::GetInputVoltage()) ); - m_drivetrainSimulator.Update(20_ms); - - // Update PhotonVision based on our new robot position. - simVision.ProcessFrame(m_drivetrainSimulator.GetPose()); - - field.SetRobotPose(m_drivetrainSimulator.GetPose()); -} \ No newline at end of file +/* + * Copyright (C) Photon Vision. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "DrivetrainSim.h" + +/** + * Perform all periodic drivetrain simulation related tasks to advance our + * simulation of robot physics forward by a single 20ms step. + */ +void DrivetrainSim::update() { + double leftMotorCmd = 0; + double rightMotorCmd = 0; + + if (frc::DriverStation::IsEnabled() && + !frc::RobotController::IsBrownedOut()) { + leftMotorCmd = leftLeader.GetSpeed(); + rightMotorCmd = rightLeader.GetSpeed(); + } + + m_drivetrainSimulator.SetInputs( + units::volt_t(leftMotorCmd * frc::RobotController::GetInputVoltage()), + units::volt_t(-rightMotorCmd * frc::RobotController::GetInputVoltage())); + m_drivetrainSimulator.Update(20_ms); + + // Update PhotonVision based on our new robot position. + simVision.ProcessFrame(m_drivetrainSimulator.GetPose()); + + field.SetRobotPose(m_drivetrainSimulator.GetPose()); +} diff --git a/photonlib-cpp-examples/src/main/cpp/examples/simaimandrange/include/DrivetrainSim.h b/photonlib-cpp-examples/src/main/cpp/examples/simaimandrange/include/DrivetrainSim.h index faf0183c6..61ba13489 100644 --- a/photonlib-cpp-examples/src/main/cpp/examples/simaimandrange/include/DrivetrainSim.h +++ b/photonlib-cpp-examples/src/main/cpp/examples/simaimandrange/include/DrivetrainSim.h @@ -1,107 +1,105 @@ -/** - * Copyright (C) 2018-2020 Photon Vision. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#pragma once - -class DrivetrainSim { - - -public: - - DrivetrainSim(){ - simVision.AddSimVisionTarget(photonlib::SimVisionTarget(farTargetPose, 81.91_in, targetWidth, targetHeight)); - frc::SmartDashboard::PutData("Field", &field); - } - - void update(); - -private: - - // Simulated Motor Controllers - frc::sim::PWMSim leftLeader {0}; - frc::sim::PWMSim rightLeader {1}; - - // Simulation Physics - // Configure these to match your drivetrain's physical dimensions - // and characterization results. - decltype(1_V / 1_mps) kv = 1.98 * 1_V * 1_s / 1_m; - decltype(1_V / 1_mps_sq) ka = 0.2 * 1_V * 1_s * 1_s / 1_m; - decltype(1_V / 1_rad_per_s) kvAngular = 1.5 * 1_V * 1_s / 1_rad; - decltype(1_V / 1_rad_per_s_sq) kaAngular = 0.3 * 1_V * 1_s * 1_s / 1_rad; - - const frc::LinearSystem<2, 2, 2> kDrivetrainPlant = - frc::LinearSystemId::IdentifyDrivetrainSystem(kv, ka, kvAngular, kaAngular); - - frc::sim::DifferentialDrivetrainSim m_drivetrainSimulator{ - kDrivetrainPlant, - 2.0_ft, - frc::DCMotor::CIM(2), - 8.0, - 6.0_in / 2, - {0.001, 0.001, 0.0001, 0.1, 0.1, 0.005, 0.005}}; - - // Simulated Vision System. - // Configure these to match your PhotonVision Camera, - // pipeline, and LED setup. - units::degree_t camDiagFOV = 170.0_deg; // assume wide-angle camera - units::degree_t camPitch = 15_deg; - units::meter_t camHeightOffGround = 24_in; - units::meter_t maxLEDRange = 20_m; - int camResolutionWidth = 640; // pixels - int camResolutionHeight = 480; // pixels - double minTargetArea = 10; // square pixels - - photonlib::SimVisionSystem simVision { - "photonvision", - camDiagFOV, - camPitch, - frc::Transform2d{}, - camHeightOffGround, - maxLEDRange, - camResolutionWidth, - camResolutionHeight, - minTargetArea}; - - // See https://firstfrc.blob.core.windows.net/frc2020/PlayingField/2020FieldDrawing-SeasonSpecific.pdf page 208 - const units::meter_t targetWidth = 41.30_in - 6.70_in; - // See https://firstfrc.blob.core.windows.net/frc2020/PlayingField/2020FieldDrawing-SeasonSpecific.pdf page 197 - const units::meter_t targetHeight = 98.19_in - 81.19_in; // meters - // See https://firstfrc.blob.core.windows.net/frc2020/PlayingField/LayoutandMarkingDiagram.pdf pages 4 and 5 - const units::meter_t tgtXPos = 54_ft; - const units::meter_t tgtYPos = (27.0_ft / 2) - 43.75_in - (48.0_in / 2.0); - const frc::Translation2d targetTrans {tgtXPos, tgtYPos}; - const frc::Rotation2d targetRot {0.0_deg}; - frc::Pose2d farTargetPose {targetTrans, targetRot}; - - frc::Field2d field {}; - -}; \ No newline at end of file +/* + * Copyright (C) Photon Vision. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#pragma once + +class DrivetrainSim { + public: + DrivetrainSim() { + simVision.AddSimVisionTarget(photonlib::SimVisionTarget( + farTargetPose, 81.91_in, targetWidth, targetHeight)); + frc::SmartDashboard::PutData("Field", &field); + } + + void update(); + + private: + // Simulated Motor Controllers + frc::sim::PWMSim leftLeader{0}; + frc::sim::PWMSim rightLeader{1}; + + // Simulation Physics + // Configure these to match your drivetrain's physical dimensions + // and characterization results. + static constexpr decltype(1_V / 1_mps) kv = 1.98 * 1_V * 1_s / 1_m; + static constexpr decltype(1_V / 1_mps_sq) ka = 0.2 * 1_V * 1_s * 1_s / 1_m; + static constexpr decltype(1_V / 1_rad_per_s) kvAngular = + 1.5 * 1_V * 1_s / 1_rad; + static constexpr decltype(1_V / 1_rad_per_s_sq) kaAngular = + 0.3 * 1_V * 1_s * 1_s / 1_rad; + static constexpr units::meter_t kTrackWidth = 1_m; + + const frc::LinearSystem<2, 2, 2> kDrivetrainPlant = + frc::LinearSystemId::IdentifyDrivetrainSystem(kv, ka, kvAngular, + kaAngular, kTrackWidth); + + frc::sim::DifferentialDrivetrainSim m_drivetrainSimulator{ + kDrivetrainPlant, 2.0_ft, + frc::DCMotor::CIM(2), 8.0, + 6.0_in / 2, {0.001, 0.001, 0.0001, 0.1, 0.1, 0.005, 0.005}}; + + // Simulated Vision System. + // Configure these to match your PhotonVision Camera, + // pipeline, and LED setup. + units::degree_t camDiagFOV = 170.0_deg; // assume wide-angle camera + units::degree_t camPitch = 15_deg; + units::meter_t camHeightOffGround = 24_in; + units::meter_t maxLEDRange = 20_m; + int camResolutionWidth = 640; // pixels + int camResolutionHeight = 480; // pixels + double minTargetArea = 10; // square pixels + + photonlib::SimVisionSystem simVision{ + "photonvision", camDiagFOV, camPitch, + frc::Transform2d{}, camHeightOffGround, maxLEDRange, + camResolutionWidth, camResolutionHeight, minTargetArea}; + + // See + // https://firstfrc.blob.core.windows.net/frc2020/PlayingField/2020FieldDrawing-SeasonSpecific.pdf + // page 208 + const units::meter_t targetWidth = 41.30_in - 6.70_in; + // See + // https://firstfrc.blob.core.windows.net/frc2020/PlayingField/2020FieldDrawing-SeasonSpecific.pdf + // page 197 + const units::meter_t targetHeight = 98.19_in - 81.19_in; // meters + // See + // https://firstfrc.blob.core.windows.net/frc2020/PlayingField/LayoutandMarkingDiagram.pdf + // pages 4 and 5 + const units::meter_t tgtXPos = 54_ft; + const units::meter_t tgtYPos = (27.0_ft / 2) - 43.75_in - (48.0_in / 2.0); + const frc::Translation2d targetTrans{tgtXPos, tgtYPos}; + const frc::Rotation2d targetRot{0.0_deg}; + frc::Pose2d farTargetPose{targetTrans, targetRot}; + + frc::Field2d field{}; +}; diff --git a/photonlib-cpp-examples/src/main/cpp/examples/simaimandrange/include/Robot.h b/photonlib-cpp-examples/src/main/cpp/examples/simaimandrange/include/Robot.h index 636b5429a..cb00b0b44 100644 --- a/photonlib-cpp-examples/src/main/cpp/examples/simaimandrange/include/Robot.h +++ b/photonlib-cpp-examples/src/main/cpp/examples/simaimandrange/include/Robot.h @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2018-2020 Photon Vision. +/* + * Copyright (C) Photon Vision. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,24 +17,24 @@ #pragma once -#include "DrivetrainSim.h" - #include -#include #include #include #include #include +#include #include #include +#include "DrivetrainSim.h" + class Robot : public frc::TimedRobot { -public: + public: void TeleopPeriodic() override; void SimulationPeriodic() override; -private: + private: // Constants such as camera and target height stored. Change per robot and // goal! const units::meter_t CAMERA_HEIGHT = 24_in; diff --git a/photonlib-java-examples/build.gradle b/photonlib-java-examples/build.gradle index fd94883db..2ff9f5ee1 100644 --- a/photonlib-java-examples/build.gradle +++ b/photonlib-java-examples/build.gradle @@ -6,25 +6,44 @@ apply plugin: "edu.wpi.first.NativeUtils" apply from: "${rootDir}/shared/config.gradle" +// Configure wpigui, libglass, libglassnt. nativeUtils { - dependencyConfigs { - gui { - groupId = "edu.wpi.first.halsim" - artifactId = "halsim_gui" - headerClassifier = "headers" - sourceClassifier = "sources" - ext = "zip" - version = wpilibVersion - sharedPlatforms << "osxx86-64" << "linuxx86-64" << "windowsx86-64" - } + nativeDependencyContainer { + wpigui(getNativeDependencyTypeClass('WPIStaticMavenDependency')) { + groupId = "edu.wpi.first.wpigui" + artifactId = "wpigui-cpp" + headerClassifier = "headers" + sourceClassifier = "sources" + ext = "zip" + version = wpilibVersion + targetPlatforms.addAll(nativeUtils.wpi.platforms.desktopPlatforms) } - combinedDependencyConfigs { - halsim_gui { - libraryName = "halsim_gui" - targetPlatforms << "osxx86-64" << "linuxx86-64" << "windowsx86-64" - dependencies << "gui_shared" - } + libglass(getNativeDependencyTypeClass('WPIStaticMavenDependency')) { + groupId = "edu.wpi.first.glass" + artifactId = "libglass" + headerClassifier = "headers" + sourceClassifier = "sources" + ext = "zip" + version = wpilibVersion + targetPlatforms.addAll(nativeUtils.wpi.platforms.desktopPlatforms) } + libglassnt(getNativeDependencyTypeClass('WPIStaticMavenDependency')) { + groupId = "edu.wpi.first.glass" + artifactId = "libglassnt" + headerClassifier = "headers" + sourceClassifier = "sources" + ext = "zip" + version = wpilibVersion + targetPlatforms.addAll(nativeUtils.wpi.platforms.desktopPlatforms) + } + + // Combined + gui(getNativeDependencyTypeClass('AllPlatformsCombinedNativeDependency')) { + dependencies = [ + "libglassnt", "libglass", "wpigui", "imgui_static", + "wpimath_static", "ntcore_static", "wpiutil_static"] + } + } } ext { @@ -42,11 +61,10 @@ dependencies { implementation "edu.wpi.first.wpiutil:wpiutil-java:$wpilibVersion" implementation "edu.wpi.first.wpimath:wpimath-java:$wpilibVersion" implementation "edu.wpi.first.hal:hal-java:$wpilibVersion" - implementation "org.ejml:ejml-simple:0.38" implementation "com.fasterxml.jackson.core:jackson-annotations:2.10.0" implementation "com.fasterxml.jackson.core:jackson-core:2.10.0" implementation "com.fasterxml.jackson.core:jackson-databind:2.10.0" - implementation "edu.wpi.first.thirdparty.frc2020.opencv:opencv-java:3.4.7-3" + implementation "edu.wpi.first.thirdparty.frc2022.opencv:opencv-java:$opencvVersion" } model { @@ -67,10 +85,6 @@ model { binaries.all { binary -> nativeUtils.useRequiredLibrary(binary, "wpilib_executable_shared") nativeUtils.useRequiredLibrary(binary, "opencv_shared") - - if (binary.targetPlatform.name == NativePlatforms.desktop) { - nativeUtils.useRequiredLibrary(binary, "halsim_gui") - } } } } diff --git a/photonlib-java-examples/src/dev/native/cpp/main.cpp b/photonlib-java-examples/src/dev/native/cpp/main.cpp index 70059c2f2..6ad38377b 100644 --- a/photonlib-java-examples/src/dev/native/cpp/main.cpp +++ b/photonlib-java-examples/src/dev/native/cpp/main.cpp @@ -1,8 +1,18 @@ -/*----------------------------------------------------------------------------*/ -/* Copyright (c) 2020 FIRST. All Rights Reserved. */ -/* Open Source Software - may be modified and shared by FRC teams. The code */ -/* must be accompanied by the FIRST BSD license file in the root directory of */ -/* the project. */ -/*----------------------------------------------------------------------------*/ - -int main() {} +/* + * Copyright (C) Photon Vision. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +int main() {} diff --git a/photonlib-java-examples/src/main/java/org/photonlib/examples/aimandrange/Main.java b/photonlib-java-examples/src/main/java/org/photonlib/examples/aimandrange/Main.java index b11b5b18a..ed8fc7abf 100644 --- a/photonlib-java-examples/src/main/java/org/photonlib/examples/aimandrange/Main.java +++ b/photonlib-java-examples/src/main/java/org/photonlib/examples/aimandrange/Main.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonlib.examples.aimandrange; import edu.wpi.first.wpilibj.RobotBase; diff --git a/photonlib-java-examples/src/main/java/org/photonlib/examples/aimandrange/Robot.java b/photonlib-java-examples/src/main/java/org/photonlib/examples/aimandrange/Robot.java index f2f624604..112789fb0 100644 --- a/photonlib-java-examples/src/main/java/org/photonlib/examples/aimandrange/Robot.java +++ b/photonlib-java-examples/src/main/java/org/photonlib/examples/aimandrange/Robot.java @@ -14,16 +14,14 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonlib.examples.aimandrange; -import edu.wpi.first.wpilibj.GenericHID; -import edu.wpi.first.wpilibj.PWMVictorSPX; +import edu.wpi.first.math.controller.PIDController; +import edu.wpi.first.math.util.Units; import edu.wpi.first.wpilibj.TimedRobot; import edu.wpi.first.wpilibj.XboxController; -import edu.wpi.first.wpilibj.controller.PIDController; import edu.wpi.first.wpilibj.drive.DifferentialDrive; -import edu.wpi.first.wpilibj.util.Units; +import edu.wpi.first.wpilibj.motorcontrol.PWMVictorSPX; import org.photonvision.PhotonCamera; import org.photonvision.PhotonUtils; @@ -83,11 +81,11 @@ public class Robot extends TimedRobot { // Use this range as the measurement we give to the PID controller. // -1.0 required to ensure positive PID controller effort _increases_ range - forwardSpeed = -1.0 * forwardController.calculate(range, GOAL_RANGE_METERS); + forwardSpeed = -forwardController.calculate(range, GOAL_RANGE_METERS); // Also calculate angular power // -1.0 required to ensure positive PID controller effort _increases_ yaw - rotationSpeed = -1.0 * turnController.calculate(result.getBestTarget().getYaw(), 0); + rotationSpeed = -turnController.calculate(result.getBestTarget().getYaw(), 0); } else { // If we have no targets, stay still. forwardSpeed = 0; @@ -95,8 +93,8 @@ public class Robot extends TimedRobot { } } else { // Manual Driver Mode - forwardSpeed = -1.0 * xboxController.getY(GenericHID.Hand.kRight); - rotationSpeed = xboxController.getX(GenericHID.Hand.kLeft); + forwardSpeed = -xboxController.getRightY(); + rotationSpeed = xboxController.getLeftX(); } // Use our forward/turn speeds to control the drivetrain diff --git a/photonlib-java-examples/src/main/java/org/photonlib/examples/aimattarget/Main.java b/photonlib-java-examples/src/main/java/org/photonlib/examples/aimattarget/Main.java index bdb793801..f9a9620ec 100644 --- a/photonlib-java-examples/src/main/java/org/photonlib/examples/aimattarget/Main.java +++ b/photonlib-java-examples/src/main/java/org/photonlib/examples/aimattarget/Main.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonlib.examples.aimattarget; import edu.wpi.first.wpilibj.RobotBase; diff --git a/photonlib-java-examples/src/main/java/org/photonlib/examples/aimattarget/Robot.java b/photonlib-java-examples/src/main/java/org/photonlib/examples/aimattarget/Robot.java index e8c2bcebe..2c351995f 100644 --- a/photonlib-java-examples/src/main/java/org/photonlib/examples/aimattarget/Robot.java +++ b/photonlib-java-examples/src/main/java/org/photonlib/examples/aimattarget/Robot.java @@ -14,16 +14,14 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonlib.examples.aimattarget; -import edu.wpi.first.wpilibj.GenericHID; -import edu.wpi.first.wpilibj.PWMVictorSPX; +import edu.wpi.first.math.controller.PIDController; +import edu.wpi.first.math.util.Units; import edu.wpi.first.wpilibj.TimedRobot; import edu.wpi.first.wpilibj.XboxController; -import edu.wpi.first.wpilibj.controller.PIDController; import edu.wpi.first.wpilibj.drive.DifferentialDrive; -import edu.wpi.first.wpilibj.util.Units; +import edu.wpi.first.wpilibj.motorcontrol.PWMVictorSPX; import org.photonvision.PhotonCamera; /** @@ -66,7 +64,7 @@ public class Robot extends TimedRobot { double forwardSpeed; double rotationSpeed; - forwardSpeed = -1.0 * xboxController.getY(GenericHID.Hand.kRight); + forwardSpeed = -xboxController.getRightY(); if (xboxController.getAButton()) { // Vision-alignment mode @@ -76,14 +74,14 @@ public class Robot extends TimedRobot { if (result.hasTargets()) { // Calculate angular turn power // -1.0 required to ensure positive PID controller effort _increases_ yaw - rotationSpeed = -1.0 * turnController.calculate(result.getBestTarget().getYaw(), 0); + rotationSpeed = -turnController.calculate(result.getBestTarget().getYaw(), 0); } else { // If we have no targets, stay still. rotationSpeed = 0; } } else { // Manual Driver Mode - rotationSpeed = xboxController.getX(GenericHID.Hand.kLeft); + rotationSpeed = xboxController.getLeftX(); } // Use our forward/turn speeds to control the drivetrain diff --git a/photonlib-java-examples/src/main/java/org/photonlib/examples/examples.json b/photonlib-java-examples/src/main/java/org/photonlib/examples/examples.json index d007d0a42..40c05cc5a 100644 --- a/photonlib-java-examples/src/main/java/org/photonlib/examples/examples.json +++ b/photonlib-java-examples/src/main/java/org/photonlib/examples/examples.json @@ -59,4 +59,4 @@ "dependencies": [], "foldername": "simposeest" } -] \ No newline at end of file +] diff --git a/photonlib-java-examples/src/main/java/org/photonlib/examples/getinrange/Main.java b/photonlib-java-examples/src/main/java/org/photonlib/examples/getinrange/Main.java index 12e41d08e..0f5d6826e 100644 --- a/photonlib-java-examples/src/main/java/org/photonlib/examples/getinrange/Main.java +++ b/photonlib-java-examples/src/main/java/org/photonlib/examples/getinrange/Main.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonlib.examples.getinrange; import edu.wpi.first.wpilibj.RobotBase; diff --git a/photonlib-java-examples/src/main/java/org/photonlib/examples/getinrange/Robot.java b/photonlib-java-examples/src/main/java/org/photonlib/examples/getinrange/Robot.java index 26cea1bac..7df84185c 100644 --- a/photonlib-java-examples/src/main/java/org/photonlib/examples/getinrange/Robot.java +++ b/photonlib-java-examples/src/main/java/org/photonlib/examples/getinrange/Robot.java @@ -14,16 +14,14 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonlib.examples.getinrange; -import edu.wpi.first.wpilibj.GenericHID; -import edu.wpi.first.wpilibj.PWMVictorSPX; +import edu.wpi.first.math.controller.PIDController; +import edu.wpi.first.math.util.Units; import edu.wpi.first.wpilibj.TimedRobot; import edu.wpi.first.wpilibj.XboxController; -import edu.wpi.first.wpilibj.controller.PIDController; import edu.wpi.first.wpilibj.drive.DifferentialDrive; -import edu.wpi.first.wpilibj.util.Units; +import edu.wpi.first.wpilibj.motorcontrol.PWMVictorSPX; import org.photonvision.PhotonCamera; import org.photonvision.PhotonUtils; @@ -67,7 +65,7 @@ public class Robot extends TimedRobot { @Override public void teleopPeriodic() { double forwardSpeed; - double rotationSpeed = xboxController.getX(GenericHID.Hand.kLeft); + double rotationSpeed = xboxController.getLeftX(); if (xboxController.getAButton()) { // Vision-alignment mode @@ -85,14 +83,14 @@ public class Robot extends TimedRobot { // Use this range as the measurement we give to the PID controller. // -1.0 required to ensure positive PID controller effort _increases_ range - forwardSpeed = -1.0 * controller.calculate(range, GOAL_RANGE_METERS); + forwardSpeed = -controller.calculate(range, GOAL_RANGE_METERS); } else { // If we have no targets, stay still. forwardSpeed = 0; } } else { // Manual Driver Mode - forwardSpeed = -1.0 * xboxController.getY(GenericHID.Hand.kRight); + forwardSpeed = -xboxController.getRightY(); } // Use our forward/turn speeds to control the drivetrain diff --git a/photonlib-java-examples/src/main/java/org/photonlib/examples/simaimandrange/Main.java b/photonlib-java-examples/src/main/java/org/photonlib/examples/simaimandrange/Main.java index 74d41c403..6254d005d 100644 --- a/photonlib-java-examples/src/main/java/org/photonlib/examples/simaimandrange/Main.java +++ b/photonlib-java-examples/src/main/java/org/photonlib/examples/simaimandrange/Main.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonlib.examples.simaimandrange; import edu.wpi.first.wpilibj.RobotBase; diff --git a/photonlib-java-examples/src/main/java/org/photonlib/examples/simaimandrange/Robot.java b/photonlib-java-examples/src/main/java/org/photonlib/examples/simaimandrange/Robot.java index 5a6d47cfd..4f08f42c0 100644 --- a/photonlib-java-examples/src/main/java/org/photonlib/examples/simaimandrange/Robot.java +++ b/photonlib-java-examples/src/main/java/org/photonlib/examples/simaimandrange/Robot.java @@ -14,16 +14,14 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonlib.examples.simaimandrange; -import edu.wpi.first.wpilibj.GenericHID; -import edu.wpi.first.wpilibj.PWMVictorSPX; +import edu.wpi.first.math.controller.PIDController; +import edu.wpi.first.math.util.Units; import edu.wpi.first.wpilibj.TimedRobot; import edu.wpi.first.wpilibj.XboxController; -import edu.wpi.first.wpilibj.controller.PIDController; import edu.wpi.first.wpilibj.drive.DifferentialDrive; -import edu.wpi.first.wpilibj.util.Units; +import edu.wpi.first.wpilibj.motorcontrol.PWMVictorSPX; import org.photonlib.examples.simaimandrange.sim.DrivetrainSim; import org.photonvision.PhotonCamera; import org.photonvision.PhotonUtils; @@ -86,11 +84,11 @@ public class Robot extends TimedRobot { // Use this range as the measurement we give to the PID controller. // -1.0 required to ensure positive PID controller effort _increases_ range - forwardSpeed = -1.0 * forwardController.calculate(range, GOAL_RANGE_METERS); + forwardSpeed = -forwardController.calculate(range, GOAL_RANGE_METERS); // Also calculate angular power // -1.0 required to ensure positive PID controller effort _increases_ yaw - rotationSpeed = -1.0 * turnController.calculate(result.getBestTarget().getYaw(), 0); + rotationSpeed = -turnController.calculate(result.getBestTarget().getYaw(), 0); } else { // If we have no targets, stay still. forwardSpeed = 0; @@ -98,8 +96,8 @@ public class Robot extends TimedRobot { } } else { // Manual Driver Mode - forwardSpeed = -1.0 * xboxController.getY(GenericHID.Hand.kRight); - rotationSpeed = xboxController.getX(GenericHID.Hand.kLeft); + forwardSpeed = -xboxController.getRightY(); + rotationSpeed = xboxController.getLeftX(); } // Use our forward/turn speeds to control the drivetrain diff --git a/photonlib-java-examples/src/main/java/org/photonlib/examples/simaimandrange/sim/DrivetrainSim.java b/photonlib-java-examples/src/main/java/org/photonlib/examples/simaimandrange/sim/DrivetrainSim.java index 9e6d8124b..0e24b38a3 100644 --- a/photonlib-java-examples/src/main/java/org/photonlib/examples/simaimandrange/sim/DrivetrainSim.java +++ b/photonlib-java-examples/src/main/java/org/photonlib/examples/simaimandrange/sim/DrivetrainSim.java @@ -14,24 +14,23 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonlib.examples.simaimandrange.sim; +import edu.wpi.first.math.geometry.Pose2d; +import edu.wpi.first.math.geometry.Rotation2d; +import edu.wpi.first.math.geometry.Transform2d; +import edu.wpi.first.math.geometry.Translation2d; +import edu.wpi.first.math.numbers.N2; +import edu.wpi.first.math.system.LinearSystem; +import edu.wpi.first.math.system.plant.DCMotor; +import edu.wpi.first.math.system.plant.LinearSystemId; +import edu.wpi.first.math.util.Units; import edu.wpi.first.wpilibj.DriverStation; import edu.wpi.first.wpilibj.RobotController; -import edu.wpi.first.wpilibj.geometry.Pose2d; -import edu.wpi.first.wpilibj.geometry.Rotation2d; -import edu.wpi.first.wpilibj.geometry.Transform2d; -import edu.wpi.first.wpilibj.geometry.Translation2d; import edu.wpi.first.wpilibj.simulation.DifferentialDrivetrainSim; import edu.wpi.first.wpilibj.simulation.PWMSim; import edu.wpi.first.wpilibj.smartdashboard.Field2d; import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; -import edu.wpi.first.wpilibj.system.LinearSystem; -import edu.wpi.first.wpilibj.system.plant.DCMotor; -import edu.wpi.first.wpilibj.system.plant.LinearSystemId; -import edu.wpi.first.wpilibj.util.Units; -import edu.wpi.first.wpiutil.math.numbers.N2; import org.photonlib.examples.simaimandrange.Robot; import org.photonvision.SimVisionSystem; import org.photonvision.SimVisionTarget; @@ -44,7 +43,6 @@ import org.photonvision.SimVisionTarget; * real motors/sensors/physics are used instead. */ public class DrivetrainSim { - // Simulated Motor Controllers PWMSim leftLeader = new PWMSim(0); PWMSim rightLeader = new PWMSim(1); @@ -53,7 +51,7 @@ public class DrivetrainSim { // Configure these to match your drivetrain's physical dimensions // and characterization results. LinearSystem drivetrainSystem = - LinearSystemId.identifyDrivetrainSystem(1.98, 0.2, 1.5, 0.3); + LinearSystemId.identifyDrivetrainSystem(1.98, 0.2, 1.5, 0.3, 1.0); DifferentialDrivetrainSim drivetrainSimulator = new DifferentialDrivetrainSim( drivetrainSystem, @@ -114,11 +112,10 @@ public class DrivetrainSim { * physics forward by a single 20ms step. */ public void update() { - double leftMotorCmd = 0; double rightMotorCmd = 0; - if (DriverStation.getInstance().isEnabled() && !RobotController.isBrownedOut()) { + if (DriverStation.isEnabled() && !RobotController.isBrownedOut()) { leftMotorCmd = leftLeader.getSpeed(); rightMotorCmd = rightLeader.getSpeed(); } diff --git a/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/Main.java b/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/Main.java index 6eb052216..2349b4cd4 100644 --- a/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/Main.java +++ b/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/Main.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonlib.examples.simposeest; import edu.wpi.first.wpilibj.RobotBase; diff --git a/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/AutoController.java b/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/AutoController.java index 738b6bbc5..6b9d1aba1 100644 --- a/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/AutoController.java +++ b/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/AutoController.java @@ -14,17 +14,16 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonlib.examples.simposeest.robot; +import edu.wpi.first.math.controller.RamseteController; +import edu.wpi.first.math.geometry.Pose2d; +import edu.wpi.first.math.geometry.Rotation2d; +import edu.wpi.first.math.kinematics.ChassisSpeeds; +import edu.wpi.first.math.trajectory.Trajectory; +import edu.wpi.first.math.trajectory.TrajectoryConfig; +import edu.wpi.first.math.trajectory.TrajectoryGenerator; import edu.wpi.first.wpilibj.Timer; -import edu.wpi.first.wpilibj.controller.RamseteController; -import edu.wpi.first.wpilibj.geometry.Pose2d; -import edu.wpi.first.wpilibj.geometry.Rotation2d; -import edu.wpi.first.wpilibj.kinematics.ChassisSpeeds; -import edu.wpi.first.wpilibj.trajectory.Trajectory; -import edu.wpi.first.wpilibj.trajectory.TrajectoryConfig; -import edu.wpi.first.wpilibj.trajectory.TrajectoryGenerator; import java.util.List; /** @@ -34,7 +33,6 @@ import java.util.List; * thinks it ought to be. */ public class AutoController { - private Trajectory trajectory; private RamseteController ramsete = new RamseteController(); @@ -46,7 +44,6 @@ public class AutoController { Trajectory.State desiredDtState; public AutoController() { - // Change this trajectory if you need the robot to follow different paths. trajectory = TrajectoryGenerator.generateTrajectory( @@ -83,7 +80,6 @@ public class AutoController { * @return The commanded drivetrain motion */ public ChassisSpeeds getCurMotorCmds(Pose2d curEstPose) { - if (isRunning) { double elapsed = timer.get(); desiredDtState = trajectory.sample(elapsed); diff --git a/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/Constants.java b/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/Constants.java index 243862f63..a47ff6a2f 100644 --- a/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/Constants.java +++ b/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/Constants.java @@ -14,14 +14,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonlib.examples.simposeest.robot; -import edu.wpi.first.wpilibj.geometry.Pose2d; -import edu.wpi.first.wpilibj.geometry.Rotation2d; -import edu.wpi.first.wpilibj.geometry.Transform2d; -import edu.wpi.first.wpilibj.geometry.Translation2d; -import edu.wpi.first.wpilibj.util.Units; +import edu.wpi.first.math.geometry.Pose2d; +import edu.wpi.first.math.geometry.Rotation2d; +import edu.wpi.first.math.geometry.Transform2d; +import edu.wpi.first.math.geometry.Translation2d; +import edu.wpi.first.math.util.Units; import org.photonvision.SimVisionTarget; /** @@ -31,7 +30,6 @@ import org.photonvision.SimVisionTarget; * at the field drawings 3) Match with how your vision coprocessor is configured. */ public class Constants { - ////////////////////////////////////////////////////////////////// // Drivetrain Physical ////////////////////////////////////////////////////////////////// diff --git a/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/Drivetrain.java b/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/Drivetrain.java index cbe1d45bd..ce042fe53 100644 --- a/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/Drivetrain.java +++ b/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/Drivetrain.java @@ -14,18 +14,17 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonlib.examples.simposeest.robot; +import edu.wpi.first.math.controller.PIDController; +import edu.wpi.first.math.controller.SimpleMotorFeedforward; +import edu.wpi.first.math.geometry.Pose2d; +import edu.wpi.first.math.kinematics.ChassisSpeeds; +import edu.wpi.first.math.kinematics.DifferentialDriveKinematics; +import edu.wpi.first.math.kinematics.DifferentialDriveWheelSpeeds; import edu.wpi.first.wpilibj.Encoder; -import edu.wpi.first.wpilibj.PWMVictorSPX; -import edu.wpi.first.wpilibj.SpeedControllerGroup; -import edu.wpi.first.wpilibj.controller.PIDController; -import edu.wpi.first.wpilibj.controller.SimpleMotorFeedforward; -import edu.wpi.first.wpilibj.geometry.Pose2d; -import edu.wpi.first.wpilibj.kinematics.ChassisSpeeds; -import edu.wpi.first.wpilibj.kinematics.DifferentialDriveKinematics; -import edu.wpi.first.wpilibj.kinematics.DifferentialDriveWheelSpeeds; +import edu.wpi.first.wpilibj.motorcontrol.MotorControllerGroup; +import edu.wpi.first.wpilibj.motorcontrol.PWMVictorSPX; /** * Implements a controller for the drivetrain. Converts a set of chassis motion commands into motor @@ -33,15 +32,14 @@ import edu.wpi.first.wpilibj.kinematics.DifferentialDriveWheelSpeeds; * speed. */ public class Drivetrain { - // PWM motor controller output definitions PWMVictorSPX leftLeader = new PWMVictorSPX(Constants.kDtLeftLeaderPin); PWMVictorSPX leftFollower = new PWMVictorSPX(Constants.kDtLeftFollowerPin); PWMVictorSPX rightLeader = new PWMVictorSPX(Constants.kDtRightLeaderPin); PWMVictorSPX rightFollower = new PWMVictorSPX(Constants.kDtRightFollowerPin); - SpeedControllerGroup leftGroup = new SpeedControllerGroup(leftLeader, leftFollower); - SpeedControllerGroup rightGroup = new SpeedControllerGroup(rightLeader, rightFollower); + MotorControllerGroup leftGroup = new MotorControllerGroup(leftLeader, leftFollower); + MotorControllerGroup rightGroup = new MotorControllerGroup(rightLeader, rightFollower); // Drivetrain wheel speed sensors // Used both for speed control and pose estimation. diff --git a/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/DrivetrainPoseEstimator.java b/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/DrivetrainPoseEstimator.java index 3b0510ac2..c1bf02169 100644 --- a/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/DrivetrainPoseEstimator.java +++ b/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/DrivetrainPoseEstimator.java @@ -14,21 +14,20 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonlib.examples.simposeest.robot; +import edu.wpi.first.math.Matrix; +import edu.wpi.first.math.VecBuilder; +import edu.wpi.first.math.estimator.DifferentialDrivePoseEstimator; +import edu.wpi.first.math.geometry.Pose2d; +import edu.wpi.first.math.geometry.Transform2d; +import edu.wpi.first.math.kinematics.DifferentialDriveWheelSpeeds; +import edu.wpi.first.math.numbers.N1; +import edu.wpi.first.math.numbers.N3; +import edu.wpi.first.math.numbers.N5; +import edu.wpi.first.math.util.Units; import edu.wpi.first.wpilibj.AnalogGyro; import edu.wpi.first.wpilibj.Timer; -import edu.wpi.first.wpilibj.estimator.DifferentialDrivePoseEstimator; -import edu.wpi.first.wpilibj.geometry.Pose2d; -import edu.wpi.first.wpilibj.geometry.Transform2d; -import edu.wpi.first.wpilibj.kinematics.DifferentialDriveWheelSpeeds; -import edu.wpi.first.wpilibj.util.Units; -import edu.wpi.first.wpiutil.math.Matrix; -import edu.wpi.first.wpiutil.math.VecBuilder; -import edu.wpi.first.wpiutil.math.numbers.N1; -import edu.wpi.first.wpiutil.math.numbers.N3; -import edu.wpi.first.wpiutil.math.numbers.N5; import org.photonvision.PhotonCamera; /** @@ -37,7 +36,6 @@ import org.photonvision.PhotonCamera; * filter. This in turn creates a best-guess at a Pose2d of where our drivetrain is currently at. */ public class DrivetrainPoseEstimator { - // Sensors used as part of the Pose Estimation private final AnalogGyro gyro = new AnalogGyro(Constants.kGyroPin); private PhotonCamera cam = new PhotonCamera(Constants.kCamName); @@ -75,7 +73,6 @@ public class DrivetrainPoseEstimator { */ public void update( DifferentialDriveWheelSpeeds actWheelSpeeds, double leftDist, double rightDist) { - m_poseEstimator.update(gyro.getRotation2d(), actWheelSpeeds, leftDist, rightDist); var res = cam.getLatestResult(); diff --git a/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/OperatorInterface.java b/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/OperatorInterface.java index c2e151cce..1f4441e72 100644 --- a/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/OperatorInterface.java +++ b/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/OperatorInterface.java @@ -14,11 +14,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonlib.examples.simposeest.robot; -import edu.wpi.first.wpilibj.GenericHID; -import edu.wpi.first.wpilibj.SlewRateLimiter; +import edu.wpi.first.math.filter.SlewRateLimiter; import edu.wpi.first.wpilibj.XboxController; public class OperatorInterface { @@ -34,7 +32,7 @@ public class OperatorInterface { public double getFwdRevSpdCmd() { // Get the x speed. We are inverting this because Xbox controllers return // negative values when we push forward. - return -speedLimiter.calculate(opCtrl.getY(GenericHID.Hand.kLeft)) * Constants.kMaxSpeed; + return -speedLimiter.calculate(opCtrl.getLeftY()) * Constants.kMaxSpeed; } public double getRotateSpdCmd() { @@ -42,7 +40,7 @@ public class OperatorInterface { // positive value when we pull to the left (remember, CCW is positive in // mathematics). Xbox controllers return positive values when you pull to // the right by default. - return -rotLimiter.calculate(opCtrl.getX(GenericHID.Hand.kRight)) * Constants.kMaxAngularSpeed; + return -rotLimiter.calculate(opCtrl.getRightX()) * Constants.kMaxAngularSpeed; } public boolean getSimKickCmd() { diff --git a/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/PoseTelemetry.java b/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/PoseTelemetry.java index 02f9192b3..27e61c416 100644 --- a/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/PoseTelemetry.java +++ b/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/PoseTelemetry.java @@ -14,16 +14,14 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonlib.examples.simposeest.robot; -import edu.wpi.first.wpilibj.geometry.Pose2d; +import edu.wpi.first.math.geometry.Pose2d; import edu.wpi.first.wpilibj.smartdashboard.Field2d; import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; /** Reports our expected, desired, and actual poses to dashboards */ public class PoseTelemetry { - Field2d field = new Field2d(); Pose2d actPose = new Pose2d(); diff --git a/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/Robot.java b/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/Robot.java index fa94b5096..3e215c85f 100644 --- a/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/Robot.java +++ b/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/Robot.java @@ -14,16 +14,14 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonlib.examples.simposeest.robot; +import edu.wpi.first.math.geometry.Pose2d; +import edu.wpi.first.math.kinematics.ChassisSpeeds; import edu.wpi.first.wpilibj.TimedRobot; -import edu.wpi.first.wpilibj.geometry.Pose2d; -import edu.wpi.first.wpilibj.kinematics.ChassisSpeeds; import org.photonlib.examples.simposeest.sim.DrivetrainSim; public class Robot extends TimedRobot { - AutoController autoCtrl = new AutoController(); Drivetrain dt = new Drivetrain(); OperatorInterface opInf = new OperatorInterface(); diff --git a/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/sim/DrivetrainSim.java b/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/sim/DrivetrainSim.java index 9a0811e1b..1378a5aa4 100644 --- a/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/sim/DrivetrainSim.java +++ b/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/sim/DrivetrainSim.java @@ -14,23 +14,22 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonlib.examples.simposeest.sim; +import edu.wpi.first.math.geometry.Pose2d; +import edu.wpi.first.math.geometry.Rotation2d; +import edu.wpi.first.math.geometry.Transform2d; +import edu.wpi.first.math.geometry.Translation2d; +import edu.wpi.first.math.numbers.N2; +import edu.wpi.first.math.system.LinearSystem; +import edu.wpi.first.math.system.plant.DCMotor; +import edu.wpi.first.math.system.plant.LinearSystemId; import edu.wpi.first.wpilibj.DriverStation; import edu.wpi.first.wpilibj.RobotController; -import edu.wpi.first.wpilibj.geometry.Pose2d; -import edu.wpi.first.wpilibj.geometry.Rotation2d; -import edu.wpi.first.wpilibj.geometry.Transform2d; -import edu.wpi.first.wpilibj.geometry.Translation2d; import edu.wpi.first.wpilibj.simulation.AnalogGyroSim; import edu.wpi.first.wpilibj.simulation.DifferentialDrivetrainSim; import edu.wpi.first.wpilibj.simulation.EncoderSim; import edu.wpi.first.wpilibj.simulation.PWMSim; -import edu.wpi.first.wpilibj.system.LinearSystem; -import edu.wpi.first.wpilibj.system.plant.DCMotor; -import edu.wpi.first.wpilibj.system.plant.LinearSystemId; -import edu.wpi.first.wpiutil.math.numbers.N2; import org.photonlib.examples.simposeest.robot.Constants; import org.photonvision.SimVisionSystem; @@ -42,7 +41,6 @@ import org.photonvision.SimVisionSystem; * real motors/sensors/physics are used instead. */ public class DrivetrainSim { - // Simulated Sensors AnalogGyroSim gyroSim = new AnalogGyroSim(Constants.kGyroPin); EncoderSim leftEncoderSim = EncoderSim.createForChannel(Constants.kDtLeftEncoderPinA); @@ -100,11 +98,10 @@ public class DrivetrainSim { * physics forward by a single 20ms step. */ public void update() { - double leftMotorCmd = 0; double rightMotorCmd = 0; - if (DriverStation.getInstance().isEnabled() && !RobotController.isBrownedOut()) { + if (DriverStation.isEnabled() && !RobotController.isBrownedOut()) { // If the motor controllers are enabled... // Roughly model the effect of leader and follower motor pushing on the same // gearbox. diff --git a/scripts/install.sh b/scripts/install.sh index df3609203..67dc442d5 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -19,16 +19,16 @@ echo "JDK installation complete." echo "Downloading latest stable release of PhotonVision..." mkdir -p /opt/photonvision cd /opt/photonvision -curl -sk https://api.github.com/repos/photonvision/photonvision/releases/latest | - grep "browser_download_url.*jar" | - cut -d : -f 2,3 | - tr -d '"' | +curl -sk https://api.github.com/repos/photonvision/photonvision/releases/latest | + grep "browser_download_url.*jar" | + cut -d : -f 2,3 | + tr -d '"' | wget -qi - -O photonvision.jar echo "Downloaded latest stable release of PhotonVision." echo "Creating the PhotonVision systemd service..." -if service --status-all | grep -Fq 'photonvision'; then +if service --status-all | grep -Fq 'photonvision'; then systemctl stop photonvision systemctl disable photonvision rm /lib/systemd/system/photonvision.service @@ -50,7 +50,7 @@ ExecStop=/bin/systemctl kill photonvision Type=simple Restart=on-failure RestartSec=1 - + [Install] WantedBy=multi-user.target" >> photonvision.service cp photonvision.service /etc/systemd/system/photonvision.service diff --git a/scripts/uninstall.sh b/scripts/uninstall.sh index 95d63821a..64da17c01 100644 --- a/scripts/uninstall.sh +++ b/scripts/uninstall.sh @@ -11,5 +11,5 @@ systemctl stop photonvision systemctl disable photonvision rm /lib/systemd/system/photonvision.service rm /etc/systemd/system/photonvision.service -systemctl dameon-relaod +systemctl dameon-relaod systemctl reset-failed diff --git a/shared/PhotonVersion.java.in b/shared/PhotonVersion.java.in index 3805b1393..832801b9d 100644 --- a/shared/PhotonVersion.java.in +++ b/shared/PhotonVersion.java.in @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package org.photonvision; /* diff --git a/shared/common.gradle b/shared/common.gradle index bc395c2f9..09a5dfeb1 100644 --- a/shared/common.gradle +++ b/shared/common.gradle @@ -26,27 +26,28 @@ dependencies { implementation "edu.wpi.first.cameraserver:cameraserver-java:$wpilibVersion" implementation "edu.wpi.first.cscore:cscore-java:$wpilibVersion" - compile "edu.wpi.first.cscore:cscore-jni:$wpilibVersion:linuxaarch64bionic" - compile "edu.wpi.first.cscore:cscore-jni:$wpilibVersion:linuxraspbian" - compile "edu.wpi.first.cscore:cscore-jni:$wpilibVersion:linuxx86-64" - compile "edu.wpi.first.cscore:cscore-jni:$wpilibVersion:osxx86-64" - compile "edu.wpi.first.cscore:cscore-jni:$wpilibVersion:windowsx86-64" + implementation "edu.wpi.first.cscore:cscore-jni:$wpilibVersion:linuxaarch64bionic" + implementation "edu.wpi.first.cscore:cscore-jni:$wpilibVersion:linuxraspbian" + implementation "edu.wpi.first.cscore:cscore-jni:$wpilibVersion:linuxx86-64" + implementation "edu.wpi.first.cscore:cscore-jni:$wpilibVersion:osxx86-64" + implementation "edu.wpi.first.cscore:cscore-jni:$wpilibVersion:windowsx86-64" implementation "edu.wpi.first.ntcore:ntcore-java:$wpilibVersion" - compile "edu.wpi.first.ntcore:ntcore-jni:$wpilibVersion:linuxaarch64bionic" - compile "edu.wpi.first.ntcore:ntcore-jni:$wpilibVersion:linuxraspbian" - compile "edu.wpi.first.ntcore:ntcore-jni:$wpilibVersion:linuxx86-64" - compile "edu.wpi.first.ntcore:ntcore-jni:$wpilibVersion:osxx86-64" - compile "edu.wpi.first.ntcore:ntcore-jni:$wpilibVersion:windowsx86-64" + implementation "edu.wpi.first.ntcore:ntcore-jni:$wpilibVersion:linuxaarch64bionic" + implementation "edu.wpi.first.ntcore:ntcore-jni:$wpilibVersion:linuxraspbian" + implementation "edu.wpi.first.ntcore:ntcore-jni:$wpilibVersion:linuxx86-64" + implementation "edu.wpi.first.ntcore:ntcore-jni:$wpilibVersion:osxx86-64" + implementation "edu.wpi.first.ntcore:ntcore-jni:$wpilibVersion:windowsx86-64" - implementation "edu.wpi.first.thirdparty.frc2021.opencv:opencv-java:$opencvVersion" - compile "edu.wpi.first.thirdparty.frc2021.opencv:opencv-jni:$opencvVersion:linuxaarch64bionic" - compile "edu.wpi.first.thirdparty.frc2021.opencv:opencv-jni:$opencvVersion:linuxraspbian" - compile "edu.wpi.first.thirdparty.frc2021.opencv:opencv-jni:$opencvVersion:linuxx86-64" - compile "edu.wpi.first.thirdparty.frc2021.opencv:opencv-jni:$opencvVersion:osxx86-64" - compile "edu.wpi.first.thirdparty.frc2021.opencv:opencv-jni:$opencvVersion:windowsx86-64" + implementation "edu.wpi.first.thirdparty.frc2022.opencv:opencv-java:$opencvVersion" + implementation "edu.wpi.first.thirdparty.frc2022.opencv:opencv-jni:$opencvVersion:linuxaarch64bionic" + implementation "edu.wpi.first.thirdparty.frc2022.opencv:opencv-jni:$opencvVersion:linuxraspbian" + implementation "edu.wpi.first.thirdparty.frc2022.opencv:opencv-jni:$opencvVersion:linuxx86-64" + implementation "edu.wpi.first.thirdparty.frc2022.opencv:opencv-jni:$opencvVersion:osxx86-64" + implementation "edu.wpi.first.thirdparty.frc2022.opencv:opencv-jni:$opencvVersion:windowsx86-64" - implementation "edu.wpi.first.wpimath:wpimath-java:2021.3.1" + implementation "edu.wpi.first.wpimath:wpimath-java:2022.1.1-beta-2" + implementation "org.ejml:ejml-simple:0.41" // test stuff testImplementation("org.junit.jupiter:junit-jupiter:5.6.0") diff --git a/shared/config.gradle b/shared/config.gradle index fbaa647c7..bdf11e74d 100644 --- a/shared/config.gradle +++ b/shared/config.gradle @@ -8,10 +8,10 @@ nativeUtils.withBionic() nativeUtils.wpi.configureDependencies { wpiVersion = wpilibVersion wpimathVersion = wpilibVersion - niLibVersion = "2020.10.1" - opencvVersion = "3.4.7-5" + niLibVersion = "2022.2.2" + opencvVersion = "4.5.2-1" googleTestVersion = "1.9.0-5-437e100-1" - imguiVersion = "1.79-1" + imguiVersion = "1.82-1" } // Configure warnings and errors diff --git a/test-resources/calibration/lifecam240p.json b/test-resources/calibration/lifecam240p.json index 349c450c8..954a1cc45 100644 --- a/test-resources/calibration/lifecam240p.json +++ b/test-resources/calibration/lifecam240p.json @@ -31,4 +31,4 @@ -1.462385758978924 ] } -} \ No newline at end of file +} diff --git a/test-resources/calibration/lifecam480p.json b/test-resources/calibration/lifecam480p.json index fff629bf6..a9a6ae4e4 100644 --- a/test-resources/calibration/lifecam480p.json +++ b/test-resources/calibration/lifecam480p.json @@ -31,4 +31,4 @@ 1.9833437176538498 ] } -} \ No newline at end of file +} diff --git a/test-resources/hardware/HardwareConfig.json b/test-resources/hardware/HardwareConfig.json index f6e92332e..e4cbdc65c 100644 --- a/test-resources/hardware/HardwareConfig.json +++ b/test-resources/hardware/HardwareConfig.json @@ -15,4 +15,4 @@ "ramUtilCommand" : "echo 10", "restartHardwareCommand" : "echo 10", "vendorFOV" : 40.0 -} \ No newline at end of file +} diff --git a/test-resources/testimages/2019/WPI/info.txt b/test-resources/testimages/2019/WPI/info.txt index cc4714e73..e2480914a 100644 --- a/test-resources/testimages/2019/WPI/info.txt +++ b/test-resources/testimages/2019/WPI/info.txt @@ -1,3 +1,3 @@ Taken on Microsoft LifeCam HD-3000 FOV = 68.5 -Credit to WPILib for these images. \ No newline at end of file +Credit to WPILib for these images. diff --git a/test-resources/testimages/2020/WPI/info.txt b/test-resources/testimages/2020/WPI/info.txt index cc4714e73..e2480914a 100644 --- a/test-resources/testimages/2020/WPI/info.txt +++ b/test-resources/testimages/2020/WPI/info.txt @@ -1,3 +1,3 @@ Taken on Microsoft LifeCam HD-3000 FOV = 68.5 -Credit to WPILib for these images. \ No newline at end of file +Credit to WPILib for these images.