mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-19 00:41:41 +00:00
Add sequence ID, capture, publish and recieve timestamp to PhotonPipelineResult (#1305)
Closes #1304
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user