From 43b78fae35d38c79705774a26117302da8cb6162 Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 10 Oct 2023 04:36:02 -0400 Subject: [PATCH 1/3] Remove un-needed NM-dbus dep (#919) --- photon-core/build.gradle | 3 --- 1 file changed, 3 deletions(-) diff --git a/photon-core/build.gradle b/photon-core/build.gradle index dde8502d4d..feaa5b0c74 100644 --- a/photon-core/build.gradle +++ b/photon-core/build.gradle @@ -27,9 +27,6 @@ dependencies { implementation wpilibTools.deps.wpilibJava("apriltag") implementation "org.xerial:sqlite-jdbc:3.41.0.0" - - // NetworkManager - implementation "com.github.hypfvieh:dbus-java:3.3.2" } task writeCurrentVersionJava { From 0e06737272f9b297545e5b28cbd6679534811c1d Mon Sep 17 00:00:00 2001 From: Sriman Achanta <68172138+srimanachanta@users.noreply.github.com> Date: Tue, 10 Oct 2023 05:06:59 -0400 Subject: [PATCH 2/3] move javalinVersion to a global version (#942) --- build.gradle | 1 + photon-core/build.gradle | 2 +- photon-server/build.gradle | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 0a6e4c10a2..cbe84c5549 100644 --- a/build.gradle +++ b/build.gradle @@ -29,6 +29,7 @@ ext { wpilibVersion = "2023.4.2" opencvVersion = "4.6.0-4" joglVersion = "2.4.0-rc-20200307" + javalinVersion = "5.6.2" pubVersion = versionString isDev = pubVersion.startsWith("dev") diff --git a/photon-core/build.gradle b/photon-core/build.gradle index feaa5b0c74..dc805fff55 100644 --- a/photon-core/build.gradle +++ b/photon-core/build.gradle @@ -9,7 +9,7 @@ apply from: "${rootDir}/shared/common.gradle" dependencies { implementation project(':photon-targeting') - implementation 'io.javalin:javalin:4.2.0' + implementation "io.javalin:javalin:$javalinVersion" implementation 'org.msgpack:msgpack-core:0.9.0' implementation 'org.msgpack:jackson-dataformat-msgpack:0.9.0' diff --git a/photon-server/build.gradle b/photon-server/build.gradle index 6b1a5bf5ec..a37e4f3ea0 100644 --- a/photon-server/build.gradle +++ b/photon-server/build.gradle @@ -34,7 +34,7 @@ dependencies { implementation project(':photon-core') implementation project(':photon-targeting') - implementation "io.javalin:javalin:5.6.2" + implementation "io.javalin:javalin:$javalinVersion" implementation wpilibTools.deps.wpilibJava("wpiutil") implementation wpilibTools.deps.wpilibJava("wpimath") From 5f3b5d2f19d1b00be4df1aac2bef343b05a1aa9b Mon Sep 17 00:00:00 2001 From: amquake Date: Tue, 10 Oct 2023 04:12:03 -0700 Subject: [PATCH 3/3] Remove unused MathUtils.orthogonalizeRotationMatrix() (#944) --- ..._MathUtils_orthogonalizeRotationMatrix.txt | 23 ----------- .../common/util/math/MathUtils.java | 39 ------------------- 2 files changed, 62 deletions(-) delete mode 100644 LICENSE_MathUtils_orthogonalizeRotationMatrix.txt diff --git a/LICENSE_MathUtils_orthogonalizeRotationMatrix.txt b/LICENSE_MathUtils_orthogonalizeRotationMatrix.txt deleted file mode 100644 index 73f837d96b..0000000000 --- a/LICENSE_MathUtils_orthogonalizeRotationMatrix.txt +++ /dev/null @@ -1,23 +0,0 @@ -Copyright (c) Photon Vision. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of FIRST, WPILib, nor the names of other WPILib - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY FIRST AND OTHER WPILIB CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY NONINFRINGEMENT AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL FIRST OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/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 15573a0282..01bff3237c 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 @@ -18,7 +18,6 @@ package org.photonvision.common.util.math; import edu.wpi.first.math.MatBuilder; -import edu.wpi.first.math.Matrix; import edu.wpi.first.math.Nat; import edu.wpi.first.math.VecBuilder; import edu.wpi.first.math.geometry.CoordinateSystem; @@ -26,14 +25,10 @@ import edu.wpi.first.math.geometry.Quaternion; import edu.wpi.first.math.geometry.Rotation3d; import edu.wpi.first.math.geometry.Transform3d; -import edu.wpi.first.math.numbers.N3; import edu.wpi.first.math.util.Units; import edu.wpi.first.util.WPIUtilJNI; import java.util.Arrays; import java.util.List; -import org.ejml.data.DMatrixRMaj; -import org.ejml.dense.row.factory.DecompositionFactory_DDRM; -import org.ejml.simple.SimpleMatrix; import org.opencv.core.Mat; public class MathUtils { @@ -232,38 +227,4 @@ public static void rotationToOpencvRvec(Rotation3d rotation, Mat rvecOutput) { var axis = rotation.getAxis().times(angle); rvecOutput.put(0, 0, axis.getData()); } - - /** - * Orthogonalize an input matrix using a QR decomposition. QR decompositions decompose a - * rectangular matrix 'A' such that 'A=QR', where Q is the closest orthogonal matrix to the input, - * and R is an upper triangular matrix. - * - *

The following function is released under the BSD license avaliable in - * LICENSE_MathUtils_orthogonalizeRotationMatrix.txt. - */ - public static Matrix orthogonalizeRotationMatrix(Matrix input) { - var a = DecompositionFactory_DDRM.qr(3, 3); - if (!a.decompose(input.getStorage().getDDRM())) { - // best we can do is return the input - return input; - } - - // Grab results (thanks for this _great_ api, EJML) - var Q = new DMatrixRMaj(3, 3); - var R = new DMatrixRMaj(3, 3); - a.getQ(Q, false); - a.getR(R, false); - - // Fix signs in R if they're < 0 so it's close to an identity matrix - // (our QR decomposition implementation sometimes flips the signs of columns) - for (int colR = 0; colR < 3; ++colR) { - if (R.get(colR, colR) < 0) { - for (int rowQ = 0; rowQ < 3; ++rowQ) { - Q.set(rowQ, colR, -Q.get(rowQ, colR)); - } - } - } - - return new Matrix<>(new SimpleMatrix(Q)); - } }