From 55b22a84dd5f280890db96b70f26977c5915ea63 Mon Sep 17 00:00:00 2001 From: Matt Morley Date: Sun, 18 Aug 2024 08:32:02 -0700 Subject: [PATCH] Update photon-lib tests? --- .../simulation/PhotonCameraSim.java | 3 +- .../main/native/cpp/photon/PhotonCamera.cpp | 34 ------------------- 2 files changed, 2 insertions(+), 35 deletions(-) diff --git a/photon-lib/src/main/java/org/photonvision/simulation/PhotonCameraSim.java b/photon-lib/src/main/java/org/photonvision/simulation/PhotonCameraSim.java index 490c2bd113..1951ec78af 100644 --- a/photon-lib/src/main/java/org/photonvision/simulation/PhotonCameraSim.java +++ b/photon-lib/src/main/java/org/photonvision/simulation/PhotonCameraSim.java @@ -579,7 +579,8 @@ public void submitProcessedFrame(PhotonPipelineResult result) { public void submitProcessedFrame(PhotonPipelineResult result, long receiveTimestamp) { ts.latencyMillisEntry.set(result.metadata.getLatencyMillis(), receiveTimestamp); - ts.resultPublisher.set(result, result.getPacketSize()); + // Results are now dynamically sized, so let's guess 1024 bytes is big enough + ts.resultPublisher.set(result, 1024); boolean hasTargets = result.hasTargets(); ts.hasTargetEntry.set(hasTargets, receiveTimestamp); diff --git a/photon-lib/src/main/native/cpp/photon/PhotonCamera.cpp b/photon-lib/src/main/native/cpp/photon/PhotonCamera.cpp index 17d0486fb8..281df4b743 100644 --- a/photon-lib/src/main/native/cpp/photon/PhotonCamera.cpp +++ b/photon-lib/src/main/native/cpp/photon/PhotonCamera.cpp @@ -174,40 +174,6 @@ std::vector PhotonCamera::GetAllUnreadResults() { return ret; } -std::vector PhotonCamera::GetAllUnreadResults() { - if (test) { - return testResult; - } - - // Prints warning if not connected - VerifyVersion(); - - const auto changes = rawBytesEntry.ReadQueue(); - - // Create the new result list -- these will be updated in-place - std::vector ret(changes.size()); - - for (size_t i = 0; i < changes.size(); i++) { - const nt::Timestamped>& value = changes[i]; - - if (!value.value.size() || value.time == 0) { - continue; - } - - // Fill the packet with latest data and populate result. - photon::Packet packet{value.value}; - - PhotonPipelineResult& result = ret[i]; - packet >> result; - // TODO: NT4 timestamps are still not to be trusted. But it's the best we - // can do until we can make time sync more reliable. - result.SetRecieveTimestamp(units::microsecond_t(value.time) - - result.GetLatency()); - } - - return ret; -} - void PhotonCamera::SetDriverMode(bool driverMode) { driverModePublisher.Set(driverMode); }