mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-24 01:31:44 +00:00
generate packing for python messages (#1535)
Generate packet serialization in Python, too.
This commit is contained in:
@@ -21,14 +21,25 @@
|
||||
###############################################################################
|
||||
|
||||
from ..targeting import *
|
||||
from ..packet import Packet
|
||||
|
||||
|
||||
class MultiTargetPNPResultSerde:
|
||||
|
||||
# Message definition md5sum. See photon_packet.adoc for details
|
||||
MESSAGE_VERSION = "541096947e9f3ca2d3f425ff7b04aa7b"
|
||||
MESSAGE_FORMAT = "PnpResult:ae4d655c0a3104d88df4f5db144c1e86 estimatedPose;int16 fiducialIDsUsed[?];"
|
||||
|
||||
@staticmethod
|
||||
def pack(value: "MultiTargetPNPResult") -> "Packet":
|
||||
ret = Packet()
|
||||
|
||||
# estimatedPose is of non-intrinsic type PnpResult
|
||||
ret.encodeBytes(PnpResult.photonStruct.pack(value.estimatedPose).getData())
|
||||
|
||||
# fiducialIDsUsed is a custom VLA!
|
||||
ret.encodeShortList(value.fiducialIDsUsed)
|
||||
return ret
|
||||
|
||||
@staticmethod
|
||||
def unpack(packet: "Packet") -> "MultiTargetPNPResult":
|
||||
ret = MultiTargetPNPResult()
|
||||
|
||||
Reference in New Issue
Block a user