diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 15458a4bd6..cf264b70b5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -48,13 +48,13 @@ jobs: fetch-depth: 0 - name: Fetch tags run: git fetch --tags --force - - name: Install RoboRIO Toolchain - run: ./gradlew installRoboRioToolchain - name: Install Java 17 uses: actions/setup-java@v4 with: java-version: 17 distribution: temurin + - name: Install RoboRIO Toolchain + run: ./gradlew installRoboRioToolchain # Need to publish to maven local first, so that C++ sim can pick it up # Still haven't figured out how to make the vendordep file be copied before trying to build examples - name: Publish photonlib to maven local @@ -85,7 +85,7 @@ jobs: - name: Fetch tags run: git fetch --tags --force - name: Install Java 17 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: java-version: 17 distribution: temurin @@ -344,7 +344,7 @@ jobs: - run: | sudo apt-get update sudo apt-get install --yes libcholmod3 liblapack3 libsuitesparseconfig5 - if: ${{ (matrix.os) == 'ubuntu-latest' }} + if: ${{ (matrix.os) == 'ubuntu-22.04' }} # and actually run the jar - run: java -jar ${{ matrix.extraOpts }} *.jar --smoketest if: ${{ (matrix.os) != 'windows-latest' }} @@ -439,7 +439,7 @@ jobs: image_url: https://github.com/PhotonVision/photon-image-modifier/releases/download/v2025.0.0-beta-6/photonvision_opi5pro.img.xz cpu: cortex-a8 image_additional_mb: 1024 - - os: ubuntu-latest + - os: ubuntu-22.04 artifact-name: LinuxArm64 image_suffix: orangepi5max image_url: https://github.com/PhotonVision/photon-image-modifier/releases/download/v2025.0.0-beta-6/photonvision_opi5max.img.xz diff --git a/.github/workflows/lint-format.yml b/.github/workflows/lint-format.yml index 09f86fc6c6..2f41edf5ae 100644 --- a/.github/workflows/lint-format.yml +++ b/.github/workflows/lint-format.yml @@ -57,7 +57,7 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 - - uses: actions/setup-java@v3 + - uses: actions/setup-java@v4 with: java-version: 17 distribution: temurin diff --git a/.github/workflows/photon-code-docs.yml b/.github/workflows/photon-code-docs.yml index 0eb7c50664..a8bb9f69fd 100644 --- a/.github/workflows/photon-code-docs.yml +++ b/.github/workflows/photon-code-docs.yml @@ -59,7 +59,7 @@ jobs: - name: Fetch tags run: git fetch --tags --force - name: Install Java 17 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: java-version: 17 distribution: temurin diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 525824cfdb..cfe5af2c34 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -21,7 +21,7 @@ on: jobs: buildAndDeploy: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Checkout code diff --git a/build.gradle b/build.gradle index 956ac0de57..18c80de121 100644 --- a/build.gradle +++ b/build.gradle @@ -5,9 +5,9 @@ plugins { id "cpp" id "com.diffplug.spotless" version "6.24.0" id "edu.wpi.first.wpilib.repositories.WPILibRepositoriesPlugin" version "2020.2" - id "edu.wpi.first.GradleRIO" version "2024.3.2" + id "edu.wpi.first.GradleRIO" version "2025.1.1-beta-1" id 'edu.wpi.first.WpilibTools' version '1.3.0' - id 'com.google.protobuf' version '0.9.4' apply false + id 'com.google.protobuf' version '0.9.3' apply false id 'edu.wpi.first.GradleJni' version '1.1.0' } @@ -30,14 +30,15 @@ ext.allOutputsFolder = file("$project.buildDir/outputs") apply from: "versioningHelper.gradle" ext { - wpilibVersion = "2024.3.2" + wpilibVersion = "2025.1.1-beta-1" wpimathVersion = wpilibVersion - openCVversion = "4.8.0-2" + openCVYear = "2024" + openCVversion = "4.8.0-4" joglVersion = "2.4.0" javalinVersion = "5.6.2" libcameraDriverVersion = "dev-v2023.1.0-14-g787ab59" rknnVersion = "dev-v2024.0.1-4-g0db16ac" - frcYear = "2024" + frcYear = "2025" mrcalVersion = "dev-v2024.0.0-24-gc1efcf0"; diff --git a/photon-client/src/components/settings/NetworkingCard.vue b/photon-client/src/components/settings/NetworkingCard.vue index e3b80e2d99..c957116773 100644 --- a/photon-client/src/components/settings/NetworkingCard.vue +++ b/photon-client/src/components/settings/NetworkingCard.vue @@ -17,10 +17,10 @@ const resetTempSettingsStruct = () => { const settingsValid = ref(true); const isValidNetworkTablesIP = (v: string | undefined): boolean => { - // Check if it is a valid team number between 1-9999 - const teamNumberRegex = /^[1-9][0-9]{0,3}$/; + // Check if it is a valid team number between 1-99999 (5 digits) + const teamNumberRegex = /^[1-9][0-9]{0,4}$/; // Check if it is a team number longer than 5 digits - const badTeamNumberRegex = /^[0-9]{5,}$/; + const badTeamNumberRegex = /^[0-9]{6,}$/; if (v === undefined) return false; if (teamNumberRegex.test(v)) return true; diff --git a/photon-core/build.gradle b/photon-core/build.gradle index a63354dcb6..ee9ea91605 100644 --- a/photon-core/build.gradle +++ b/photon-core/build.gradle @@ -24,7 +24,7 @@ nativeConfig.dependencies.add wpilibTools.deps.wpilib("ntcore") nativeConfig.dependencies.add wpilibTools.deps.wpilib("cscore") nativeConfig.dependencies.add wpilibTools.deps.wpilib("apriltag") nativeConfig.dependencies.add wpilibTools.deps.wpilib("hal") -nativeConfig.dependencies.add wpilibTools.deps.wpilibOpenCv("frc" + wpi.frcYear.get(), wpi.versions.opencvVersion.get()) +nativeConfig.dependencies.add wpilibTools.deps.wpilibOpenCv("frc" + openCVYear, wpi.versions.opencvVersion.get()) dependencies { // JOGL stuff (currently we only distribute for aarch64, which is Pi 4) 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 08dfa88926..218bd50dc2 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 @@ -19,11 +19,17 @@ import com.fasterxml.jackson.databind.ObjectMapper; import edu.wpi.first.apriltag.jni.AprilTagJNI; -import edu.wpi.first.cscore.CameraServerCvJNI; import edu.wpi.first.cscore.CameraServerJNI; +import edu.wpi.first.cscore.OpenCvLoader; import edu.wpi.first.hal.JNIWrapper; -import edu.wpi.first.math.WPIMathJNI; import edu.wpi.first.math.geometry.Translation2d; +import edu.wpi.first.math.jni.ArmFeedforwardJNI; +import edu.wpi.first.math.jni.DAREJNI; +import edu.wpi.first.math.jni.EigenJNI; +import edu.wpi.first.math.jni.Ellipse2dJNI; +import edu.wpi.first.math.jni.Pose3dJNI; +import edu.wpi.first.math.jni.StateSpaceUtilJNI; +import edu.wpi.first.math.jni.TrajectoryUtilJNI; import edu.wpi.first.math.util.Units; import edu.wpi.first.net.WPINetJNI; import edu.wpi.first.networktables.NetworkTablesJNI; @@ -46,23 +52,21 @@ public static boolean loadLibraries() { NetworkTablesJNI.Helper.setExtractOnStaticLoad(false); WPIUtilJNI.Helper.setExtractOnStaticLoad(false); - WPIMathJNI.Helper.setExtractOnStaticLoad(false); CameraServerJNI.Helper.setExtractOnStaticLoad(false); - CameraServerCvJNI.Helper.setExtractOnStaticLoad(false); - // OpenCvLoader.Helper.setExtractOnStaticLoad(false); + OpenCvLoader.Helper.setExtractOnStaticLoad(false); JNIWrapper.Helper.setExtractOnStaticLoad(false); WPINetJNI.Helper.setExtractOnStaticLoad(false); AprilTagJNI.Helper.setExtractOnStaticLoad(false); // wpimathjni is a bit odd, it's all in the wpimathjni shared lib, but the java side stuff has // been split. - // ArmFeedforwardJNI.Helper.setExtractOnStaticLoad(false); - // DAREJNI.Helper.setExtractOnStaticLoad(false); - // EigenJNI.Helper.setExtractOnStaticLoad(false); - // Ellipse2dJNI.Helper.setExtractOnStaticLoad(false); - // Pose3dJNI.Helper.setExtractOnStaticLoad(false); - // StateSpaceUtilJNI.Helper.setExtractOnStaticLoad(false); - // TrajectoryUtilJNI.Helper.setExtractOnStaticLoad(false); + ArmFeedforwardJNI.Helper.setExtractOnStaticLoad(false); + DAREJNI.Helper.setExtractOnStaticLoad(false); + EigenJNI.Helper.setExtractOnStaticLoad(false); + Ellipse2dJNI.Helper.setExtractOnStaticLoad(false); + Pose3dJNI.Helper.setExtractOnStaticLoad(false); + StateSpaceUtilJNI.Helper.setExtractOnStaticLoad(false); + TrajectoryUtilJNI.Helper.setExtractOnStaticLoad(false); try { CombinedRuntimeLoader.loadLibraries( @@ -72,10 +76,11 @@ public static boolean loadLibraries() { "ntcorejni", "wpinetjni", "wpiHaljni", - Core.NATIVE_LIBRARY_NAME, "cscorejni", "apriltagjni"); + CombinedRuntimeLoader.loadLibraries(TestUtils.class, Core.NATIVE_LIBRARY_NAME); + has_loaded = true; } catch (IOException e) { e.printStackTrace(); diff --git a/photon-lib/build.gradle b/photon-lib/build.gradle index 6b9d1f04e3..6b0a3c228b 100644 --- a/photon-lib/build.gradle +++ b/photon-lib/build.gradle @@ -338,4 +338,4 @@ nativeConfig.dependencies.add wpilibTools.deps.wpilib("ntcore") nativeConfig.dependencies.add wpilibTools.deps.wpilib("cscore") nativeConfig.dependencies.add wpilibTools.deps.wpilib("apriltag") nativeConfig.dependencies.add wpilibTools.deps.wpilib("hal") -nativeConfig.dependencies.add wpilibTools.deps.wpilibOpenCv("frc" + wpi.frcYear.get(), wpi.versions.opencvVersion.get()) +nativeConfig.dependencies.add wpilibTools.deps.wpilibOpenCv("frc" + openCVYear, wpi.versions.opencvVersion.get()) diff --git a/photon-lib/src/test/java/org/photonvision/OpenCVTest.java b/photon-lib/src/test/java/org/photonvision/OpenCVTest.java index 84549545ea..cb55175a2f 100644 --- a/photon-lib/src/test/java/org/photonvision/OpenCVTest.java +++ b/photon-lib/src/test/java/org/photonvision/OpenCVTest.java @@ -26,7 +26,6 @@ import static org.junit.jupiter.api.Assertions.*; -import edu.wpi.first.cscore.CameraServerCvJNI; import edu.wpi.first.math.MathUtil; import edu.wpi.first.math.geometry.Pose3d; import edu.wpi.first.math.geometry.Rotation2d; @@ -34,10 +33,12 @@ import edu.wpi.first.math.geometry.Transform3d; import edu.wpi.first.math.geometry.Translation3d; import edu.wpi.first.networktables.NetworkTableInstance; +import edu.wpi.first.util.CombinedRuntimeLoader; import java.io.IOException; import java.util.List; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import org.opencv.core.Core; import org.photonvision.estimation.CameraTargetRelation; import org.photonvision.estimation.OpenCVHelp; import org.photonvision.estimation.RotTrlTransform3d; @@ -77,7 +78,7 @@ public static void assertSame(Transform3d trf1, Transform3d trf2) { @BeforeAll public static void setUp() throws IOException { - CameraServerCvJNI.forceLoad(); + CombinedRuntimeLoader.loadLibraries(OpenCVTest.class, Core.NATIVE_LIBRARY_NAME); // NT live for debug purposes NetworkTableInstance.getDefault().startServer(); diff --git a/photon-targeting/src/main/java/org/photonvision/targeting/proto/MultiTargetPNPResultProto.java b/photon-targeting/src/main/java/org/photonvision/targeting/proto/MultiTargetPNPResultProto.java index 2bca9c78b1..934dccc987 100644 --- a/photon-targeting/src/main/java/org/photonvision/targeting/proto/MultiTargetPNPResultProto.java +++ b/photon-targeting/src/main/java/org/photonvision/targeting/proto/MultiTargetPNPResultProto.java @@ -37,11 +37,6 @@ public Descriptor getDescriptor() { return ProtobufMultiTargetPNPResult.getDescriptor(); } - @Override - public Protobuf[] getNested() { - return new Protobuf[] {PnpResult.proto}; - } - @Override public ProtobufMultiTargetPNPResult createMessage() { return ProtobufMultiTargetPNPResult.newInstance(); diff --git a/photon-targeting/src/main/java/org/photonvision/targeting/proto/PNPResultProto.java b/photon-targeting/src/main/java/org/photonvision/targeting/proto/PNPResultProto.java index a1bc986160..9bb7022d45 100644 --- a/photon-targeting/src/main/java/org/photonvision/targeting/proto/PNPResultProto.java +++ b/photon-targeting/src/main/java/org/photonvision/targeting/proto/PNPResultProto.java @@ -34,11 +34,6 @@ public Descriptor getDescriptor() { return ProtobufPNPResult.getDescriptor(); } - @Override - public Protobuf[] getNested() { - return new Protobuf[] {Transform3d.proto}; - } - @Override public ProtobufPNPResult createMessage() { return ProtobufPNPResult.newInstance(); diff --git a/photon-targeting/src/main/java/org/photonvision/targeting/proto/PhotonPipelineResultProto.java b/photon-targeting/src/main/java/org/photonvision/targeting/proto/PhotonPipelineResultProto.java index 82a14bc69d..0451aad723 100644 --- a/photon-targeting/src/main/java/org/photonvision/targeting/proto/PhotonPipelineResultProto.java +++ b/photon-targeting/src/main/java/org/photonvision/targeting/proto/PhotonPipelineResultProto.java @@ -37,11 +37,6 @@ public Descriptor getDescriptor() { return ProtobufPhotonPipelineResult.getDescriptor(); } - @Override - public Protobuf[] getNested() { - return new Protobuf[] {PhotonTrackedTarget.proto, MultiTargetPNPResult.proto}; - } - @Override public ProtobufPhotonPipelineResult createMessage() { return ProtobufPhotonPipelineResult.newInstance(); diff --git a/photon-targeting/src/main/java/org/photonvision/targeting/proto/PhotonTrackedTargetProto.java b/photon-targeting/src/main/java/org/photonvision/targeting/proto/PhotonTrackedTargetProto.java index 8eb24ef6b6..8bc68ad326 100644 --- a/photon-targeting/src/main/java/org/photonvision/targeting/proto/PhotonTrackedTargetProto.java +++ b/photon-targeting/src/main/java/org/photonvision/targeting/proto/PhotonTrackedTargetProto.java @@ -39,11 +39,6 @@ public Descriptor getDescriptor() { return ProtobufPhotonTrackedTarget.getDescriptor(); } - @Override - public Protobuf[] getNested() { - return new Protobuf[] {Transform3d.proto, TargetCorner.proto}; - } - @Override public ProtobufPhotonTrackedTarget createMessage() { return ProtobufPhotonTrackedTarget.newInstance(); diff --git a/photon-targeting/src/main/native/cpp/photon/targeting/proto/MultiTargetPNPResultProto.cpp b/photon-targeting/src/main/native/cpp/photon/targeting/proto/MultiTargetPNPResultProto.cpp deleted file mode 100644 index cc67ec213f..0000000000 --- a/photon-targeting/src/main/native/cpp/photon/targeting/proto/MultiTargetPNPResultProto.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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 "photon/targeting/proto/MultiTargetPNPResultProto.h" - -#include - -#include "photon.pb.h" -#include "photon/targeting/proto/PNPResultProto.h" - -google::protobuf::Message* wpi::Protobuf::New( - google::protobuf::Arena* arena) { - return google::protobuf::Arena::CreateMessage< - photonvision::proto::ProtobufMultiTargetPNPResult>(arena); -} - -photon::MultiTargetPNPResult -wpi::Protobuf::Unpack( - const google::protobuf::Message& msg) { - auto m = - static_cast( - &msg); - - std::vector fiducialIdsUsed; - fiducialIdsUsed.reserve(32); - - for (int i = 0; i < m->fiducial_ids_used_size(); i++) { - fiducialIdsUsed.push_back(m->fiducial_ids_used(i)); - } - - return photon::MultiTargetPNPResult{photon::MultiTargetPNPResult_PhotonStruct{ - wpi::UnpackProtobuf(m->estimated_pose()), - fiducialIdsUsed}}; -} - -void wpi::Protobuf::Pack( - google::protobuf::Message* msg, const photon::MultiTargetPNPResult& value) { - auto m = static_cast(msg); - - wpi::PackProtobuf(m->mutable_estimated_pose(), value.estimatedPose); - - m->clear_fiducial_ids_used(); - for (const auto& t : value.fiducialIDsUsed) { - m->add_fiducial_ids_used(t); - } -} diff --git a/photon-targeting/src/main/native/cpp/photon/targeting/proto/PNPResultProto.cpp b/photon-targeting/src/main/native/cpp/photon/targeting/proto/PNPResultProto.cpp deleted file mode 100644 index e91f3ba982..0000000000 --- a/photon-targeting/src/main/native/cpp/photon/targeting/proto/PNPResultProto.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 "photon/targeting/proto/PNPResultProto.h" - -#include "photon.pb.h" - -google::protobuf::Message* wpi::Protobuf::New( - google::protobuf::Arena* arena) { - return google::protobuf::Arena::CreateMessage< - photonvision::proto::ProtobufPNPResult>(arena); -} - -photon::PnpResult wpi::Protobuf::Unpack( - const google::protobuf::Message& msg) { - auto m = static_cast(&msg); - - return photon::PnpResult{photon::PnpResult_PhotonStruct{ - wpi::UnpackProtobuf(m->best()), - wpi::UnpackProtobuf(m->alt()), m->best_reproj_err(), - m->alt_reproj_err(), m->ambiguity()}}; -} - -void wpi::Protobuf::Pack(google::protobuf::Message* msg, - const photon::PnpResult& value) { - auto m = static_cast(msg); - - // m->set_is_present(value.isPresent); - wpi::PackProtobuf(m->mutable_best(), value.best); - m->set_best_reproj_err(value.bestReprojErr); - wpi::PackProtobuf(m->mutable_alt(), value.alt); - m->set_alt_reproj_err(value.altReprojErr); - m->set_ambiguity(value.ambiguity); -} diff --git a/photon-targeting/src/main/native/cpp/photon/targeting/proto/PhotonPipelineResultProto.cpp b/photon-targeting/src/main/native/cpp/photon/targeting/proto/PhotonPipelineResultProto.cpp deleted file mode 100644 index 84385355ee..0000000000 --- a/photon-targeting/src/main/native/cpp/photon/targeting/proto/PhotonPipelineResultProto.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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 "photon/targeting/proto/PhotonPipelineResultProto.h" - -#include - -#include "photon.pb.h" -#include "photon/targeting/proto/MultiTargetPNPResultProto.h" -#include "photon/targeting/proto/PhotonTrackedTargetProto.h" - -google::protobuf::Message* wpi::Protobuf::New( - google::protobuf::Arena* arena) { - return google::protobuf::Arena::CreateMessage< - photonvision::proto::ProtobufPhotonPipelineResult>(arena); -} - -photon::PhotonPipelineResult -wpi::Protobuf::Unpack( - const google::protobuf::Message& msg) { - auto m = - static_cast( - &msg); - - std::vector targets; - targets.reserve(m->targets_size()); - for (const auto& t : m->targets()) { - targets.emplace_back(wpi::UnpackProtobuf(t)); - } - - return photon::PhotonPipelineResult{photon::PhotonPipelineResult_PhotonStruct{ - photon::PhotonPipelineMetadata{ - photon::PhotonPipelineMetadata_PhotonStruct{ - m->sequence_id(), - m->capture_timestamp_micros(), - m->nt_publish_timestamp_micros(), - }}, - targets, - // TODO need to pull this into an optional - m->has_multi_target_result() - ? std::optional{wpi::UnpackProtobuf< - photon::MultiTargetPNPResult>(m->multi_target_result())} - : std::nullopt, - }}; -} - -void wpi::Protobuf::Pack( - google::protobuf::Message* msg, const photon::PhotonPipelineResult& value) { - auto m = static_cast(msg); - - m->set_sequence_id(value.metadata.sequenceID); - m->set_capture_timestamp_micros(value.metadata.captureTimestampMicros); - m->set_nt_publish_timestamp_micros(value.metadata.publishTimestampMicros); - - m->clear_targets(); - for (const auto& t : value.GetTargets()) { - wpi::PackProtobuf(m->add_targets(), t); - } - - // TODO this is dumb and bad - if (value.multitagResult) { - wpi::PackProtobuf(m->mutable_multi_target_result(), *value.multitagResult); - } else { - m->clear_multi_target_result(); - } -} diff --git a/photon-targeting/src/main/native/cpp/photon/targeting/proto/PhotonTrackedTargetProto.cpp b/photon-targeting/src/main/native/cpp/photon/targeting/proto/PhotonTrackedTargetProto.cpp deleted file mode 100644 index 8c3a20eab1..0000000000 --- a/photon-targeting/src/main/native/cpp/photon/targeting/proto/PhotonTrackedTargetProto.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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 "photon/targeting/proto/PhotonTrackedTargetProto.h" - -#include -#include - -#include "photon.pb.h" - -using photon::TargetCorner; -using photon::TargetCorner_PhotonStruct; - -google::protobuf::Message* wpi::Protobuf::New( - google::protobuf::Arena* arena) { - return google::protobuf::Arena::CreateMessage< - photonvision::proto::ProtobufPhotonTrackedTarget>(arena); -} - -photon::PhotonTrackedTarget wpi::Protobuf::Unpack( - const google::protobuf::Message& msg) { - auto m = static_cast( - &msg); - - std::vector minAreaRectCorners; - minAreaRectCorners.reserve(4); - for (const auto& t : m->min_area_rect_corners()) { - minAreaRectCorners.emplace_back( - TargetCorner{TargetCorner_PhotonStruct{t.x(), t.y()}}); - } - - std::vector detectedCorners; - detectedCorners.reserve(m->detected_corners_size()); - for (const auto& t : m->detected_corners()) { - minAreaRectCorners.emplace_back( - TargetCorner{TargetCorner_PhotonStruct{t.x(), t.y()}}); - } - - return photon::PhotonTrackedTarget{photon::PhotonTrackedTarget_PhotonStruct{ - m->yaw(), m->pitch(), m->area(), m->skew(), m->fiducial_id(), - m->obj_detection_id(), m->obj_detection_conf(), - wpi::UnpackProtobuf(m->best_camera_to_target()), - wpi::UnpackProtobuf(m->alt_camera_to_target()), - m->pose_ambiguity(), minAreaRectCorners, detectedCorners}}; -} - -void wpi::Protobuf::Pack( - google::protobuf::Message* msg, const photon::PhotonTrackedTarget& value) { - auto m = static_cast(msg); - - m->set_yaw(value.yaw); - m->set_pitch(value.pitch); - m->set_area(value.area); - m->set_skew(value.skew); - m->set_fiducial_id(value.fiducialId); - m->set_obj_detection_id(value.objDetectId); - m->set_obj_detection_conf(value.objDetectConf); - wpi::PackProtobuf(m->mutable_best_camera_to_target(), - value.bestCameraToTarget); - wpi::PackProtobuf(m->mutable_alt_camera_to_target(), value.altCameraToTarget); - m->set_pose_ambiguity(value.poseAmbiguity); - - m->clear_min_area_rect_corners(); - for (const auto& t : value.GetMinAreaRectCorners()) { - auto* corner = m->add_min_area_rect_corners(); - corner->set_x(t.x); - corner->set_y(t.y); - } - - m->clear_detected_corners(); - for (const auto& t : value.GetDetectedCorners()) { - auto* corner = m->add_detected_corners(); - corner->set_x(t.x); - corner->set_y(t.y); - } -} diff --git a/photon-targeting/src/main/native/include/photon/targeting/proto/MultiTargetPNPResultProto.h b/photon-targeting/src/main/native/include/photon/targeting/proto/MultiTargetPNPResultProto.h deleted file mode 100644 index 8d62863005..0000000000 --- a/photon-targeting/src/main/native/include/photon/targeting/proto/MultiTargetPNPResultProto.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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 . - */ - -#pragma once - -#include - -#include "photon/targeting/MultiTargetPNPResult.h" - -template <> -struct wpi::Protobuf { - static google::protobuf::Message* New(google::protobuf::Arena* arena); - static photon::MultiTargetPNPResult Unpack( - const google::protobuf::Message& msg); - static void Pack(google::protobuf::Message* msg, - const photon::MultiTargetPNPResult& value); -}; diff --git a/photon-targeting/src/main/native/include/photon/targeting/proto/PNPResultProto.h b/photon-targeting/src/main/native/include/photon/targeting/proto/PNPResultProto.h deleted file mode 100644 index 04dc08aea9..0000000000 --- a/photon-targeting/src/main/native/include/photon/targeting/proto/PNPResultProto.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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 . - */ - -#pragma once - -#include - -#include "photon/targeting/PnpResult.h" - -template <> -struct wpi::Protobuf { - static google::protobuf::Message* New(google::protobuf::Arena* arena); - static photon::PnpResult Unpack(const google::protobuf::Message& msg); - static void Pack(google::protobuf::Message* msg, - const photon::PnpResult& value); -}; diff --git a/photon-targeting/src/main/native/include/photon/targeting/proto/PhotonPipelineResultProto.h b/photon-targeting/src/main/native/include/photon/targeting/proto/PhotonPipelineResultProto.h deleted file mode 100644 index 72434fa136..0000000000 --- a/photon-targeting/src/main/native/include/photon/targeting/proto/PhotonPipelineResultProto.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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 . - */ - -#pragma once - -#include - -#include "photon/targeting/PhotonPipelineResult.h" - -template <> -struct wpi::Protobuf { - static google::protobuf::Message* New(google::protobuf::Arena* arena); - static photon::PhotonPipelineResult Unpack( - const google::protobuf::Message& msg); - static void Pack(google::protobuf::Message* msg, - const photon::PhotonPipelineResult& value); -}; diff --git a/photon-targeting/src/main/native/include/photon/targeting/proto/PhotonTrackedTargetProto.h b/photon-targeting/src/main/native/include/photon/targeting/proto/PhotonTrackedTargetProto.h deleted file mode 100644 index 030ab0e030..0000000000 --- a/photon-targeting/src/main/native/include/photon/targeting/proto/PhotonTrackedTargetProto.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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 . - */ - -#pragma once - -#include - -#include "photon/targeting/PhotonTrackedTarget.h" - -template <> -struct wpi::Protobuf { - static google::protobuf::Message* New(google::protobuf::Arena* arena); - static photon::PhotonTrackedTarget Unpack( - const google::protobuf::Message& msg); - static void Pack(google::protobuf::Message* msg, - const photon::PhotonTrackedTarget& value); -}; diff --git a/photon-targeting/src/test/native/cpp/targeting/proto/MultiTargetPNPResultProtoTest.cpp b/photon-targeting/src/test/native/cpp/targeting/proto/MultiTargetPNPResultProtoTest.cpp deleted file mode 100644 index e94b762b9d..0000000000 --- a/photon-targeting/src/test/native/cpp/targeting/proto/MultiTargetPNPResultProtoTest.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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 "gtest/gtest.h" -#include "photon.pb.h" -#include "photon/targeting/MultiTargetPNPResult.h" -#include "photon/targeting/proto/MultiTargetPNPResultProto.h" - -// TEST(MultiTargetPNPResultTest, Roundtrip) { -// photon::MultiTargetPNPResult result; - -// google::protobuf::Arena arena; -// google::protobuf::Message* proto = -// wpi::Protobuf::New(&arena); -// wpi::Protobuf::Pack(proto, result); - -// photon::MultiTargetPNPResult unpacked_data = -// wpi::Protobuf::Unpack(*proto); - -// EXPECT_EQ(result, unpacked_data); - -// photon::PnpResult pnpRes{ -// true, -// frc::Transform3d(frc::Translation3d(1_m, 2_m, 3_m), -// frc::Rotation3d(1_rad, 2_rad, 3_rad)), -// 0.1, -// frc::Transform3d(frc::Translation3d(1_m, 2_m, 3_m), -// frc::Rotation3d(1_rad, 2_rad, 3_rad)), -// 0.1, -// 0}; - -// photon::MultiTargetPNPResult result1{pnpRes, {1, 2, 3, 4}}; - -// proto = wpi::Protobuf::New(&arena); -// wpi::Protobuf::Pack(proto, result1); - -// photon::MultiTargetPNPResult unpacked_data1 = -// wpi::Protobuf::Unpack(*proto); - -// EXPECT_EQ(result1, unpacked_data1); -// } diff --git a/photon-targeting/src/test/native/cpp/targeting/proto/PNPResultProtoTest.cpp b/photon-targeting/src/test/native/cpp/targeting/proto/PNPResultProtoTest.cpp deleted file mode 100644 index ee907e2664..0000000000 --- a/photon-targeting/src/test/native/cpp/targeting/proto/PNPResultProtoTest.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 "gtest/gtest.h" -#include "photon.pb.h" -#include "photon/targeting/PnpResult.h" -#include "photon/targeting/proto/PNPResultProto.h" - -// TEST(PnpResultTest, Roundtrip) { -// photon::PnpResult result; - -// google::protobuf::Arena arena; -// google::protobuf::Message* proto = -// wpi::Protobuf::New(&arena); -// wpi::Protobuf::Pack(proto, result); - -// photon::PnpResult unpacked_data = -// wpi::Protobuf::Unpack(*proto); - -// EXPECT_EQ(result, unpacked_data); - -// photon::PnpResult result1{ -// true, -// frc::Transform3d(frc::Translation3d(1_m, 2_m, 3_m), -// frc::Rotation3d(1_rad, 2_rad, 3_rad)), -// 0.1, -// frc::Transform3d(frc::Translation3d(1_m, 2_m, 3_m), -// frc::Rotation3d(1_rad, 2_rad, 3_rad)), -// 0.1, -// 0}; - -// proto = wpi::Protobuf::New(&arena); -// wpi::Protobuf::Pack(proto, result1); - -// photon::PnpResult unpacked_data2 = -// wpi::Protobuf::Unpack(*proto); - -// EXPECT_EQ(result1, unpacked_data2); -// } diff --git a/photon-targeting/src/test/native/cpp/targeting/proto/PhotonPipelineResultProtoTest.cpp b/photon-targeting/src/test/native/cpp/targeting/proto/PhotonPipelineResultProtoTest.cpp deleted file mode 100644 index 2e2b6ffe35..0000000000 --- a/photon-targeting/src/test/native/cpp/targeting/proto/PhotonPipelineResultProtoTest.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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 "gtest/gtest.h" -#include "photon.pb.h" -#include "photon/targeting/PhotonPipelineResult.h" -#include "photon/targeting/proto/PhotonPipelineResultProto.h" - -// TEST(PhotonPipelineResultTest, Roundtrip) { -// photon::PhotonPipelineResult result{0, 0_s, 12_ms, {}}; - -// google::protobuf::Arena arena; -// google::protobuf::Message* proto = -// wpi::Protobuf::New(&arena); -// wpi::Protobuf::Pack(proto, result); - -// photon::PhotonPipelineResult unpacked_data = -// wpi::Protobuf::Unpack(*proto); - -// EXPECT_EQ(result, unpacked_data); - -// wpi::SmallVector targets{ -// photon::PhotonTrackedTarget{ -// 3.0, -// -4.0, -// 9.0, -// 4.0, -// 1, -// -1, -// -1.0, -// frc::Transform3d(frc::Translation3d(1_m, 2_m, 3_m), -// frc::Rotation3d(1_rad, 2_rad, 3_rad)), -// frc::Transform3d(frc::Translation3d(1_m, 2_m, 3_m), -// frc::Rotation3d(1_rad, 2_rad, 3_rad)), -// -1, -// {std::pair{1, 2}, std::pair{3, 4}, std::pair{5, 6}, std::pair{7, -// 8}}, {std::pair{1, 2}, std::pair{3, 4}, std::pair{5, 6}, -// std::pair{7, 8}}}, -// photon::PhotonTrackedTarget{ -// 3.0, -// -4.0, -// 9.1, -// 6.7, -// -1, -// -1, -// -1.0, -// frc::Transform3d(frc::Translation3d(1_m, 2_m, 3_m), -// frc::Rotation3d(1_rad, 2_rad, 3_rad)), -// frc::Transform3d(frc::Translation3d(1_m, 2_m, 3_m), -// frc::Rotation3d(1_rad, 2_rad, 3_rad)), -// -1, -// {std::pair{1, 2}, std::pair{3, 4}, std::pair{5, 6}, std::pair{7, -// 8}}, {std::pair{1, 2}, std::pair{3, 4}, std::pair{5, 6}, -// std::pair{7, 8}}}}; - -// photon::PhotonPipelineResult result2{0, 0_s, 12_ms, targets}; - -// proto = wpi::Protobuf::New(&arena); -// wpi::Protobuf::Pack(proto, result2); - -// photon::PhotonPipelineResult unpacked_data2 = -// wpi::Protobuf::Unpack(*proto); - -// EXPECT_EQ(result2, unpacked_data2); - -// photon::PnpResult pnpRes{ -// true, -// frc::Transform3d(frc::Translation3d(1_m, 2_m, 3_m), -// frc::Rotation3d(1_rad, 2_rad, 3_rad)), -// 0.1, -// frc::Transform3d(frc::Translation3d(1_m, 2_m, 3_m), -// frc::Rotation3d(1_rad, 2_rad, 3_rad)), -// 0.1, -// 0}; - -// photon::MultiTargetPNPResult multitagRes{pnpRes, {1, 2, 3, 4}}; - -// photon::PhotonPipelineResult result3{0, 0_s, 12_ms, targets, multitagRes}; - -// proto = wpi::Protobuf::New(&arena); -// wpi::Protobuf::Pack(proto, result3); - -// photon::PhotonPipelineResult unpacked_data3 = -// wpi::Protobuf::Unpack(*proto); - -// EXPECT_EQ(result3, unpacked_data3); -// } diff --git a/photon-targeting/src/test/native/cpp/targeting/proto/PhotonTrackedTargetProtoTest.cpp b/photon-targeting/src/test/native/cpp/targeting/proto/PhotonTrackedTargetProtoTest.cpp deleted file mode 100644 index 50e350d219..0000000000 --- a/photon-targeting/src/test/native/cpp/targeting/proto/PhotonTrackedTargetProtoTest.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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 "gtest/gtest.h" -#include "photon.pb.h" -#include "photon/targeting/PhotonTrackedTarget.h" -#include "photon/targeting/proto/PhotonTrackedTargetProto.h" - -// TEST(PhotonTrackedTargetTest, Roundtrip) { -// photon::PhotonTrackedTarget target{ -// 3.0, -// 4.0, -// 9.0, -// -5.0, -// -1, -// -1, -// -1.0, -// frc::Transform3d(frc::Translation3d(1_m, 2_m, 3_m), -// frc::Rotation3d(1_rad, 2_rad, 3_rad)), -// frc::Transform3d(frc::Translation3d(1_m, 2_m, 3_m), -// frc::Rotation3d(1_rad, 2_rad, 3_rad)), -// -1, -// {std::pair{1, 2}, std::pair{3, 4}, std::pair{5, 6}, std::pair{7, 8}}, -// {std::pair{1, 2}, std::pair{3, 4}, std::pair{5, 6}, std::pair{7, 8}}}; - -// google::protobuf::Arena arena; -// google::protobuf::Message* proto = -// wpi::Protobuf::New(&arena); -// wpi::Protobuf::Pack(proto, target); - -// photon::PhotonTrackedTarget unpacked_data = -// wpi::Protobuf::Unpack(*proto); - -// EXPECT_EQ(target, unpacked_data); -// } diff --git a/photonlib-cpp-examples/aimandrange/.wpilib/wpilib_preferences.json b/photonlib-cpp-examples/aimandrange/.wpilib/wpilib_preferences.json index 36bf1b5d2f..cc94c138cc 100644 --- a/photonlib-cpp-examples/aimandrange/.wpilib/wpilib_preferences.json +++ b/photonlib-cpp-examples/aimandrange/.wpilib/wpilib_preferences.json @@ -1,6 +1,6 @@ { "enableCppIntellisense": true, "currentLanguage": "cpp", - "projectYear": "2024", + "projectYear": "2025", "teamNumber": 5 } diff --git a/photonlib-cpp-examples/aimandrange/build.gradle b/photonlib-cpp-examples/aimandrange/build.gradle index c3ee9cbee9..43bc834165 100644 --- a/photonlib-cpp-examples/aimandrange/build.gradle +++ b/photonlib-cpp-examples/aimandrange/build.gradle @@ -1,9 +1,7 @@ plugins { id "cpp" id "google-test-test-suite" - id "edu.wpi.first.GradleRIO" version "2024.3.2" - - id "com.dorongold.task-tree" version "2.1.0" + id "edu.wpi.first.GradleRIO" version "2025.1.1-beta-1" } repositories { @@ -11,9 +9,10 @@ repositories { jcenter() } -wpi.maven.useDevelopment = true -wpi.versions.wpilibVersion = "2024.3.2" -wpi.versions.wpimathVersion = "2024.3.2" +wpi.maven.useLocal = false +wpi.maven.useDevelopment = false +wpi.versions.wpilibVersion = "2025.1.1-beta-1" +wpi.versions.wpimathVersion = "2025.1.1-beta-1" apply from: "${rootDir}/../shared/examples_common.gradle" diff --git a/photonlib-cpp-examples/aimandrange/settings.gradle b/photonlib-cpp-examples/aimandrange/settings.gradle index 44fbca7512..593b2f0e11 100644 --- a/photonlib-cpp-examples/aimandrange/settings.gradle +++ b/photonlib-cpp-examples/aimandrange/settings.gradle @@ -1,13 +1,13 @@ import org.gradle.internal.os.OperatingSystem -rootProject.name = 'aimattarget' +rootProject.name = 'aimandrange' pluginManagement { repositories { mavenLocal() jcenter() gradlePluginPortal() - String frcYear = '2024' + String frcYear = '2025' File frcHome if (OperatingSystem.current().isWindows()) { String publicFolder = System.getenv('PUBLIC') diff --git a/photonlib-cpp-examples/aimandrange/src/main/cpp/subsystems/SwerveDriveSim.cpp b/photonlib-cpp-examples/aimandrange/src/main/cpp/subsystems/SwerveDriveSim.cpp index 31bbe09e61..223ecdfa70 100644 --- a/photonlib-cpp-examples/aimandrange/src/main/cpp/subsystems/SwerveDriveSim.cpp +++ b/photonlib-cpp-examples/aimandrange/src/main/cpp/subsystems/SwerveDriveSim.cpp @@ -44,20 +44,22 @@ SwerveDriveSim::SwerveDriveSim( : SwerveDriveSim( frc::LinearSystem<2, 1, 2>{ (Eigen::MatrixXd(2, 2) << 0.0, 1.0, 0.0, - -driveFF.kV.to() / driveFF.kA.to()) + -driveFF.GetKv().to() / driveFF.GetKa().to()) .finished(), - Eigen::Matrix{0.0, 1.0 / driveFF.kA.to()}, + Eigen::Matrix{0.0, + 1.0 / driveFF.GetKa().to()}, (Eigen::MatrixXd(2, 2) << 1.0, 0.0, 0.0, 1.0).finished(), Eigen::Matrix{0.0, 0.0}}, - driveFF.kS, driveMotor, driveGearing, driveWheelRadius, + driveFF.GetKs(), driveMotor, driveGearing, driveWheelRadius, frc::LinearSystem<2, 1, 2>{ (Eigen::MatrixXd(2, 2) << 0.0, 1.0, 0.0, - -steerFF.kV.to() / steerFF.kA.to()) + -steerFF.GetKv().to() / steerFF.GetKa().to()) .finished(), - Eigen::Matrix{0.0, 1.0 / steerFF.kA.to()}, + Eigen::Matrix{0.0, + 1.0 / steerFF.GetKa().to()}, (Eigen::MatrixXd(2, 2) << 1.0, 0.0, 0.0, 1.0).finished(), Eigen::Matrix{0.0, 0.0}}, - steerFF.kS, steerMotor, steerGearing, kinematics) {} + steerFF.GetKs(), steerMotor, steerGearing, kinematics) {} SwerveDriveSim::SwerveDriveSim( const frc::LinearSystem<2, 1, 2>& drivePlant, units::volt_t driveKs, diff --git a/photonlib-cpp-examples/aimandrange/src/main/cpp/subsystems/SwerveModule.cpp b/photonlib-cpp-examples/aimandrange/src/main/cpp/subsystems/SwerveModule.cpp index 785d9ca7d6..0811f01c9b 100644 --- a/photonlib-cpp-examples/aimandrange/src/main/cpp/subsystems/SwerveModule.cpp +++ b/photonlib-cpp-examples/aimandrange/src/main/cpp/subsystems/SwerveModule.cpp @@ -64,12 +64,11 @@ void SwerveModule::Periodic() { driveMotor.SetVoltage(driveFF + drivePID); } -void SwerveModule::SetDesiredState(const frc::SwerveModuleState& newState, +void SwerveModule::SetDesiredState(frc::SwerveModuleState newState, bool shouldBeOpenLoop, bool steerInPlace) { frc::Rotation2d currentRotation = GetAbsoluteHeading(); - frc::SwerveModuleState optimizedState = - frc::SwerveModuleState::Optimize(newState, currentRotation); - desiredState = optimizedState; + newState.Optimize(currentRotation); + desiredState = newState; } frc::Rotation2d SwerveModule::GetAbsoluteHeading() const { diff --git a/photonlib-cpp-examples/aimandrange/src/main/include/Constants.h b/photonlib-cpp-examples/aimandrange/src/main/include/Constants.h index 6a20d67991..b4b23347f4 100644 --- a/photonlib-cpp-examples/aimandrange/src/main/include/Constants.h +++ b/photonlib-cpp-examples/aimandrange/src/main/include/Constants.h @@ -31,7 +31,11 @@ #include #include #include +#include +#include +#include #include +#include namespace constants { namespace Vision { @@ -40,12 +44,13 @@ inline const frc::Transform3d kRobotToCam{ frc::Translation3d{0.5_m, 0.0_m, 0.5_m}, frc::Rotation3d{0_rad, -30_deg, 0_rad}}; inline const frc::AprilTagFieldLayout kTagLayout{ - frc::LoadAprilTagLayoutField(frc::AprilTagField::k2024Crescendo)}; + frc::AprilTagFieldLayout::LoadField(frc::AprilTagField::k2024Crescendo)}; inline const Eigen::Matrix kSingleTagStdDevs{4, 4, 8}; inline const Eigen::Matrix kMultiTagStdDevs{0.5, 0.5, 1}; } // namespace Vision namespace Swerve { +using namespace units; inline constexpr units::meter_t kTrackWidth{18.5_in}; inline constexpr units::meter_t kTrackLength{18.5_in}; @@ -73,6 +78,8 @@ inline constexpr double kSteerKP = 20.0; inline constexpr double kSteerKI = 0.0; inline constexpr double kSteerKD = 0.25; +using namespace units; + inline const frc::SimpleMotorFeedforward kDriveFF{ 0.25_V, 2.5_V / 1_mps, 0.3_V / 1_mps_sq}; diff --git a/photonlib-cpp-examples/aimandrange/src/main/include/subsystems/SwerveModule.h b/photonlib-cpp-examples/aimandrange/src/main/include/subsystems/SwerveModule.h index 444e4bdf44..9c07ab426d 100644 --- a/photonlib-cpp-examples/aimandrange/src/main/include/subsystems/SwerveModule.h +++ b/photonlib-cpp-examples/aimandrange/src/main/include/subsystems/SwerveModule.h @@ -38,8 +38,8 @@ class SwerveModule { public: explicit SwerveModule(const constants::Swerve::ModuleConstants& consts); void Periodic(); - void SetDesiredState(const frc::SwerveModuleState& newState, - bool shouldBeOpenLoop, bool steerInPlace); + void SetDesiredState(frc::SwerveModuleState newState, bool shouldBeOpenLoop, + bool steerInPlace); frc::Rotation2d GetAbsoluteHeading() const; frc::SwerveModuleState GetState() const; frc::SwerveModulePosition GetPosition() const; diff --git a/photonlib-cpp-examples/aimattarget/.wpilib/wpilib_preferences.json b/photonlib-cpp-examples/aimattarget/.wpilib/wpilib_preferences.json index 36bf1b5d2f..cc94c138cc 100644 --- a/photonlib-cpp-examples/aimattarget/.wpilib/wpilib_preferences.json +++ b/photonlib-cpp-examples/aimattarget/.wpilib/wpilib_preferences.json @@ -1,6 +1,6 @@ { "enableCppIntellisense": true, "currentLanguage": "cpp", - "projectYear": "2024", + "projectYear": "2025", "teamNumber": 5 } diff --git a/photonlib-cpp-examples/aimattarget/build.gradle b/photonlib-cpp-examples/aimattarget/build.gradle index c3ee9cbee9..43bc834165 100644 --- a/photonlib-cpp-examples/aimattarget/build.gradle +++ b/photonlib-cpp-examples/aimattarget/build.gradle @@ -1,9 +1,7 @@ plugins { id "cpp" id "google-test-test-suite" - id "edu.wpi.first.GradleRIO" version "2024.3.2" - - id "com.dorongold.task-tree" version "2.1.0" + id "edu.wpi.first.GradleRIO" version "2025.1.1-beta-1" } repositories { @@ -11,9 +9,10 @@ repositories { jcenter() } -wpi.maven.useDevelopment = true -wpi.versions.wpilibVersion = "2024.3.2" -wpi.versions.wpimathVersion = "2024.3.2" +wpi.maven.useLocal = false +wpi.maven.useDevelopment = false +wpi.versions.wpilibVersion = "2025.1.1-beta-1" +wpi.versions.wpimathVersion = "2025.1.1-beta-1" apply from: "${rootDir}/../shared/examples_common.gradle" diff --git a/photonlib-cpp-examples/aimattarget/settings.gradle b/photonlib-cpp-examples/aimattarget/settings.gradle index 44fbca7512..ae08d362dd 100644 --- a/photonlib-cpp-examples/aimattarget/settings.gradle +++ b/photonlib-cpp-examples/aimattarget/settings.gradle @@ -7,7 +7,7 @@ pluginManagement { mavenLocal() jcenter() gradlePluginPortal() - String frcYear = '2024' + String frcYear = '2025' File frcHome if (OperatingSystem.current().isWindows()) { String publicFolder = System.getenv('PUBLIC') diff --git a/photonlib-cpp-examples/aimattarget/src/main/cpp/subsystems/SwerveDriveSim.cpp b/photonlib-cpp-examples/aimattarget/src/main/cpp/subsystems/SwerveDriveSim.cpp index 31bbe09e61..223ecdfa70 100644 --- a/photonlib-cpp-examples/aimattarget/src/main/cpp/subsystems/SwerveDriveSim.cpp +++ b/photonlib-cpp-examples/aimattarget/src/main/cpp/subsystems/SwerveDriveSim.cpp @@ -44,20 +44,22 @@ SwerveDriveSim::SwerveDriveSim( : SwerveDriveSim( frc::LinearSystem<2, 1, 2>{ (Eigen::MatrixXd(2, 2) << 0.0, 1.0, 0.0, - -driveFF.kV.to() / driveFF.kA.to()) + -driveFF.GetKv().to() / driveFF.GetKa().to()) .finished(), - Eigen::Matrix{0.0, 1.0 / driveFF.kA.to()}, + Eigen::Matrix{0.0, + 1.0 / driveFF.GetKa().to()}, (Eigen::MatrixXd(2, 2) << 1.0, 0.0, 0.0, 1.0).finished(), Eigen::Matrix{0.0, 0.0}}, - driveFF.kS, driveMotor, driveGearing, driveWheelRadius, + driveFF.GetKs(), driveMotor, driveGearing, driveWheelRadius, frc::LinearSystem<2, 1, 2>{ (Eigen::MatrixXd(2, 2) << 0.0, 1.0, 0.0, - -steerFF.kV.to() / steerFF.kA.to()) + -steerFF.GetKv().to() / steerFF.GetKa().to()) .finished(), - Eigen::Matrix{0.0, 1.0 / steerFF.kA.to()}, + Eigen::Matrix{0.0, + 1.0 / steerFF.GetKa().to()}, (Eigen::MatrixXd(2, 2) << 1.0, 0.0, 0.0, 1.0).finished(), Eigen::Matrix{0.0, 0.0}}, - steerFF.kS, steerMotor, steerGearing, kinematics) {} + steerFF.GetKs(), steerMotor, steerGearing, kinematics) {} SwerveDriveSim::SwerveDriveSim( const frc::LinearSystem<2, 1, 2>& drivePlant, units::volt_t driveKs, diff --git a/photonlib-cpp-examples/aimattarget/src/main/cpp/subsystems/SwerveModule.cpp b/photonlib-cpp-examples/aimattarget/src/main/cpp/subsystems/SwerveModule.cpp index 785d9ca7d6..0811f01c9b 100644 --- a/photonlib-cpp-examples/aimattarget/src/main/cpp/subsystems/SwerveModule.cpp +++ b/photonlib-cpp-examples/aimattarget/src/main/cpp/subsystems/SwerveModule.cpp @@ -64,12 +64,11 @@ void SwerveModule::Periodic() { driveMotor.SetVoltage(driveFF + drivePID); } -void SwerveModule::SetDesiredState(const frc::SwerveModuleState& newState, +void SwerveModule::SetDesiredState(frc::SwerveModuleState newState, bool shouldBeOpenLoop, bool steerInPlace) { frc::Rotation2d currentRotation = GetAbsoluteHeading(); - frc::SwerveModuleState optimizedState = - frc::SwerveModuleState::Optimize(newState, currentRotation); - desiredState = optimizedState; + newState.Optimize(currentRotation); + desiredState = newState; } frc::Rotation2d SwerveModule::GetAbsoluteHeading() const { diff --git a/photonlib-cpp-examples/aimattarget/src/main/include/Constants.h b/photonlib-cpp-examples/aimattarget/src/main/include/Constants.h index 6a20d67991..b4b23347f4 100644 --- a/photonlib-cpp-examples/aimattarget/src/main/include/Constants.h +++ b/photonlib-cpp-examples/aimattarget/src/main/include/Constants.h @@ -31,7 +31,11 @@ #include #include #include +#include +#include +#include #include +#include namespace constants { namespace Vision { @@ -40,12 +44,13 @@ inline const frc::Transform3d kRobotToCam{ frc::Translation3d{0.5_m, 0.0_m, 0.5_m}, frc::Rotation3d{0_rad, -30_deg, 0_rad}}; inline const frc::AprilTagFieldLayout kTagLayout{ - frc::LoadAprilTagLayoutField(frc::AprilTagField::k2024Crescendo)}; + frc::AprilTagFieldLayout::LoadField(frc::AprilTagField::k2024Crescendo)}; inline const Eigen::Matrix kSingleTagStdDevs{4, 4, 8}; inline const Eigen::Matrix kMultiTagStdDevs{0.5, 0.5, 1}; } // namespace Vision namespace Swerve { +using namespace units; inline constexpr units::meter_t kTrackWidth{18.5_in}; inline constexpr units::meter_t kTrackLength{18.5_in}; @@ -73,6 +78,8 @@ inline constexpr double kSteerKP = 20.0; inline constexpr double kSteerKI = 0.0; inline constexpr double kSteerKD = 0.25; +using namespace units; + inline const frc::SimpleMotorFeedforward kDriveFF{ 0.25_V, 2.5_V / 1_mps, 0.3_V / 1_mps_sq}; diff --git a/photonlib-cpp-examples/aimattarget/src/main/include/subsystems/SwerveModule.h b/photonlib-cpp-examples/aimattarget/src/main/include/subsystems/SwerveModule.h index 444e4bdf44..9c07ab426d 100644 --- a/photonlib-cpp-examples/aimattarget/src/main/include/subsystems/SwerveModule.h +++ b/photonlib-cpp-examples/aimattarget/src/main/include/subsystems/SwerveModule.h @@ -38,8 +38,8 @@ class SwerveModule { public: explicit SwerveModule(const constants::Swerve::ModuleConstants& consts); void Periodic(); - void SetDesiredState(const frc::SwerveModuleState& newState, - bool shouldBeOpenLoop, bool steerInPlace); + void SetDesiredState(frc::SwerveModuleState newState, bool shouldBeOpenLoop, + bool steerInPlace); frc::Rotation2d GetAbsoluteHeading() const; frc::SwerveModuleState GetState() const; frc::SwerveModulePosition GetPosition() const; diff --git a/photonlib-cpp-examples/gradle/wrapper/gradle-wrapper.properties b/photonlib-cpp-examples/gradle/wrapper/gradle-wrapper.properties index 24c4386e93..10587529d5 100644 --- a/photonlib-cpp-examples/gradle/wrapper/gradle-wrapper.properties +++ b/photonlib-cpp-examples/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services\.gradle\.org/distributions/gradle-8\.4-bin\.zip +distributionPath=permwrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists +zipStorePath=permwrapper/dists diff --git a/photonlib-cpp-examples/poseest/.wpilib/wpilib_preferences.json b/photonlib-cpp-examples/poseest/.wpilib/wpilib_preferences.json index 36bf1b5d2f..cc94c138cc 100644 --- a/photonlib-cpp-examples/poseest/.wpilib/wpilib_preferences.json +++ b/photonlib-cpp-examples/poseest/.wpilib/wpilib_preferences.json @@ -1,6 +1,6 @@ { "enableCppIntellisense": true, "currentLanguage": "cpp", - "projectYear": "2024", + "projectYear": "2025", "teamNumber": 5 } diff --git a/photonlib-cpp-examples/poseest/build.gradle b/photonlib-cpp-examples/poseest/build.gradle index c3ee9cbee9..43bc834165 100644 --- a/photonlib-cpp-examples/poseest/build.gradle +++ b/photonlib-cpp-examples/poseest/build.gradle @@ -1,9 +1,7 @@ plugins { id "cpp" id "google-test-test-suite" - id "edu.wpi.first.GradleRIO" version "2024.3.2" - - id "com.dorongold.task-tree" version "2.1.0" + id "edu.wpi.first.GradleRIO" version "2025.1.1-beta-1" } repositories { @@ -11,9 +9,10 @@ repositories { jcenter() } -wpi.maven.useDevelopment = true -wpi.versions.wpilibVersion = "2024.3.2" -wpi.versions.wpimathVersion = "2024.3.2" +wpi.maven.useLocal = false +wpi.maven.useDevelopment = false +wpi.versions.wpilibVersion = "2025.1.1-beta-1" +wpi.versions.wpimathVersion = "2025.1.1-beta-1" apply from: "${rootDir}/../shared/examples_common.gradle" diff --git a/photonlib-cpp-examples/poseest/settings.gradle b/photonlib-cpp-examples/poseest/settings.gradle index 44fbca7512..5180a5dfa9 100644 --- a/photonlib-cpp-examples/poseest/settings.gradle +++ b/photonlib-cpp-examples/poseest/settings.gradle @@ -1,13 +1,13 @@ import org.gradle.internal.os.OperatingSystem -rootProject.name = 'aimattarget' +rootProject.name = 'poseest' pluginManagement { repositories { mavenLocal() jcenter() gradlePluginPortal() - String frcYear = '2024' + String frcYear = '2025' File frcHome if (OperatingSystem.current().isWindows()) { String publicFolder = System.getenv('PUBLIC') diff --git a/photonlib-cpp-examples/poseest/src/main/cpp/subsystems/SwerveDriveSim.cpp b/photonlib-cpp-examples/poseest/src/main/cpp/subsystems/SwerveDriveSim.cpp index 31bbe09e61..223ecdfa70 100644 --- a/photonlib-cpp-examples/poseest/src/main/cpp/subsystems/SwerveDriveSim.cpp +++ b/photonlib-cpp-examples/poseest/src/main/cpp/subsystems/SwerveDriveSim.cpp @@ -44,20 +44,22 @@ SwerveDriveSim::SwerveDriveSim( : SwerveDriveSim( frc::LinearSystem<2, 1, 2>{ (Eigen::MatrixXd(2, 2) << 0.0, 1.0, 0.0, - -driveFF.kV.to() / driveFF.kA.to()) + -driveFF.GetKv().to() / driveFF.GetKa().to()) .finished(), - Eigen::Matrix{0.0, 1.0 / driveFF.kA.to()}, + Eigen::Matrix{0.0, + 1.0 / driveFF.GetKa().to()}, (Eigen::MatrixXd(2, 2) << 1.0, 0.0, 0.0, 1.0).finished(), Eigen::Matrix{0.0, 0.0}}, - driveFF.kS, driveMotor, driveGearing, driveWheelRadius, + driveFF.GetKs(), driveMotor, driveGearing, driveWheelRadius, frc::LinearSystem<2, 1, 2>{ (Eigen::MatrixXd(2, 2) << 0.0, 1.0, 0.0, - -steerFF.kV.to() / steerFF.kA.to()) + -steerFF.GetKv().to() / steerFF.GetKa().to()) .finished(), - Eigen::Matrix{0.0, 1.0 / steerFF.kA.to()}, + Eigen::Matrix{0.0, + 1.0 / steerFF.GetKa().to()}, (Eigen::MatrixXd(2, 2) << 1.0, 0.0, 0.0, 1.0).finished(), Eigen::Matrix{0.0, 0.0}}, - steerFF.kS, steerMotor, steerGearing, kinematics) {} + steerFF.GetKs(), steerMotor, steerGearing, kinematics) {} SwerveDriveSim::SwerveDriveSim( const frc::LinearSystem<2, 1, 2>& drivePlant, units::volt_t driveKs, diff --git a/photonlib-cpp-examples/poseest/src/main/cpp/subsystems/SwerveModule.cpp b/photonlib-cpp-examples/poseest/src/main/cpp/subsystems/SwerveModule.cpp index 785d9ca7d6..0811f01c9b 100644 --- a/photonlib-cpp-examples/poseest/src/main/cpp/subsystems/SwerveModule.cpp +++ b/photonlib-cpp-examples/poseest/src/main/cpp/subsystems/SwerveModule.cpp @@ -64,12 +64,11 @@ void SwerveModule::Periodic() { driveMotor.SetVoltage(driveFF + drivePID); } -void SwerveModule::SetDesiredState(const frc::SwerveModuleState& newState, +void SwerveModule::SetDesiredState(frc::SwerveModuleState newState, bool shouldBeOpenLoop, bool steerInPlace) { frc::Rotation2d currentRotation = GetAbsoluteHeading(); - frc::SwerveModuleState optimizedState = - frc::SwerveModuleState::Optimize(newState, currentRotation); - desiredState = optimizedState; + newState.Optimize(currentRotation); + desiredState = newState; } frc::Rotation2d SwerveModule::GetAbsoluteHeading() const { diff --git a/photonlib-cpp-examples/poseest/src/main/include/Constants.h b/photonlib-cpp-examples/poseest/src/main/include/Constants.h index 98e1d5b1db..b4b23347f4 100644 --- a/photonlib-cpp-examples/poseest/src/main/include/Constants.h +++ b/photonlib-cpp-examples/poseest/src/main/include/Constants.h @@ -31,21 +31,26 @@ #include #include #include +#include +#include +#include #include +#include namespace constants { namespace Vision { inline constexpr std::string_view kCameraName{"YOUR CAMERA NAME"}; inline const frc::Transform3d kRobotToCam{ frc::Translation3d{0.5_m, 0.0_m, 0.5_m}, - frc::Rotation3d{0_rad, 0_rad, 0_rad}}; + frc::Rotation3d{0_rad, -30_deg, 0_rad}}; inline const frc::AprilTagFieldLayout kTagLayout{ - frc::LoadAprilTagLayoutField(frc::AprilTagField::k2024Crescendo)}; + frc::AprilTagFieldLayout::LoadField(frc::AprilTagField::k2024Crescendo)}; inline const Eigen::Matrix kSingleTagStdDevs{4, 4, 8}; inline const Eigen::Matrix kMultiTagStdDevs{0.5, 0.5, 1}; } // namespace Vision namespace Swerve { +using namespace units; inline constexpr units::meter_t kTrackWidth{18.5_in}; inline constexpr units::meter_t kTrackLength{18.5_in}; @@ -73,6 +78,8 @@ inline constexpr double kSteerKP = 20.0; inline constexpr double kSteerKI = 0.0; inline constexpr double kSteerKD = 0.25; +using namespace units; + inline const frc::SimpleMotorFeedforward kDriveFF{ 0.25_V, 2.5_V / 1_mps, 0.3_V / 1_mps_sq}; diff --git a/photonlib-cpp-examples/poseest/src/main/include/subsystems/GamepieceLauncher.h b/photonlib-cpp-examples/poseest/src/main/include/subsystems/GamepieceLauncher.h index 39590267d5..483570f75b 100644 --- a/photonlib-cpp-examples/poseest/src/main/include/subsystems/GamepieceLauncher.h +++ b/photonlib-cpp-examples/poseest/src/main/include/subsystems/GamepieceLauncher.h @@ -58,7 +58,7 @@ class GamepieceLauncher { frc::LinearSystem<1, 1, 1> m_plant{frc::LinearSystemId::FlywheelSystem( m_gearbox, kFlywheelMomentOfInertia, 1.0)}; - frc::sim::FlywheelSim launcherSim{m_plant, m_gearbox, 1.0}; + frc::sim::FlywheelSim launcherSim{m_plant, m_gearbox}; void simulationInit(); // Method to initialize simulation components }; diff --git a/photonlib-cpp-examples/poseest/src/main/include/subsystems/SwerveModule.h b/photonlib-cpp-examples/poseest/src/main/include/subsystems/SwerveModule.h index 444e4bdf44..9c07ab426d 100644 --- a/photonlib-cpp-examples/poseest/src/main/include/subsystems/SwerveModule.h +++ b/photonlib-cpp-examples/poseest/src/main/include/subsystems/SwerveModule.h @@ -38,8 +38,8 @@ class SwerveModule { public: explicit SwerveModule(const constants::Swerve::ModuleConstants& consts); void Periodic(); - void SetDesiredState(const frc::SwerveModuleState& newState, - bool shouldBeOpenLoop, bool steerInPlace); + void SetDesiredState(frc::SwerveModuleState newState, bool shouldBeOpenLoop, + bool steerInPlace); frc::Rotation2d GetAbsoluteHeading() const; frc::SwerveModuleState GetState() const; frc::SwerveModulePosition GetPosition() const; diff --git a/photonlib-java-examples/aimandrange/.wpilib/wpilib_preferences.json b/photonlib-java-examples/aimandrange/.wpilib/wpilib_preferences.json index 6180392668..0a74652686 100644 --- a/photonlib-java-examples/aimandrange/.wpilib/wpilib_preferences.json +++ b/photonlib-java-examples/aimandrange/.wpilib/wpilib_preferences.json @@ -1,6 +1,6 @@ { "enableCppIntellisense": false, "currentLanguage": "java", - "projectYear": "2024", + "projectYear": "2025", "teamNumber": 4512 } diff --git a/photonlib-java-examples/aimandrange/build.gradle b/photonlib-java-examples/aimandrange/build.gradle index 9a885f3e8a..9587975151 100644 --- a/photonlib-java-examples/aimandrange/build.gradle +++ b/photonlib-java-examples/aimandrange/build.gradle @@ -1,6 +1,6 @@ plugins { id "java" - id "edu.wpi.first.GradleRIO" version "2024.3.2" + id "edu.wpi.first.GradleRIO" version "2025.1.1-beta-1" } sourceCompatibility = JavaVersion.VERSION_11 @@ -15,8 +15,8 @@ repositories { } wpi.maven.useDevelopment = true -wpi.versions.wpilibVersion = "2024.3.2" -wpi.versions.wpimathVersion = "2024.3.2" +wpi.versions.wpilibVersion = "2025.1.1-beta-1" +wpi.versions.wpimathVersion = "2025.1.1-beta-1" // Define my targets (RoboRIO) and artifacts (deployable files) diff --git a/photonlib-java-examples/aimandrange/settings.gradle b/photonlib-java-examples/aimandrange/settings.gradle index 091a37a027..c906787bf3 100644 --- a/photonlib-java-examples/aimandrange/settings.gradle +++ b/photonlib-java-examples/aimandrange/settings.gradle @@ -4,7 +4,7 @@ pluginManagement { repositories { mavenLocal() gradlePluginPortal() - String frcYear = '2024' + String frcYear = '2025' File frcHome if (OperatingSystem.current().isWindows()) { String publicFolder = System.getenv('PUBLIC') diff --git a/photonlib-java-examples/aimandrange/src/main/java/frc/robot/subsystems/drivetrain/SwerveDriveSim.java b/photonlib-java-examples/aimandrange/src/main/java/frc/robot/subsystems/drivetrain/SwerveDriveSim.java index 85849141d4..ccef2bba6c 100644 --- a/photonlib-java-examples/aimandrange/src/main/java/frc/robot/subsystems/drivetrain/SwerveDriveSim.java +++ b/photonlib-java-examples/aimandrange/src/main/java/frc/robot/subsystems/drivetrain/SwerveDriveSim.java @@ -115,20 +115,20 @@ public SwerveDriveSim( SwerveDriveKinematics kinematics) { this( new LinearSystem( - MatBuilder.fill(Nat.N2(), Nat.N2(), 0.0, 1.0, 0.0, -driveFF.kv / driveFF.ka), - VecBuilder.fill(0.0, 1.0 / driveFF.ka), + MatBuilder.fill(Nat.N2(), Nat.N2(), 0.0, 1.0, 0.0, -driveFF.getKv() / driveFF.getKa()), + VecBuilder.fill(0.0, 1.0 / driveFF.getKa()), MatBuilder.fill(Nat.N2(), Nat.N2(), 1.0, 0.0, 0.0, 1.0), VecBuilder.fill(0.0, 0.0)), - driveFF.ks, + driveFF.getKs(), driveMotor, driveGearing, driveWheelRadius, new LinearSystem( - MatBuilder.fill(Nat.N2(), Nat.N2(), 0.0, 1.0, 0.0, -steerFF.kv / steerFF.ka), - VecBuilder.fill(0.0, 1.0 / steerFF.ka), + MatBuilder.fill(Nat.N2(), Nat.N2(), 0.0, 1.0, 0.0, -steerFF.getKv() / steerFF.getKa()), + VecBuilder.fill(0.0, 1.0 / steerFF.getKa()), MatBuilder.fill(Nat.N2(), Nat.N2(), 1.0, 0.0, 0.0, 1.0), VecBuilder.fill(0.0, 0.0)), - steerFF.ks, + steerFF.getKs(), steerMotor, steerGearing, kinematics); diff --git a/photonlib-java-examples/aimattarget/.wpilib/wpilib_preferences.json b/photonlib-java-examples/aimattarget/.wpilib/wpilib_preferences.json index 6180392668..0a74652686 100644 --- a/photonlib-java-examples/aimattarget/.wpilib/wpilib_preferences.json +++ b/photonlib-java-examples/aimattarget/.wpilib/wpilib_preferences.json @@ -1,6 +1,6 @@ { "enableCppIntellisense": false, "currentLanguage": "java", - "projectYear": "2024", + "projectYear": "2025", "teamNumber": 4512 } diff --git a/photonlib-java-examples/aimattarget/build.gradle b/photonlib-java-examples/aimattarget/build.gradle index 28dc34bcab..4d1761e7a2 100644 --- a/photonlib-java-examples/aimattarget/build.gradle +++ b/photonlib-java-examples/aimattarget/build.gradle @@ -1,6 +1,6 @@ plugins { id "java" - id "edu.wpi.first.GradleRIO" version "2024.3.2" + id "edu.wpi.first.GradleRIO" version "2025.1.1-beta-1" } sourceCompatibility = JavaVersion.VERSION_11 @@ -11,8 +11,8 @@ apply from: "${rootDir}/../shared/examples_common.gradle" def ROBOT_MAIN_CLASS = "frc.robot.Main" wpi.maven.useDevelopment = true -wpi.versions.wpilibVersion = "2024.3.2" -wpi.versions.wpimathVersion = "2024.3.2" +wpi.versions.wpilibVersion = "2025.1.1-beta-1" +wpi.versions.wpimathVersion = "2025.1.1-beta-1" // Define my targets (RoboRIO) and artifacts (deployable files) diff --git a/photonlib-java-examples/aimattarget/settings.gradle b/photonlib-java-examples/aimattarget/settings.gradle index 091a37a027..c906787bf3 100644 --- a/photonlib-java-examples/aimattarget/settings.gradle +++ b/photonlib-java-examples/aimattarget/settings.gradle @@ -4,7 +4,7 @@ pluginManagement { repositories { mavenLocal() gradlePluginPortal() - String frcYear = '2024' + String frcYear = '2025' File frcHome if (OperatingSystem.current().isWindows()) { String publicFolder = System.getenv('PUBLIC') diff --git a/photonlib-java-examples/aimattarget/src/main/java/frc/robot/subsystems/drivetrain/SwerveDriveSim.java b/photonlib-java-examples/aimattarget/src/main/java/frc/robot/subsystems/drivetrain/SwerveDriveSim.java index 85849141d4..ccef2bba6c 100644 --- a/photonlib-java-examples/aimattarget/src/main/java/frc/robot/subsystems/drivetrain/SwerveDriveSim.java +++ b/photonlib-java-examples/aimattarget/src/main/java/frc/robot/subsystems/drivetrain/SwerveDriveSim.java @@ -115,20 +115,20 @@ public SwerveDriveSim( SwerveDriveKinematics kinematics) { this( new LinearSystem( - MatBuilder.fill(Nat.N2(), Nat.N2(), 0.0, 1.0, 0.0, -driveFF.kv / driveFF.ka), - VecBuilder.fill(0.0, 1.0 / driveFF.ka), + MatBuilder.fill(Nat.N2(), Nat.N2(), 0.0, 1.0, 0.0, -driveFF.getKv() / driveFF.getKa()), + VecBuilder.fill(0.0, 1.0 / driveFF.getKa()), MatBuilder.fill(Nat.N2(), Nat.N2(), 1.0, 0.0, 0.0, 1.0), VecBuilder.fill(0.0, 0.0)), - driveFF.ks, + driveFF.getKs(), driveMotor, driveGearing, driveWheelRadius, new LinearSystem( - MatBuilder.fill(Nat.N2(), Nat.N2(), 0.0, 1.0, 0.0, -steerFF.kv / steerFF.ka), - VecBuilder.fill(0.0, 1.0 / steerFF.ka), + MatBuilder.fill(Nat.N2(), Nat.N2(), 0.0, 1.0, 0.0, -steerFF.getKv() / steerFF.getKa()), + VecBuilder.fill(0.0, 1.0 / steerFF.getKa()), MatBuilder.fill(Nat.N2(), Nat.N2(), 1.0, 0.0, 0.0, 1.0), VecBuilder.fill(0.0, 0.0)), - steerFF.ks, + steerFF.getKs(), steerMotor, steerGearing, kinematics); diff --git a/photonlib-java-examples/gradle/wrapper/gradle-wrapper.properties b/photonlib-java-examples/gradle/wrapper/gradle-wrapper.properties index 24c4386e93..10587529d5 100644 --- a/photonlib-java-examples/gradle/wrapper/gradle-wrapper.properties +++ b/photonlib-java-examples/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services\.gradle\.org/distributions/gradle-8\.4-bin\.zip +distributionPath=permwrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists +zipStorePath=permwrapper/dists diff --git a/photonlib-java-examples/poseest/.wpilib/wpilib_preferences.json b/photonlib-java-examples/poseest/.wpilib/wpilib_preferences.json index 6180392668..0a74652686 100644 --- a/photonlib-java-examples/poseest/.wpilib/wpilib_preferences.json +++ b/photonlib-java-examples/poseest/.wpilib/wpilib_preferences.json @@ -1,6 +1,6 @@ { "enableCppIntellisense": false, "currentLanguage": "java", - "projectYear": "2024", + "projectYear": "2025", "teamNumber": 4512 } diff --git a/photonlib-java-examples/poseest/build.gradle b/photonlib-java-examples/poseest/build.gradle index 28dc34bcab..4d1761e7a2 100644 --- a/photonlib-java-examples/poseest/build.gradle +++ b/photonlib-java-examples/poseest/build.gradle @@ -1,6 +1,6 @@ plugins { id "java" - id "edu.wpi.first.GradleRIO" version "2024.3.2" + id "edu.wpi.first.GradleRIO" version "2025.1.1-beta-1" } sourceCompatibility = JavaVersion.VERSION_11 @@ -11,8 +11,8 @@ apply from: "${rootDir}/../shared/examples_common.gradle" def ROBOT_MAIN_CLASS = "frc.robot.Main" wpi.maven.useDevelopment = true -wpi.versions.wpilibVersion = "2024.3.2" -wpi.versions.wpimathVersion = "2024.3.2" +wpi.versions.wpilibVersion = "2025.1.1-beta-1" +wpi.versions.wpimathVersion = "2025.1.1-beta-1" // Define my targets (RoboRIO) and artifacts (deployable files) diff --git a/photonlib-java-examples/poseest/settings.gradle b/photonlib-java-examples/poseest/settings.gradle index 091a37a027..c906787bf3 100644 --- a/photonlib-java-examples/poseest/settings.gradle +++ b/photonlib-java-examples/poseest/settings.gradle @@ -4,7 +4,7 @@ pluginManagement { repositories { mavenLocal() gradlePluginPortal() - String frcYear = '2024' + String frcYear = '2025' File frcHome if (OperatingSystem.current().isWindows()) { String publicFolder = System.getenv('PUBLIC') diff --git a/photonlib-java-examples/poseest/src/main/java/frc/robot/subsystems/GamepieceLauncher.java b/photonlib-java-examples/poseest/src/main/java/frc/robot/subsystems/GamepieceLauncher.java index 24634d616a..8d76b1d788 100644 --- a/photonlib-java-examples/poseest/src/main/java/frc/robot/subsystems/GamepieceLauncher.java +++ b/photonlib-java-examples/poseest/src/main/java/frc/robot/subsystems/GamepieceLauncher.java @@ -26,6 +26,7 @@ import edu.wpi.first.math.MathUtil; 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.RobotController; import edu.wpi.first.wpilibj.motorcontrol.PWMSparkMax; @@ -61,10 +62,15 @@ public void periodic() { // -- SIMULATION SUPPORT private DCMotor motorSim; private FlywheelSim launcherSim; + private final double flywheelMoiKgM2 = 0.002; + private final double flywheelGearRatio = 1.0; private void simulationInit() { motorSim = DCMotor.getFalcon500(1); - launcherSim = new FlywheelSim(motorSim, 1.0, 0.002); + launcherSim = + new FlywheelSim( + LinearSystemId.createFlywheelSystem(motorSim, flywheelMoiKgM2, flywheelGearRatio), + motorSim); } public void simulationPeriodic() { diff --git a/photonlib-java-examples/poseest/src/main/java/frc/robot/subsystems/drivetrain/SwerveDriveSim.java b/photonlib-java-examples/poseest/src/main/java/frc/robot/subsystems/drivetrain/SwerveDriveSim.java index 85849141d4..ccef2bba6c 100644 --- a/photonlib-java-examples/poseest/src/main/java/frc/robot/subsystems/drivetrain/SwerveDriveSim.java +++ b/photonlib-java-examples/poseest/src/main/java/frc/robot/subsystems/drivetrain/SwerveDriveSim.java @@ -115,20 +115,20 @@ public SwerveDriveSim( SwerveDriveKinematics kinematics) { this( new LinearSystem( - MatBuilder.fill(Nat.N2(), Nat.N2(), 0.0, 1.0, 0.0, -driveFF.kv / driveFF.ka), - VecBuilder.fill(0.0, 1.0 / driveFF.ka), + MatBuilder.fill(Nat.N2(), Nat.N2(), 0.0, 1.0, 0.0, -driveFF.getKv() / driveFF.getKa()), + VecBuilder.fill(0.0, 1.0 / driveFF.getKa()), MatBuilder.fill(Nat.N2(), Nat.N2(), 1.0, 0.0, 0.0, 1.0), VecBuilder.fill(0.0, 0.0)), - driveFF.ks, + driveFF.getKs(), driveMotor, driveGearing, driveWheelRadius, new LinearSystem( - MatBuilder.fill(Nat.N2(), Nat.N2(), 0.0, 1.0, 0.0, -steerFF.kv / steerFF.ka), - VecBuilder.fill(0.0, 1.0 / steerFF.ka), + MatBuilder.fill(Nat.N2(), Nat.N2(), 0.0, 1.0, 0.0, -steerFF.getKv() / steerFF.getKa()), + VecBuilder.fill(0.0, 1.0 / steerFF.getKa()), MatBuilder.fill(Nat.N2(), Nat.N2(), 1.0, 0.0, 0.0, 1.0), VecBuilder.fill(0.0, 0.0)), - steerFF.ks, + steerFF.getKs(), steerMotor, steerGearing, kinematics); diff --git a/shared/common.gradle b/shared/common.gradle index a8fb28b164..62aa78daed 100644 --- a/shared/common.gradle +++ b/shared/common.gradle @@ -33,7 +33,7 @@ dependencies { implementation wpilibTools.deps.wpilibJava("wpilibj") implementation wpilibTools.deps.wpilibJava("apriltag") implementation wpilibTools.deps.wpilibJava("wpiunits") - implementation wpilibTools.deps.wpilibOpenCvJava("frc" + wpi.frcYear.get(), wpi.versions.opencvVersion.get()) + implementation wpilibTools.deps.wpilibOpenCvJava("frc" + openCVYear, wpi.versions.opencvVersion.get()) implementation group: "com.fasterxml.jackson.core", name: "jackson-annotations", version: wpi.versions.jacksonVersion.get() implementation group: "com.fasterxml.jackson.core", name: "jackson-core", version: wpi.versions.jacksonVersion.get() diff --git a/shared/config.gradle b/shared/config.gradle index 799e7c16c9..33b6c467f7 100644 --- a/shared/config.gradle +++ b/shared/config.gradle @@ -8,7 +8,7 @@ nativeUtils.withCrossLinuxArm64() nativeUtils.wpi.configureDependencies { wpiVersion = wpilibVersion wpimathVersion = wpimathVersion - opencvYear = 'frc2024' + opencvYear = 'frc'+openCVYear opencvVersion = openCVversion googleTestYear = "frc2024" googleTestVersion = "1.14.0-1" diff --git a/shared/javacommon.gradle b/shared/javacommon.gradle index cd659fbcf9..0779bee112 100644 --- a/shared/javacommon.gradle +++ b/shared/javacommon.gradle @@ -124,7 +124,7 @@ dependencies { implementation wpilibTools.deps.wpilibJava("wpilibj") implementation wpilibTools.deps.wpilibJava("apriltag") implementation wpilibTools.deps.wpilibJava("wpiunits") - implementation wpilibTools.deps.wpilibOpenCvJava("frc" + wpi.frcYear.get(), wpi.versions.opencvVersion.get()) + implementation wpilibTools.deps.wpilibOpenCvJava("frc" + openCVYear, wpi.versions.opencvVersion.get()) implementation group: "com.fasterxml.jackson.core", name: "jackson-annotations", version: wpi.versions.jacksonVersion.get() implementation group: "com.fasterxml.jackson.core", name: "jackson-core", version: wpi.versions.jacksonVersion.get() @@ -149,6 +149,7 @@ jacocoTestReport { } } + protobuf { protoc { artifact = 'com.google.protobuf:protoc:3.21.12' @@ -161,7 +162,8 @@ protobuf { generateProtoTasks { all().configureEach { task -> task.builtins { - cpp {} + // cpp {} + // The protobuf-java code is bad -- use quickbuf remove java } task.plugins { diff --git a/shared/javacpp/setupBuild.gradle b/shared/javacpp/setupBuild.gradle index f77c3d8f16..05df392020 100644 --- a/shared/javacpp/setupBuild.gradle +++ b/shared/javacpp/setupBuild.gradle @@ -22,7 +22,7 @@ nativeConfig.dependencies.add wpilibTools.deps.wpilib("ntcore") nativeConfig.dependencies.add wpilibTools.deps.wpilib("cscore") nativeConfig.dependencies.add wpilibTools.deps.wpilib("apriltag") nativeConfig.dependencies.add wpilibTools.deps.wpilib("hal") -nativeConfig.dependencies.add wpilibTools.deps.wpilibOpenCv("frc" + wpi.frcYear.get(), wpi.versions.opencvVersion.get()) +nativeConfig.dependencies.add wpilibTools.deps.wpilibOpenCv("frc" + openCVYear, wpi.versions.opencvVersion.get()) // Windows specific functionality to export all symbols from a binary automatically nativeUtils {