From ea5275935b08af2d64af556a6d244c418e66a700 Mon Sep 17 00:00:00 2001 From: Matt Morley Date: Sun, 5 May 2024 09:51:22 -0400 Subject: [PATCH 1/2] Run lint --- photon-lib/src/main/native/include/photon/PhotonCamera.h | 5 +++-- photon-lib/src/test/native/cpp/VisionSystemSimTest.cpp | 5 +++++ .../main/native/include/photon/estimation/VisionEstimation.h | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/photon-lib/src/main/native/include/photon/PhotonCamera.h b/photon-lib/src/main/native/include/photon/PhotonCamera.h index e99a331e09..929cb3ab1b 100644 --- a/photon-lib/src/main/native/include/photon/PhotonCamera.h +++ b/photon-lib/src/main/native/include/photon/PhotonCamera.h @@ -87,8 +87,9 @@ class PhotonCamera { */ std::vector GetAllUnreadResult(); - [[deprecated("Replace with GetAllUnreadResult")]] - inline const PhotonPipelineResult GetLatestResult() { + [[deprecated( + "Replace with GetAllUnreadResult")]] inline const PhotonPipelineResult + GetLatestResult() { const auto ret = GetAllUnreadResult(); if (!ret.size()) return PhotonPipelineResult(); return ret.back(); diff --git a/photon-lib/src/test/native/cpp/VisionSystemSimTest.cpp b/photon-lib/src/test/native/cpp/VisionSystemSimTest.cpp index 615ccba93e..d04c5f2fa7 100644 --- a/photon-lib/src/test/native/cpp/VisionSystemSimTest.cpp +++ b/photon-lib/src/test/native/cpp/VisionSystemSimTest.cpp @@ -22,10 +22,15 @@ * SOFTWARE. */ +#include + #include "gtest/gtest.h" #include "photon/PhotonUtils.h" #include "photon/simulation/VisionSystemSim.h" +// Ignore GetLatestResult warnings +WPI_IGNORE_DEPRECATED + class VisionSystemSimTest : public ::testing::Test { void SetUp() override { nt::NetworkTableInstance::GetDefault().StartServer(); diff --git a/photon-targeting/src/main/native/include/photon/estimation/VisionEstimation.h b/photon-targeting/src/main/native/include/photon/estimation/VisionEstimation.h index cb3ae3bdc5..56fb6b8776 100644 --- a/photon-targeting/src/main/native/include/photon/estimation/VisionEstimation.h +++ b/photon-targeting/src/main/native/include/photon/estimation/VisionEstimation.h @@ -32,6 +32,7 @@ namespace photon { namespace VisionEstimation { +[[maybe_unused]] static std::vector GetVisibleLayoutTags( const std::vector& visTags, const frc::AprilTagFieldLayout& layout) { From 000b42417525c7d5dc4e1ad2b5f0153f1e132667 Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 5 May 2024 12:27:18 -0400 Subject: [PATCH 2/2] Fix naming --- photon-lib/src/main/native/cpp/photon/PhotonCamera.cpp | 2 +- .../src/main/native/cpp/photon/PhotonPoseEstimator.cpp | 2 +- .../src/main/native/include/photon/PhotonCamera.h | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/photon-lib/src/main/native/cpp/photon/PhotonCamera.cpp b/photon-lib/src/main/native/cpp/photon/PhotonCamera.cpp index cdf1b8610c..20b1877dc7 100644 --- a/photon-lib/src/main/native/cpp/photon/PhotonCamera.cpp +++ b/photon-lib/src/main/native/cpp/photon/PhotonCamera.cpp @@ -102,7 +102,7 @@ PhotonCamera::PhotonCamera(nt::NetworkTableInstance instance, PhotonCamera::PhotonCamera(const std::string_view cameraName) : PhotonCamera(nt::NetworkTableInstance::GetDefault(), cameraName) {} -std::vector PhotonCamera::GetAllUnreadResult() { +std::vector PhotonCamera::GetAllUnreadResults() { if (test) { return testResult; } diff --git a/photon-lib/src/main/native/cpp/photon/PhotonPoseEstimator.cpp b/photon-lib/src/main/native/cpp/photon/PhotonPoseEstimator.cpp index 745f35a4eb..fc22fe3edf 100644 --- a/photon-lib/src/main/native/cpp/photon/PhotonPoseEstimator.cpp +++ b/photon-lib/src/main/native/cpp/photon/PhotonPoseEstimator.cpp @@ -113,7 +113,7 @@ std::optional PhotonPoseEstimator::Update() { return std::nullopt; } - auto results = camera->GetAllUnreadResult(); + auto results = camera->GetAllUnreadResults(); std::optional ret; diff --git a/photon-lib/src/main/native/include/photon/PhotonCamera.h b/photon-lib/src/main/native/include/photon/PhotonCamera.h index 929cb3ab1b..ac2abcd577 100644 --- a/photon-lib/src/main/native/include/photon/PhotonCamera.h +++ b/photon-lib/src/main/native/include/photon/PhotonCamera.h @@ -79,18 +79,18 @@ class PhotonCamera { /** * The list of pipeline results sent by PhotonVision since the last call to - * GetAllUnreadResult(). Calling this function clears the internal FIFO queue, - * and multiple calls to GetAllUnreadResult() will return different + * GetAllUnreadResults(). Calling this function clears the internal FIFO + * queue, and multiple calls to GetAllUnreadResults() will return different * (potentially empty) result arrays. Be careful to call this exactly ONCE per * loop of your robot code! FIFO depth is limited to 20 changes, so make sure * to call this frequently enough to avoid old results being discarded, too! */ - std::vector GetAllUnreadResult(); + std::vector GetAllUnreadResults(); [[deprecated( - "Replace with GetAllUnreadResult")]] inline const PhotonPipelineResult + "Replace with GetAllUnreadResults")]] inline const PhotonPipelineResult GetLatestResult() { - const auto ret = GetAllUnreadResult(); + const auto ret = GetAllUnreadResults(); if (!ret.size()) return PhotonPipelineResult(); return ret.back(); }