Fix PhotonCamera typestring checks (#1480)

Previously NT would quietly drop readQueue changes.
This commit is contained in:
Matt
2024-10-20 22:21:24 -07:00
committed by GitHub
parent 7224561b76
commit 7da2ec1948
7 changed files with 50 additions and 19 deletions

View File

@@ -53,7 +53,9 @@ class PhotonCamera:
self._cameraTable = photonvision_root_table.getSubTable(cameraName)
self._path = self._cameraTable.getPath()
self._rawBytesEntry = self._cameraTable.getRawTopic("rawBytes").subscribe(
"rawBytes", bytes([]), ntcore.PubSubOptions(periodic=0.01, sendAll=True)
f"photonstruct:PhotonPipelineResult:{PhotonPipelineResult.photonStruct.MESSAGE_VERSION}",
bytes([]),
ntcore.PubSubOptions(periodic=0.01, sendAll=True),
)
self._driverModePublisher = self._cameraTable.getBooleanTopic(
@@ -226,6 +228,7 @@ class PhotonCamera:
versionString = self.versionEntry.get(defaultValue="")
localUUID = PhotonPipelineResult.photonStruct.MESSAGE_VERSION
remoteUUID = self._rawBytesEntry.getTopic().getProperty("message_uuid")
if remoteUUID is None or len(remoteUUID) == 0:
@@ -233,7 +236,11 @@ class PhotonCamera:
f"PhotonVision coprocessor at path {self._path} has not reported a message interface UUID - is your coprocessor's camera started?",
True,
)
elif localUUID != remoteUUID:
# ntcore hands us a JSON string with leading/trailing quotes - remove those
remoteUUID = remoteUUID.replace('"', "")
if localUUID != remoteUUID:
# Verified version mismatch
bfw = """