From 66b82bdc45635c54cd541ce57203b3758ea2e40e Mon Sep 17 00:00:00 2001 From: Chris Date: Sun, 23 Jun 2024 20:13:49 -0500 Subject: [PATCH 01/34] wip - tied to libcamera PR to remove some of the hacks associated with libipcam --- .../vision/camera/LibcameraGpuSettables.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/photon-core/src/main/java/org/photonvision/vision/camera/LibcameraGpuSettables.java b/photon-core/src/main/java/org/photonvision/vision/camera/LibcameraGpuSettables.java index 81cfd75823..7a44b4902c 100644 --- a/photon-core/src/main/java/org/photonvision/vision/camera/LibcameraGpuSettables.java +++ b/photon-core/src/main/java/org/photonvision/vision/camera/LibcameraGpuSettables.java @@ -125,21 +125,17 @@ public void setExposure(double exposure) { // Minimum exposure can't be below 1uS cause otherwise it would be 0 and 0 is auto exposure. double minExposure = 1; + double maxExposure = 80000; + - // HACKS! - // If we set exposure too low, libcamera crashes or slows down - // Very weird and smelly - // For now, band-aid this by just not setting it lower than the "it breaks" limit - // is different depending on camera. - // All units are uS. if (sensorModel == LibCameraJNI.SensorModel.OV9281) { - minExposure = 4800; + minExposure = 7; } else if (sensorModel == LibCameraJNI.SensorModel.OV5647) { minExposure = 560; } // 80,000 uS seems like an exposure value that will be greater than ever needed while giving // enough control over exposure. - exposure = MathUtils.map(exposure, 0, 100, minExposure, 80000); + exposure = MathUtils.map(exposure, 0, 100, minExposure, maxExposure); var success = LibCameraJNI.setExposure(r_ptr, (int) exposure); if (!success) LibcameraGpuSource.logger.warn("Couldn't set Pi Camera exposure"); From 9c0a32243e6ba46eeef8e23f80c7e85f88637567 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 25 Jun 2024 21:58:10 -0500 Subject: [PATCH 02/34] WIP changing all camera settings to be absolute time --- .../cameras/CameraCalibrationCard.vue | 14 +- .../components/dashboard/tabs/InputTab.vue | 14 +- photon-client/src/types/PipelineTypes.ts | 14 +- .../common/util/math/MathUtils.java | 10 + .../raspi/LibCameraJNILoader.java | 27 +- .../vision/camera/FileVisionSource.java | 2 +- .../vision/camera/LibcameraGpuSettables.java | 13 +- .../vision/camera/USBCameraSource.java | 364 ++++++++---------- .../pipeline/AprilTagPipelineSettings.java | 2 +- .../pipeline/ArucoPipelineSettings.java | 2 +- .../vision/pipeline/CVPipelineSettings.java | 10 +- .../ColoredShapePipelineSettings.java | 2 +- .../ObjectDetectionPipelineSettings.java | 2 +- .../pipeline/ReflectivePipelineSettings.java | 2 +- .../vision/processes/VisionModule.java | 6 +- .../processes/VisionSourceSettables.java | 2 +- .../processes/VisionModuleManagerTest.java | 2 +- .../src/main/resources/web/index.html | 16 +- 18 files changed, 235 insertions(+), 269 deletions(-) diff --git a/photon-client/src/components/cameras/CameraCalibrationCard.vue b/photon-client/src/components/cameras/CameraCalibrationCard.vue index c24cb4dbe7..f217462640 100644 --- a/photon-client/src/components/cameras/CameraCalibrationCard.vue +++ b/photon-client/src/components/cameras/CameraCalibrationCard.vue @@ -389,15 +389,15 @@ const setSelectedVideoFormat = (format: VideoFormat) => {