mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-20 00:51:41 +00:00
I found these with a quick find-and-replace and checked against the inbuilt Python type checking. I am away from my robot and can't really confirm there are no flow-on effects. There are no other active usages of the bad casing in the Python code, so we should be good. The generated serde messages already use this casing, so we don't need to update there.
35 lines
1006 B
Python
35 lines
1006 B
Python
from dataclasses import dataclass, field
|
|
from wpimath.geometry import Transform3d
|
|
from ..packet import Packet
|
|
|
|
|
|
@dataclass
|
|
class PnpResult:
|
|
best: Transform3d = field(default_factory=Transform3d)
|
|
alt: Transform3d = field(default_factory=Transform3d)
|
|
ambiguity: float = 0.0
|
|
bestReprojErr: float = 0.0
|
|
altReprojErr: float = 0.0
|
|
|
|
photonStruct: "PNPResultSerde" = None
|
|
|
|
|
|
@dataclass
|
|
class MultiTargetPNPResult:
|
|
_MAX_IDS = 32
|
|
|
|
estimatedPose: PnpResult = field(default_factory=PnpResult)
|
|
fiducialIDsUsed: list[int] = field(default_factory=list)
|
|
|
|
def createFromPacket(self, packet: Packet) -> Packet:
|
|
self.estimatedPose = PnpResult()
|
|
self.estimatedPose.createFromPacket(packet)
|
|
self.fiducialIDsUsed = []
|
|
for _ in range(MultiTargetPNPResult._MAX_IDS):
|
|
fidId = packet.decode16()
|
|
if fidId >= 0:
|
|
self.fiducialIDsUsed.append(fidId)
|
|
return packet
|
|
|
|
photonStruct: "MultiTargetPNPResultSerde" = None
|