Skip to content

Commit

Permalink
Update photon-lib tests?
Browse files Browse the repository at this point in the history
  • Loading branch information
mcm001 committed Aug 18, 2024
1 parent 8a5a8a5 commit 55b22a8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
34 changes: 0 additions & 34 deletions photon-lib/src/main/native/cpp/photon/PhotonCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,40 +174,6 @@ std::vector<PhotonPipelineResult> PhotonCamera::GetAllUnreadResults() {
return ret;
}

std::vector<PhotonPipelineResult> 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<PhotonPipelineResult> ret(changes.size());

for (size_t i = 0; i < changes.size(); i++) {
const nt::Timestamped<std::vector<uint8_t>>& 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);
}
Expand Down

0 comments on commit 55b22a8

Please sign in to comment.