Remove PhotonJNICommon in favor of CombinedRuntimeLoader (#2223)

## Description

PhotonJNICommon is just our implementation of combined runtime loader,
which we don't really need. This removes it and just uses
CombinedRuntimeLoader directly. This also fixes the issues introduced in
#2219, which lead to some of our JNIs not loading.

## Meta

Merge checklist:
- [x] Pull Request title is [short, imperative
summary](https://cbea.ms/git-commit/) of proposed changes
- [x] The description documents the _what_ and _why_
- [ ] If this PR changes behavior or adds a feature, user documentation
is updated
- [ ] If this PR touches photon-serde, all messages have been
regenerated and hashes have not changed unexpectedly
- [ ] If this PR touches configuration, this is backwards compatible
with settings back to v2025.3.2
- [ ] If this PR touches pipeline settings or anything related to data
exchange, the frontend typing is updated
- [x] If this PR addresses a bug, a regression test for it is added

---------

Co-authored-by: Matt M <matthew.morley.ca@gmail.com>
This commit is contained in:
Sam Freund
2025-12-09 02:39:41 -06:00
committed by GitHub
parent 0c4c310c66
commit 1bb05a0e3e
37 changed files with 169 additions and 388 deletions

View File

@@ -23,6 +23,7 @@ import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.cli.*;
import org.photonvision.common.LoadJNI;
import org.photonvision.common.configuration.CameraConfiguration;
import org.photonvision.common.configuration.ConfigManager;
import org.photonvision.common.configuration.NeuralNetworkModelManager;
@@ -38,9 +39,6 @@ import org.photonvision.common.logging.Logger;
import org.photonvision.common.logging.PvCSCoreLogger;
import org.photonvision.common.networking.NetworkManager;
import org.photonvision.common.util.TestUtils;
import org.photonvision.jni.RknnDetectorJNI;
import org.photonvision.jni.RubikDetectorJNI;
import org.photonvision.raspi.LibCameraJNILoader;
import org.photonvision.server.Server;
import org.photonvision.vision.apriltag.AprilTagFamily;
import org.photonvision.vision.camera.PVCameraInfo;
@@ -194,7 +192,7 @@ public class Main {
}
try {
boolean success = TestUtils.loadLibraries();
boolean success = LoadJNI.loadLibraries();
if (!success) {
logger.error("Failed to load native libraries! Giving up :(");
@@ -213,41 +211,35 @@ public class Main {
try {
if (Platform.isRaspberryPi()) {
LibCameraJNILoader.forceLoad();
LoadJNI.forceLoad(LoadJNI.JNITypes.LIBCAMERA);
logger.info("Loaded libcamera-JNI");
}
} catch (IOException e) {
logger.error("Failed to load libcamera-JNI!", e);
}
try {
if (Platform.isRK3588()) {
RknnDetectorJNI.forceLoad();
if (RknnDetectorJNI.getInstance().isLoaded()) {
logger.info("RknnDetectorJNI loaded successfully.");
} else {
logger.error("Failed to load RknnDetectorJNI!");
}
LoadJNI.forceLoad(LoadJNI.JNITypes.RKNN_DETECTOR);
logger.info("Loaded RKNN-JNI");
} else {
logger.error("Platform does not support RKNN based machine learning!");
}
} catch (IOException e) {
logger.error("Failed to load rknn-JNI!", e);
logger.error("Failed to load RKNN-JNI!", e);
}
try {
if (Platform.isQCS6490()) {
RubikDetectorJNI.forceLoad();
if (RubikDetectorJNI.getInstance().isLoaded()) {
logger.info("RubikDetectorJNI loaded successfully.");
} else {
logger.error("Failed to load RubikDetectorJNI!");
}
LoadJNI.forceLoad(LoadJNI.JNITypes.RUBIK_DETECTOR);
logger.info("Loaded Rubik-JNI");
} else {
logger.error("Platform does not support Rubik based machine learning!");
}
} catch (IOException e) {
logger.error("Failed to load rubik-JNI!", e);
logger.error("Failed to load Rubik-JNI!", e);
}
try {
TestUtils.loadMrcal();
LoadJNI.forceLoad(LoadJNI.JNITypes.MRCAL);
logger.info("mrcal-JNI loaded successfully.");
} catch (Exception e) {
logger.warn(
"Failed to load mrcal-JNI! Camera calibration will fall back to opencv\n"