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:
Sam Freund
2025-12-29 23:01:10 -06:00
committed by GitHub
parent fddff5dbca
commit 80d3efe00e
16 changed files with 234 additions and 15 deletions

View File

@@ -74,6 +74,12 @@ class PhotonCamera:
self._driverModeSubscriber = self._cameraTable.getBooleanTopic(
"driverMode"
).subscribe(False)
self._fpsLimitPublisher = self._cameraTable.getIntegerTopic(
"fpsLimitRequest"
).publish()
self._fpsLimitSubscriber = self._cameraTable.getIntegerTopic(
"fpsLimit"
).subscribe(-1)
self._inputSaveImgEntry = self._cameraTable.getIntegerTopic(
"inputSaveImgCmd"
).getEntry(0)
@@ -190,6 +196,22 @@ class PhotonCamera:
self._driverModePublisher.set(driverMode)
def getFPSLimit(self) -> int:
"""Returns the current FPS limit set on the camera.
:returns: The current FPS limit.
"""
return self._fpsLimitSubscriber.get()
def setFPSLimit(self, fpsLimit: int) -> None:
"""Sets the FPS limit on the camera.
:param fpsLimit: The FPS limit to set. Set to -1 for unlimited FPS.
"""
self._fpsLimitPublisher.set(fpsLimit)
def takeInputSnapshot(self) -> None:
"""Request the camera to save a new image file from the input camera stream with overlays. Images
take up space in the filesystem of the PhotonCamera. Calling it frequently will fill up disk