From ebac32cba60c411e49ea5c7f9267d333307613cb Mon Sep 17 00:00:00 2001 From: Sriman Achanta <68172138+srimanachanta@users.noreply.github.com> Date: Wed, 27 Dec 2023 10:38:41 -0500 Subject: [PATCH] Always encode transform (#1074) --- .../targeting/PhotonTrackedTarget.java | 23 +++++-------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/photon-targeting/src/main/java/org/photonvision/targeting/PhotonTrackedTarget.java b/photon-targeting/src/main/java/org/photonvision/targeting/PhotonTrackedTarget.java index 560fafd417..2a369a7292 100644 --- a/photon-targeting/src/main/java/org/photonvision/targeting/PhotonTrackedTarget.java +++ b/photon-targeting/src/main/java/org/photonvision/targeting/PhotonTrackedTarget.java @@ -227,11 +227,9 @@ public void pack(Packet packet, PhotonTrackedTarget value) { packet.encode(value.area); packet.encode(value.skew); packet.encode(value.fiducialId); - if (value.fiducialId != -1) { - PacketUtils.packTransform3d(packet, value.bestCameraToTarget); - PacketUtils.packTransform3d(packet, value.altCameraToTarget); - packet.encode(value.poseAmbiguity); - } + PacketUtils.packTransform3d(packet, value.bestCameraToTarget); + PacketUtils.packTransform3d(packet, value.altCameraToTarget); + packet.encode(value.poseAmbiguity); for (int i = 0; i < 4; i++) { TargetCorner.serde.pack(packet, value.minAreaRectCorners.get(i)); @@ -250,18 +248,9 @@ public PhotonTrackedTarget unpack(Packet packet) { var area = packet.decodeDouble(); var skew = packet.decodeDouble(); var fiducialId = packet.decodeInt(); - Transform3d best; - Transform3d alt; - double ambiguity; - if (fiducialId != -1.0) { - best = PacketUtils.unpackTransform3d(packet); - alt = PacketUtils.unpackTransform3d(packet); - ambiguity = packet.decodeDouble(); - } else { - best = new Transform3d(); - alt = new Transform3d(); - ambiguity = -1.0; - } + Transform3d best = PacketUtils.unpackTransform3d(packet); + Transform3d alt = PacketUtils.unpackTransform3d(packet); + double ambiguity = packet.decodeDouble(); var minAreaRectCorners = new ArrayList(4); for (int i = 0; i < 4; i++) {