Skip to content

Commit

Permalink
Merge branch 'getatomic-lib' of https://github.com/mcm001/photonvision
Browse files Browse the repository at this point in the history
…into getatomic-lib
  • Loading branch information
mcm001 committed May 6, 2024
2 parents 07b0a58 + 000b424 commit 79fdbe9
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion photon-lib/src/main/native/cpp/photon/PhotonCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ PhotonCamera::PhotonCamera(nt::NetworkTableInstance instance,
PhotonCamera::PhotonCamera(const std::string_view cameraName)
: PhotonCamera(nt::NetworkTableInstance::GetDefault(), cameraName) {}

std::vector<PhotonPipelineResult> PhotonCamera::GetAllUnreadResult() {
std::vector<PhotonPipelineResult> PhotonCamera::GetAllUnreadResults() {
if (test) {
return testResult;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ std::optional<EstimatedRobotPose> PhotonPoseEstimator::Update() {
return std::nullopt;
}

auto results = camera->GetAllUnreadResult();
auto results = camera->GetAllUnreadResults();

std::optional<EstimatedRobotPose> ret;

Expand Down
13 changes: 7 additions & 6 deletions photon-lib/src/main/native/include/photon/PhotonCamera.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +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<PhotonPipelineResult> GetAllUnreadResult();
std::vector<PhotonPipelineResult> GetAllUnreadResults();

[[deprecated("Replace with GetAllUnreadResult")]]
inline const PhotonPipelineResult GetLatestResult() {
const auto ret = GetAllUnreadResult();
[[deprecated(
"Replace with GetAllUnreadResults")]] inline const PhotonPipelineResult
GetLatestResult() {
const auto ret = GetAllUnreadResults();
if (!ret.size()) return PhotonPipelineResult();
return ret.back();
}
Expand Down
5 changes: 5 additions & 0 deletions photon-lib/src/test/native/cpp/VisionSystemSimTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,15 @@
* SOFTWARE.
*/

#include <wpi/deprecated.h>

#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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
namespace photon {
namespace VisionEstimation {

[[maybe_unused]]
static std::vector<frc::AprilTag> GetVisibleLayoutTags(
const std::vector<PhotonTrackedTarget>& visTags,
const frc::AprilTagFieldLayout& layout) {
Expand Down

0 comments on commit 79fdbe9

Please sign in to comment.