mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-20 00:51:41 +00:00
Update cameraRunnable fps with video mode change
This commit is contained in:
@@ -4,7 +4,7 @@ package com.chameleonvision.util;
|
||||
* A thread that tries to run at a specified loop time
|
||||
*/
|
||||
public abstract class LoopingRunnable implements Runnable {
|
||||
private final Long loopTimeMs;
|
||||
protected volatile Long loopTimeMs;
|
||||
|
||||
protected abstract void process();
|
||||
|
||||
|
||||
@@ -61,8 +61,7 @@ public class VisionProcess {
|
||||
|
||||
// Thread to grab frames from the camera
|
||||
// TODO: (HIGH) fix video modes!!!
|
||||
// TODO: (HIGH) FIX FPS!!!!!!!
|
||||
this.cameraRunnable = new CameraFrameRunnable(cameraProcess.getProperties().videoModes.get(0).fps);
|
||||
this.cameraRunnable = new CameraFrameRunnable(cameraProcess.getProperties().videoModes.get(0).f ps);
|
||||
|
||||
lastPipelineResult = new DriverVisionPipeline.DriverPipelineResult(
|
||||
null, cameraRunnable.getFrame(new Mat()), 0
|
||||
@@ -229,6 +228,7 @@ public class VisionProcess {
|
||||
|
||||
public void setVideoMode(VideoMode newMode) {
|
||||
cameraProcess.setVideoMode(newMode);
|
||||
cameraRunnable.updateCameraFPS(newMode.fps);
|
||||
cameraStreamer.setNewVideoMode(newMode);
|
||||
}
|
||||
|
||||
@@ -290,6 +290,10 @@ public class VisionProcess {
|
||||
super(1000L/(cameraFPS + 2));
|
||||
}
|
||||
|
||||
void updateCameraFPS(int newFPS) {
|
||||
super.loopTimeMs = 1000L / (newFPS + 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
System.out.println("running camera grabber process");
|
||||
|
||||
Reference in New Issue
Block a user