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