mirror of
https://github.com/PhotonVision/photonvision
synced 2026-07-03 03:01:40 +00:00
Make 2027 build (#2422)
This PR updates everything for 2027. This includes removing GradleRIO, simplifying our wpilib version defintion, updating APIs, updating to Java 21, and more. Note that photonlibpy is failing because robotpy has not been fully updated yet. Examples are omitted because they need to be updated for our new PhotonPoseEstimator API and still need some changes from WPILIB. photonlib windows build is failing because we're waiting for some upstream changes. Finally, images are failing since they don't have Java 21 yet.
This commit is contained in:
@@ -35,6 +35,8 @@ import org.photonvision.common.logging.Logger;
|
||||
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;
|
||||
@@ -43,8 +45,6 @@ import org.wpilib.networktables.NetworkTableEvent.Kind;
|
||||
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;
|
||||
|
||||
@@ -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.MEDIUM);
|
||||
|
||||
private final Alert mismatchAlert = new Alert("PhotonAlerts", "", AlertType.kWarning);
|
||||
private final Alert mismatchAlert = new Alert("PhotonAlerts", "", Level.MEDIUM);
|
||||
|
||||
public boolean conflictingHostname = false;
|
||||
public String conflictingCameras = "";
|
||||
|
||||
@@ -36,7 +36,6 @@ import org.photonvision.common.hardware.gpio.CustomDeviceFactory;
|
||||
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;
|
||||
|
||||
|
||||
@@ -35,30 +35,8 @@ import org.photonvision.common.logging.Logger;
|
||||
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(
|
||||
|
||||
@@ -28,6 +28,7 @@ import org.opencv.highgui.HighGui;
|
||||
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;
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
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;
|
||||
@@ -29,6 +30,10 @@ import org.opencv.core.Core;
|
||||
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.
|
||||
|
||||
@@ -23,7 +23,6 @@ import org.photonvision.common.logging.Logger;
|
||||
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;
|
||||
@@ -81,7 +80,7 @@ public class USBFrameProvider extends CpuImageProcessor {
|
||||
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.
|
||||
@@ -106,7 +105,7 @@ public class USBFrameProvider extends CpuImageProcessor {
|
||||
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(
|
||||
|
||||
@@ -209,7 +209,7 @@ public class AprilTagPipeline extends CVPipeline<CVPipelineResult, AprilTagPipel
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ public class CVPipelineResult implements Releasable {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user