Skip to content
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
0932e2d
WIP
samfreund Apr 4, 2026
8be1d7a
WIP 2, holy rotations batman
samfreund Apr 4, 2026
f770095
various fixed, including usage reporting
samfreund Apr 4, 2026
3ea21a9
more rotations
samfreund Apr 4, 2026
b5edb91
hpp not h ig
samfreund Apr 4, 2026
efb5091
remove unneeded import
samfreund Apr 4, 2026
6807212
I love removing deprecated stuff
samfreund Apr 4, 2026
4228608
remove another import [skip ci]
samfreund Apr 4, 2026
81d00d6
bump wpilibtools version
samfreund Apr 4, 2026
8929702
lint
samfreund Apr 4, 2026
4d60fab
bah ci
samfreund Apr 4, 2026
3e95528
fix some photon-lib stuff
samfreund Apr 4, 2026
665e34f
WIP
samfreund Apr 4, 2026
7d9148a
WIP 2
samfreund Apr 4, 2026
6528159
lint
samfreund Apr 4, 2026
2c88885
java 21
samfreund Apr 5, 2026
e1abf0c
update docker containers
samfreund Apr 5, 2026
e6f50e8
gradle 9
samfreund Apr 6, 2026
89aedf6
no more deprecated methods
samfreund Apr 6, 2026
9d5b55d
update versions
samfreund Apr 6, 2026
eed1fdc
gradle 9.2
samfreund Apr 6, 2026
f26551a
bump mrcal version cause transitive deps
samfreund Apr 8, 2026
9d662a8
versioning two boogaloo
samfreund Apr 8, 2026
29b7e62
lint
samfreund Apr 8, 2026
d123485
maybe fix stuff
samfreund Apr 8, 2026
ecf32ea
update some stuff for example projects
samfreund Apr 8, 2026
8039376
fix alert API
samfreund Apr 8, 2026
7f82ebb
bump native utils version
samfreund Apr 9, 2026
8e40c5a
add arm native smoketest to exercise nativelib corruption
samfreund Apr 9, 2026
f5b067e
bump examples to java 21
samfreund Apr 9, 2026
5e6a044
fix test
samfreund Apr 10, 2026
9073852
oops, order of operations is dumb
samfreund Apr 10, 2026
c0ddab5
change from aliases to levels
samfreund Apr 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 19 additions & 24 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,9 @@ jobs:
# fetch-depth: 0
# - name: Fetch tags
# run: git fetch --tags --force
# - name: Install Java 17
# uses: actions/setup-java@v5
# - uses: actions/setup-java@v5
# with:
# java-version: 17
# java-version: 21
# distribution: temurin
# - name: Install SystemCore Toolchain
# run: ./gradlew installSystemCoreToolchain
Expand Down Expand Up @@ -104,10 +103,9 @@ jobs:
fetch-depth: 0
- name: Fetch tags
run: git fetch --tags --force
- name: Install Java 17
uses: actions/setup-java@v5
- uses: actions/setup-java@v5
with:
java-version: 17
java-version: 21
distribution: temurin
- name: Install pnpm
uses: pnpm/action-setup@v5
Expand Down Expand Up @@ -145,10 +143,9 @@ jobs:
fetch-depth: 0
- name: Fetch tags
run: git fetch --tags --force
- name: Install Java 17
uses: actions/setup-java@v5
- uses: actions/setup-java@v5
with:
java-version: 17
java-version: 21
distribution: temurin
- name: Install pnpm
uses: pnpm/action-setup@v5
Expand Down Expand Up @@ -198,10 +195,9 @@ jobs:
with:
fetch-depth: 0

- name: Install Java 17
uses: actions/setup-java@v5
- uses: actions/setup-java@v5
with:
java-version: 17
java-version: 21
distribution: temurin

# grab all tags
Expand Down Expand Up @@ -240,10 +236,9 @@ jobs:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Install Java 17
uses: actions/setup-java@v5
- uses: actions/setup-java@v5
with:
java-version: 17
java-version: 21
distribution: temurin
- run: git fetch --tags --force
- run: ./gradlew photon-targeting:build photon-lib:build
Expand All @@ -265,13 +260,13 @@ jobs:
fail-fast: false
matrix:
include:
- container: wpilib/systemcore-cross-ubuntu:2025-24.04
- container: wpilib/systemcore-cross-ubuntu:2027-24.04
artifact-name: SystemCore
build-options: "-Ponlylinuxsystemcore"
- container: wpilib/raspbian-cross-ubuntu:bookworm-24.04
- container: wpilib/raspbian-cross-ubuntu:2027-bookworm-24.04
artifact-name: Raspbian
build-options: "-Ponlylinuxarm32"
- container: wpilib/aarch64-cross-ubuntu:bookworm-24.04
- container: wpilib/aarch64-cross-ubuntu:2027-bookworm-24.04
artifact-name: Aarch64
build-options: "-Ponlylinuxarm64"

Expand Down Expand Up @@ -347,10 +342,9 @@ jobs:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Install Java 17
uses: actions/setup-java@v5
- uses: actions/setup-java@v5
with:
java-version: 17
java-version: 21
distribution: temurin
- name: Install pnpm
uses: pnpm/action-setup@v5
Expand Down Expand Up @@ -431,15 +425,16 @@ jobs:
artifact-name: photonvision-*-winx64.jar
- os: macos-latest
artifact-name: photonvision-*-macarm64.jar
- os: ubuntu-24.04-arm
artifact-name: photonvision-*-linuxarm64.jar


runs-on: ${{ matrix.os }}

steps:
- name: Install Java 17
uses: actions/setup-java@v5
- uses: actions/setup-java@v5
with:
java-version: 17
java-version: 21
distribution: temurin
- uses: actions/download-artifact@v8
with:
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/dependency-submission.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v6
- name: Setup Java
uses: actions/setup-java@v5
- uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 17
java-version: 21
- name: Generate and submit dependency graph
uses: gradle/actions/dependency-submission@v5
2 changes: 1 addition & 1 deletion .github/workflows/lint-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-java@v5
with:
java-version: 17
java-version: 21
distribution: temurin
- run: |
set +e
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/photon-api-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,9 @@ jobs:
fetch-depth: 0
- name: Fetch tags
run: git fetch --tags --force
- name: Install Java 17
uses: actions/setup-java@v5
- uses: actions/setup-java@v5
with:
java-version: 17
java-version: 21
distribution: temurin
- name: Build javadocs/doxygen
run: |
Expand Down
21 changes: 13 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ plugins {
id "cpp"
id "com.diffplug.spotless" version "8.1.0"
id "org.wpilib.WPILibRepositoriesPlugin" version "2027.0.0"
id "org.wpilib.GradleRIO" version "2027.0.0-alpha-2"
id 'org.photonvision.tools.WpilibTools' version '2.4.1-photon'
id 'com.google.protobuf' version '0.9.3' apply false
id 'org.wpilib.NativeUtils' version '2027.4.1' apply false
id 'org.wpilib.DeployUtils' version '2027.1.0' apply false
id 'org.photonvision.tools.WpilibTools' version '3.0.0-photon'
id 'com.google.protobuf' version '0.9.5' apply false
id 'org.wpilib.GradleJni' version '2027.0.0'
id "org.ysb33r.doxygen" version "2.0.0" apply false
id 'com.gradleup.shadow' version '8.3.4' apply false
id 'com.gradleup.shadow' version '9.0.0' apply false
id "com.github.node-gradle.node" version "7.0.1" apply false
}

Expand All @@ -33,16 +34,20 @@ ext.allOutputsFolder = file("$project.buildDir/outputs")
apply from: "versioningHelper.gradle"

ext {
wpilibVersion = "2027.0.0-alpha-3-203-g0001ddc7e"
wpilibVersion = "2027.0.0-alpha-4"
wpimathVersion = wpilibVersion
openCVYear = "2025"
openCVversion = "4.10.0-3"
ejmlVersion = "0.43.1";
jacksonVersion = "2.15.2";
quickbufVersion = "1.3.3";

javalinVersion = "6.7.0"
libcameraDriverVersion = "v2026.0.0"
rknnVersion = "dev-v2026.0.1-1-g89b2888"
rubikVersion = "dev-v2026.0.1-4-g13d6279"
frcYear = "2027_alpha1"
mrcalVersion = "dev-v2026.0.0-1-g239d80e";
frcYear = "2027_alpha4"
mrcalVersion = "v2027.0.1";

pubVersion = versionString
isDev = pubVersion.startsWith("dev")
Expand Down Expand Up @@ -95,7 +100,7 @@ spotless {
}

wrapper {
gradleVersion = '8.14.3'
gradleVersion = '9.2.0'
}

ext.getCurrentArch = {
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=permwrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
4 changes: 2 additions & 2 deletions photon-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ext.licenseFile = file("$rootDir/LICENSE")
ext.externalLicensesFolder = file("$rootDir/ExternalLicenses")
apply from: "${rootDir}/shared/common.gradle"

wpilibTools.deps.wpilibVersion = wpi.versions.wpilibVersion.get()
wpilibTools.deps.wpilibVersion = wpilibVersion

def nativeConfigName = 'wpilibNatives'
configurations {
Expand All @@ -28,7 +28,7 @@ dependencies {
wpilibNatives wpilibTools.deps.wpilib("cscore")
wpilibNatives wpilibTools.deps.wpilib("apriltag")
wpilibNatives wpilibTools.deps.wpilib("hal")
wpilibNatives wpilibTools.deps.wpilibOpenCv("frc" + openCVYear, wpi.versions.opencvVersion.get())
wpilibNatives wpilibTools.deps.wpilibOpenCv("frc" + openCVYear, openCVversion)

// These stay as implementation dependencies since they don't have native code that gets packaged
implementation 'org.zeroturnaround:zt-zip:1.14'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
import org.photonvision.common.networking.NetworkUtils;
import org.photonvision.common.util.TimedTaskManager;
import org.photonvision.common.util.file.JacksonUtils;
import org.wpilib.driverstation.Alert;
import org.wpilib.driverstation.Alert.Level;
import org.wpilib.networktables.LogMessage;
import org.wpilib.networktables.MultiSubscriber;
import org.wpilib.networktables.NetworkTable;
Expand All @@ -43,8 +45,6 @@
import org.wpilib.networktables.NetworkTableInstance;
import org.wpilib.networktables.StringSubscriber;
import org.wpilib.smartdashboard.SmartDashboard;
import org.wpilib.util.Alert;
import org.wpilib.util.Alert.AlertType;
import org.wpilib.vision.apriltag.AprilTagFieldLayout;
import org.wpilib.vision.camera.CameraServerJNI;

Expand All @@ -66,9 +66,9 @@ public class NetworkTablesManager {
new MultiSubscriber(ntInstance, new String[] {kRootTableName + "/" + kCoprocTableName + "/"});

// Creating the alert up here since it should be persistent
private final Alert conflictAlert = new Alert("PhotonAlerts", "", AlertType.kWarning);
private final Alert conflictAlert = new Alert("PhotonAlerts", "", Level.WARNING);

private final Alert mismatchAlert = new Alert("PhotonAlerts", "", AlertType.kWarning);
private final Alert mismatchAlert = new Alert("PhotonAlerts", "", Level.WARNING);

public boolean conflictingHostname = false;
public String conflictingCameras = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import org.photonvision.common.logging.LogGroup;
import org.photonvision.common.logging.Logger;
import org.photonvision.common.util.ShellExec;
import org.photonvision.common.util.TimedTaskManager;
import org.wpilib.networktables.IntegerPublisher;
import org.wpilib.networktables.IntegerSubscriber;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,30 +35,8 @@
public class OsImageData {
private static final Logger logger = new Logger(OsImageData.class, LogGroup.General);

private static Path imageVersionFile = Path.of("/opt/photonvision/image-version");
private static Path imageMetadataFile = Path.of("/opt/photonvision/image-version.json");

/**
* The OS image version string, if available. This is legacy, use {@link ImageMetadata}.
* Deprecated for removal in 2027.
*/
@Deprecated public static final Optional<String> IMAGE_VERSION = getImageVersion();

private static Optional<String> getImageVersion() {
if (!imageVersionFile.toFile().exists()) {
logger.warn("Photon cannot locate base OS image version at " + imageVersionFile.toString());
return Optional.empty();
}

try {
return Optional.of(Files.readString(imageVersionFile).strip());
} catch (IOException e) {
logger.error("Couldn't read image-version file", e);
}

return Optional.empty();
}

public static final Optional<ImageMetadata> IMAGE_METADATA = getImageMetadata();

public static record ImageMetadata(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.photonvision.vision.calibration.CameraCalibrationCoefficients;
import org.photonvision.vision.pipeline.result.CVPipelineResult;
import org.photonvision.vision.target.TrackedTarget;
import org.wpilib.math.geometry.Rotation2d;
import org.wpilib.math.geometry.Translation2d;
import org.wpilib.math.util.Units;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.awt.Color;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.List;
Expand All @@ -29,6 +30,10 @@
import org.opencv.core.Mat;
import org.opencv.core.Point;
import org.opencv.core.Point3;
import org.opencv.core.Scalar;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.Imgproc;
import org.photonvision.common.util.ColorHelper;
import org.wpilib.math.geometry.Pose3d;

// Ignore the previous calibration data that was stored in the json file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.photonvision.jni.CscoreExtras;
import org.photonvision.vision.opencv.CVMat;
import org.photonvision.vision.processes.VisionSourceSettables;
import org.wpilib.networktables.BooleanSubscriber;
import org.wpilib.util.PixelFormat;
import org.wpilib.util.RawFrame;
import org.wpilib.vision.camera.CvSink;
Expand Down Expand Up @@ -81,7 +80,7 @@ public CapturedFrame getInputMat() {
if (m_blockForFrames) {
// We allocate memory so we don't fill a Mat in use by another thread (memory model is easier)
var mat = new CVMat();
// This is from wpi::util::Now, or WPIUtilJNI.now(). The epoch from grabFrame is uS since
// This is from wpi::nt::Now, or WPIUtilJNI.now(). The epoch from grabFrame is uS since
// Hal::initialize was called
// TODO - under the hood, this incurs an extra copy. We should avoid this, if we
// can.
Expand All @@ -106,7 +105,7 @@ public CapturedFrame getInputMat() {
cameraMode.width * 3,
PixelFormat.kBGR);

// This is from wpi::util::Now, or WPIUtilJNI.now(). The epoch from grabFrame is uS since
// This is from wpi::nt::Now, or WPIUtilJNI.now(). The epoch from grabFrame is uS since
// Hal::initialize was called
long captureTimeUs =
CscoreExtras.grabRawSinkFrameTimeoutLastTime(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ protected CVPipelineResult process(Frame frame, AprilTagPipelineSettings setting
camToTag =
new Transform3d(
camToTag.getTranslation(),
new Rotation3d(0, Math.PI, 0).plus(camToTag.getRotation()));
new Rotation3d(0, Math.PI, 0).rotateBy(camToTag.getRotation()));
tagPoseEstimate = new AprilTagPoseEstimate(camToTag, camToTag, 0, 0);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void release() {
}

/**
* Get the latency between now (wpi::util::Now) and the time at which the image was captured.
* Get the latency between now (wpi::nt::Now) and the time at which the image was captured.
* FOOTGUN: the latency is relative to the time at which this method is called. Waiting to call
* this method will change the latency this method returns.
*/
Expand Down
2 changes: 1 addition & 1 deletion photon-docs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ task generateJavaDocs(type: Javadoc) {
source exportedProjects.collect { project(it).sourceSets.main.allJava }
classpath = files(exportedProjects.collect { project(it).sourceSets.main.compileClasspath })

options.links "https://docs.oracle.com/en/java/javase/17/docs/api/", "https://github.wpilib.org/allwpilib/docs/release/java/"
options.links "https://docs.oracle.com/en/java/javase/21/docs/api/", "https://github.wpilib.org/allwpilib/docs/release/java/"
options.addStringOption("tag", "pre:a:Pre-Condition")
options.addBooleanOption("Xdoclint:html,missing,reference,syntax", true)
options.addBooleanOption('html5', true)
Expand Down
4 changes: 2 additions & 2 deletions photon-lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ publishing {
}

// setup wpilib bundled native libs
wpilibTools.deps.wpilibVersion = wpi.versions.wpilibVersion.get()
wpilibTools.deps.wpilibVersion = wpilibVersion

def nativeConfigName = 'wpilibNatives'
def nativeConfig = configurations.create(nativeConfigName)
Expand All @@ -375,4 +375,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" + openCVYear, wpi.versions.opencvVersion.get())
nativeConfig.dependencies.add wpilibTools.deps.wpilibOpenCv("frc" + openCVYear, openCVversion)
Loading
Loading