Skip to content

Commit

Permalink
Always encode transform (#1074)
Browse files Browse the repository at this point in the history
  • Loading branch information
srimanachanta authored Dec 27, 2023
1 parent 0b98f02 commit ebac32c
Showing 1 changed file with 6 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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<TargetCorner>(4);
for (int i = 0; i < 4; i++) {
Expand Down

0 comments on commit ebac32c

Please sign in to comment.