|
| 1 | +/* |
| 2 | + * Copyright (C) Photon Vision. |
| 3 | + * |
| 4 | + * This program is free software: you can redistribute it and/or modify |
| 5 | + * it under the terms of the GNU General Public License as published by |
| 6 | + * the Free Software Foundation, either version 3 of the License, or |
| 7 | + * (at your option) any later version. |
| 8 | + * |
| 9 | + * This program is distributed in the hope that it will be useful, |
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | + * GNU General Public License for more details. |
| 13 | + * |
| 14 | + * You should have received a copy of the GNU General Public License |
| 15 | + * along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 16 | + */ |
| 17 | + |
| 18 | +package org.photonvision.vision.camera.USBCameras; |
| 19 | + |
| 20 | +import edu.wpi.first.cscore.UsbCamera; |
| 21 | +import org.photonvision.common.configuration.CameraConfiguration; |
| 22 | + |
| 23 | +public class NewCamSettables extends GenericUSBCameraSettables { |
| 24 | + public NewCamSettables(CameraConfiguration configuration, UsbCamera camera) { |
| 25 | + super(configuration, camera); |
| 26 | + } |
| 27 | + |
| 28 | + // @Override |
| 29 | + // protected void setUpExposureProperties() { |
| 30 | + // super.setUpExposureProperties(); |
| 31 | + |
| 32 | + // if (exposureAbsProp != null) { |
| 33 | + // logger.debug("Exposure property: name=" + exposureAbsProp.getName() |
| 34 | + // + " min=" + exposureAbsProp.getMin() |
| 35 | + // + " max=" + exposureAbsProp.getMax()); |
| 36 | + // } else { |
| 37 | + // logger.warn("No exposure property found!"); |
| 38 | + // } |
| 39 | + // if (autoExposureProp != null) { |
| 40 | + // logger.debug("Auto-exposure property: name=" + autoExposureProp.getName() |
| 41 | + // + " min=" + autoExposureProp.getMin() |
| 42 | + // + " max=" + autoExposureProp.getMax()); |
| 43 | + // } |
| 44 | + |
| 45 | + // this.minExposure = 1; |
| 46 | + // this.maxExposure = 300; |
| 47 | + // } |
| 48 | + |
| 49 | + @Override |
| 50 | + protected void setUpExposureProperties() { |
| 51 | + autoExposureProp = findProperty("exposure_auto", "auto_exposure").get(); |
| 52 | + exposureAbsProp = findProperty("raw_exposure_time_absolute", "raw_exposure_absolute").get(); |
| 53 | + |
| 54 | + this.minExposure = exposureAbsProp.getMin(); |
| 55 | + this.maxExposure = exposureAbsProp.getMax(); |
| 56 | + } |
| 57 | + |
| 58 | + @Override |
| 59 | + public void setAllCamDefaults() { |
| 60 | + super.setAllCamDefaults(); |
| 61 | + logger.info("Setting All Cam Defaults :: NewCam"); |
| 62 | + softSet("focus_automatic_continuous", 0); |
| 63 | + softSet("focus_absolute", 0); |
| 64 | + |
| 65 | + softSet("power_line_frequency", 2); // Assume 60Hz USA |
| 66 | + softSet("exposure_metering_mode", 0); |
| 67 | + softSet("exposure_dynamic_framerate", 0); |
| 68 | + } |
| 69 | + |
| 70 | + @Override |
| 71 | + public void setAutoExposureImpl(boolean cameraAutoExposure) { |
| 72 | + logger.info("Setting Auto Exposure :: NewCam"); |
| 73 | + // softSet("focus_automatic_continuous", 0); |
| 74 | + super.setAutoExposureImpl(cameraAutoExposure); |
| 75 | + // softSet("focus_absolute", 0); |
| 76 | + } |
| 77 | + |
| 78 | + @Override |
| 79 | + public void setExposureRaw(double exposureRaw) { |
| 80 | + logger.info("NewCamSettables.setExposureRaw called with " + exposureRaw); |
| 81 | + // softSet("focus_automatic_continuous", 0); |
| 82 | + super.setExposureRaw(exposureRaw); |
| 83 | + // softSet("focus_automatic_continuous", 0); |
| 84 | + // softSet("focus_absolute", 0); |
| 85 | + } |
| 86 | +} |
0 commit comments