Add sequence ID, capture, publish and recieve timestamp to PhotonPipelineResult (#1305)

Closes #1304
This commit is contained in:
Matt
2024-05-10 14:04:34 -04:00
committed by GitHub
parent 70c2cdebe0
commit 113951100e
46 changed files with 513 additions and 363 deletions

View File

@@ -29,6 +29,7 @@
#include <string_view>
#include <frc/Errors.h>
#include <frc/RobotController.h>
#include <frc/Timer.h>
#include <opencv2/core.hpp>
#include <opencv2/core/mat.hpp>
@@ -115,6 +116,8 @@ PhotonPipelineResult PhotonCamera::GetLatestResult() {
PhotonPipelineResult result;
// Fill the packet with latest data and populate result.
units::microsecond_t now =
units::microsecond_t(frc::RobotController::GetFPGATime());
const auto value = rawBytesEntry.Get();
if (!value.size()) return result;
@@ -122,8 +125,7 @@ PhotonPipelineResult PhotonCamera::GetLatestResult() {
packet >> result;
result.SetTimestamp(units::microsecond_t(rawBytesEntry.GetLastChange()) -
result.GetLatency());
result.SetRecieveTimestamp(now);
return result;
}