mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-22 01:11:40 +00:00
Compare commits
2 Commits
v2021.1.1-
...
v2021.1.2-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b2d939b3b5 | ||
|
|
f7e29a1992 |
@@ -174,7 +174,7 @@ public class CornerDetectionPipe
|
||||
// and maximize their distance from the center of the min area rectangle
|
||||
var leftList = new ArrayList<Point>();
|
||||
var rightList = new ArrayList<Point>();
|
||||
var averageXCoordinate = 0;
|
||||
double averageXCoordinate = 0.0;
|
||||
for (var p : pointList) {
|
||||
averageXCoordinate += p.x;
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ public class VisionModule {
|
||||
}
|
||||
|
||||
// Configure LED's if supported by the underlying hardware
|
||||
if (HardwareManager.getInstance().visionLED != null) {
|
||||
if (HardwareManager.getInstance().visionLED != null && this.camShouldControlLEDs()) {
|
||||
HardwareManager.getInstance()
|
||||
.visionLED
|
||||
.setPipelineModeSupplier(() -> pipelineManager.getCurrentPipelineSettings().ledMode);
|
||||
@@ -277,7 +277,7 @@ public class VisionModule {
|
||||
|
||||
void setDriverMode(boolean isDriverMode) {
|
||||
pipelineManager.setDriverMode(isDriverMode);
|
||||
if (isVendorCamera()) setVisionLEDs(!isDriverMode);
|
||||
setVisionLEDs(!isDriverMode);
|
||||
saveAndBroadcastAll();
|
||||
}
|
||||
|
||||
@@ -375,14 +375,21 @@ public class VisionModule {
|
||||
visionSource.getSettables().setGain(Math.max(0, config.cameraGain));
|
||||
}
|
||||
|
||||
if (isVendorCamera()) setVisionLEDs(config.ledMode);
|
||||
setVisionLEDs(config.ledMode);
|
||||
|
||||
visionSource.getSettables().getConfiguration().currentPipelineIndex =
|
||||
pipelineManager.getCurrentPipelineIndex();
|
||||
}
|
||||
|
||||
private boolean camShouldControlLEDs() {
|
||||
// Heuristic - if the camera has a known FOV or is a piCam, assume it's in use for
|
||||
// vision processing, and should command stuff to the LED's.
|
||||
// TODO: Make LED control a property of the camera itself and controllable in the UI.
|
||||
return isVendorCamera() || cameraQuirks.hasQuirk(CameraQuirk.PiCam);
|
||||
}
|
||||
|
||||
private void setVisionLEDs(boolean on) {
|
||||
if (HardwareManager.getInstance().visionLED != null)
|
||||
if (camShouldControlLEDs() && HardwareManager.getInstance().visionLED != null)
|
||||
HardwareManager.getInstance().visionLED.setState(on);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user