mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-27 02:01:40 +00:00
Fix usage reporting. (#1964)
## Description Fixes the amount of cameras and pose estimators reported by usage reporting. ## Meta Merge checklist: - [x] Pull Request title is [short, imperative summary](https://cbea.ms/git-commit/) of proposed changes - [x] The description documents the _what_ and _why_ - [ ] If this PR changes behavior or adds a feature, user documentation is updated - [ ] If this PR touches photon-serde, all messages have been regenerated and hashes have not changed unexpectedly - [ ] If this PR touches configuration, this is backwards compatible with settings back to v2024.3.1 - [ ] If this PR touches pipeline settings or anything related to data exchange, the frontend typing is updated - [ ] If this PR addresses a bug, a regression test for it is added --------- Signed-off-by: Jade Turner <spacey-sooty@proton.me>
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
from enum import Enum
|
||||
from typing import List
|
||||
|
||||
import hal
|
||||
import ntcore
|
||||
|
||||
# magical import to make serde stuff work
|
||||
@@ -48,6 +49,8 @@ def setVersionCheckEnabled(enabled: bool):
|
||||
|
||||
|
||||
class PhotonCamera:
|
||||
instance_count = 1
|
||||
|
||||
def __init__(self, cameraName: str):
|
||||
"""Constructs a PhotonCamera from the name of the camera.
|
||||
|
||||
@@ -108,6 +111,13 @@ class PhotonCamera:
|
||||
# Start the time sync server
|
||||
inst.start()
|
||||
|
||||
# Usage reporting
|
||||
hal.report(
|
||||
hal.tResourceType.kResourceType_PhotonCamera.value,
|
||||
PhotonCamera.instance_count,
|
||||
)
|
||||
PhotonCamera.instance_count += 1
|
||||
|
||||
def getAllUnreadResults(self) -> List[PhotonPipelineResult]:
|
||||
"""
|
||||
The list of pipeline results sent by PhotonVision since the last call to getAllUnreadResults().
|
||||
|
||||
Reference in New Issue
Block a user