mirror of
https://github.com/PhotonVision/photonvision
synced 2026-07-02 02:51:40 +00:00
Report cpp usage (#1045)
This commit is contained in:
@@ -24,6 +24,8 @@
|
||||
|
||||
#include "photon/PhotonCamera.h"
|
||||
|
||||
#include <hal/FRCUsageReporting.h>
|
||||
|
||||
#include <frc/Errors.h>
|
||||
#include <frc/Timer.h>
|
||||
#include <opencv2/core.hpp>
|
||||
@@ -69,7 +71,10 @@ PhotonCamera::PhotonCamera(nt::NetworkTableInstance instance,
|
||||
rootTable->GetBooleanTopic("driverModeRequest").Publish()),
|
||||
m_topicNameSubscriber(instance, PHOTON_PREFIX, {.topicsOnly = true}),
|
||||
path(rootTable->GetPath()),
|
||||
m_cameraName(cameraName) {}
|
||||
m_cameraName(cameraName) {
|
||||
HAL_Report(HALUsageReporting::kResourceType_PhotonCamera, InstanceCount);
|
||||
InstanceCount++;
|
||||
}
|
||||
|
||||
PhotonCamera::PhotonCamera(const std::string_view cameraName)
|
||||
: PhotonCamera(nt::NetworkTableInstance::GetDefault(), cameraName) {}
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
|
||||
#include "photon/PhotonPoseEstimator.h"
|
||||
|
||||
#include <hal/FRCUsageReporting.h>
|
||||
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
@@ -68,7 +70,11 @@ PhotonPoseEstimator::PhotonPoseEstimator(frc::AprilTagFieldLayout tags,
|
||||
m_robotToCamera(robotToCamera),
|
||||
lastPose(frc::Pose3d()),
|
||||
referencePose(frc::Pose3d()),
|
||||
poseCacheTimestamp(-1_s) {}
|
||||
poseCacheTimestamp(-1_s) {
|
||||
HAL_Report(HALUsageReporting::kResourceType_PhotonPoseEstimator,
|
||||
InstanceCount);
|
||||
InstanceCount++;
|
||||
}
|
||||
|
||||
PhotonPoseEstimator::PhotonPoseEstimator(frc::AprilTagFieldLayout tags,
|
||||
PoseStrategy strat, PhotonCamera&& cam,
|
||||
@@ -79,7 +85,11 @@ PhotonPoseEstimator::PhotonPoseEstimator(frc::AprilTagFieldLayout tags,
|
||||
m_robotToCamera(robotToCamera),
|
||||
lastPose(frc::Pose3d()),
|
||||
referencePose(frc::Pose3d()),
|
||||
poseCacheTimestamp(-1_s) {}
|
||||
poseCacheTimestamp(-1_s) {
|
||||
HAL_Report(HALUsageReporting::kResourceType_PhotonPoseEstimator,
|
||||
InstanceCount);
|
||||
InstanceCount++;
|
||||
}
|
||||
|
||||
void PhotonPoseEstimator::SetMultiTagFallbackStrategy(PoseStrategy strategy) {
|
||||
if (strategy == MULTI_TAG_PNP_ON_COPROCESSOR ||
|
||||
|
||||
@@ -205,6 +205,7 @@ class PhotonCamera {
|
||||
private:
|
||||
units::second_t lastVersionCheckTime = 0_s;
|
||||
inline static bool VERSION_CHECK_ENABLED = true;
|
||||
inline static int InstanceCount = 0;
|
||||
|
||||
void VerifyVersion();
|
||||
};
|
||||
|
||||
@@ -231,6 +231,8 @@ class PhotonPoseEstimator {
|
||||
|
||||
units::second_t poseCacheTimestamp;
|
||||
|
||||
inline static int InstanceCount = 0;
|
||||
|
||||
inline void InvalidatePoseCache() { poseCacheTimestamp = -1_s; }
|
||||
|
||||
std::optional<EstimatedRobotPose> Update(
|
||||
|
||||
Reference in New Issue
Block a user