mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-20 00:51:41 +00:00
Add NT controlled framerate limiter (#2257)
Adds a method to lower the speed of a pipeline over NT, primarily to reduce power consumption.
This commit is contained in:
@@ -53,6 +53,9 @@ public class NTTopicSet {
|
||||
public BooleanPublisher driverModePublisher;
|
||||
public BooleanSubscriber driverModeSubscriber;
|
||||
|
||||
public IntegerPublisher fpsLimitPublisher;
|
||||
public IntegerSubscriber fpsLimitSubscriber;
|
||||
|
||||
public DoublePublisher latencyMillisEntry;
|
||||
public DoublePublisher fpsEntry;
|
||||
public BooleanPublisher hasTargetEntry;
|
||||
@@ -100,6 +103,11 @@ public class NTTopicSet {
|
||||
// Fun little hack to make the request show up
|
||||
driverModeSubscriber.getTopic().publish().setDefault(false);
|
||||
|
||||
fpsLimitPublisher = subTable.getIntegerTopic("fpsLimit").publish();
|
||||
fpsLimitSubscriber = subTable.getIntegerTopic("fpsLimitRequest").subscribe(-1);
|
||||
|
||||
fpsLimitSubscriber.getTopic().publish().setDefault(-1);
|
||||
|
||||
latencyMillisEntry = subTable.getDoubleTopic("latencyMillis").publish();
|
||||
fpsEntry = subTable.getDoubleTopic("fps").publish();
|
||||
hasTargetEntry = subTable.getBooleanTopic("hasTarget").publish();
|
||||
@@ -129,6 +137,9 @@ public class NTTopicSet {
|
||||
if (driverModePublisher != null) driverModePublisher.close();
|
||||
if (driverModeSubscriber != null) driverModeSubscriber.close();
|
||||
|
||||
if (fpsLimitPublisher != null) fpsLimitPublisher.close();
|
||||
if (fpsLimitSubscriber != null) fpsLimitSubscriber.close();
|
||||
|
||||
if (latencyMillisEntry != null) latencyMillisEntry.close();
|
||||
if (fpsEntry != null) fpsEntry.close();
|
||||
if (hasTargetEntry != null) hasTargetEntry.close();
|
||||
|
||||
Reference in New Issue
Block a user