mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-19 00:41:41 +00:00
Use ReadQueue for PhotonCamera timestamps (#1316)
This removes the extra GetLastChange call to keep everything properly atomic. Closes #1303
This commit is contained in:
@@ -27,10 +27,15 @@
|
||||
#include <tuple>
|
||||
#include <vector>
|
||||
|
||||
#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();
|
||||
@@ -229,9 +234,10 @@ TEST_P(VisionSystemSimTestWithParamsTest, YawAngles) {
|
||||
robotPose =
|
||||
frc::Pose2d{frc::Translation2d{10_m, 0_m}, frc::Rotation2d{GetParam()}};
|
||||
visionSysSim.Update(robotPose);
|
||||
ASSERT_TRUE(camera.GetLatestResult().HasTargets());
|
||||
ASSERT_NEAR(GetParam().to<double>(),
|
||||
camera.GetLatestResult().GetBestTarget().GetYaw(), 0.25);
|
||||
|
||||
const auto result = camera.GetLatestResult();
|
||||
ASSERT_TRUE(result.HasTargets());
|
||||
ASSERT_NEAR(GetParam().to<double>(), result.GetBestTarget().GetYaw(), 0.25);
|
||||
}
|
||||
|
||||
TEST_P(VisionSystemSimTestWithParamsTest, PitchAngles) {
|
||||
@@ -257,9 +263,9 @@ TEST_P(VisionSystemSimTestWithParamsTest, PitchAngles) {
|
||||
frc::Rotation3d{0_rad, units::degree_t{GetParam()}, 0_rad}});
|
||||
visionSysSim.Update(robotPose);
|
||||
|
||||
ASSERT_TRUE(camera.GetLatestResult().HasTargets());
|
||||
ASSERT_NEAR(GetParam().to<double>(),
|
||||
camera.GetLatestResult().GetBestTarget().GetPitch(), 0.25);
|
||||
const auto result = camera.GetLatestResult();
|
||||
ASSERT_TRUE(result.HasTargets());
|
||||
ASSERT_NEAR(GetParam().to<double>(), result.GetBestTarget().GetPitch(), 0.25);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(AnglesTests, VisionSystemSimTestWithParamsTest,
|
||||
|
||||
Reference in New Issue
Block a user