mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-24 01:31:44 +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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user