mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-19 00:41:41 +00:00
50 lines
2.1 KiB
Python
50 lines
2.1 KiB
Python
###############################################################################
|
|
## Copyright (C) Photon Vision.
|
|
###############################################################################
|
|
## This program is free software: you can redistribute it and/or modify
|
|
## it under the terms of the GNU General Public License as published by
|
|
## the Free Software Foundation, either version 3 of the License, or
|
|
## (at your option) any later version.
|
|
##
|
|
## This program is distributed in the hope that it will be useful,
|
|
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
## GNU General Public License for more details.
|
|
##
|
|
## You should have received a copy of the GNU General Public License
|
|
## along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
###############################################################################
|
|
|
|
###############################################################################
|
|
## THIS FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py.
|
|
## --> DO NOT MODIFY <--
|
|
###############################################################################
|
|
|
|
from ..targeting import *
|
|
|
|
|
|
class PhotonPipelineResultSerde:
|
|
|
|
# Message definition md5sum. See photon_packet.adoc for details
|
|
MESSAGE_VERSION = "cb3e1605048ba49325888eb797399fe2"
|
|
MESSAGE_FORMAT = "PhotonPipelineMetadata metadata;PhotonTrackedTarget[?] targets;MultiTargetPNPResult? multiTagResult;"
|
|
|
|
@staticmethod
|
|
def unpack(packet: "Packet") -> "PhotonPipelineResult":
|
|
ret = PhotonPipelineResult()
|
|
|
|
# metadata is of non-intrinsic type PhotonPipelineMetadata
|
|
ret.metadata = PhotonPipelineMetadata.photonStruct.unpack(packet)
|
|
|
|
# targets is a custom VLA!
|
|
ret.targets = packet.decodeList(PhotonTrackedTarget.photonStruct)
|
|
|
|
# multiTagResult is optional! it better not be a VLA too
|
|
ret.multiTagResult = packet.decodeOptional(MultiTargetPNPResult.photonStruct)
|
|
|
|
return ret
|
|
|
|
|
|
# Hack ourselves into the base class
|
|
PhotonPipelineResult.photonStruct = PhotonPipelineResultSerde()
|