Skip to content

Commit

Permalink
ble
Browse files Browse the repository at this point in the history
  • Loading branch information
r4stered committed Aug 26, 2024
1 parent 18d3f88 commit 75d7b58
Show file tree
Hide file tree
Showing 19 changed files with 81 additions and 21,843 deletions.
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ plugins {
id "edu.wpi.first.GradleRIO" version "2024.3.2"
}

repositories {
mavenLocal()
}

wpi.maven.useLocal = false
wpi.maven.useDevelopment = true
wpi.versions.wpilibVersion = '2025.+'
Expand Down
7,344 changes: 0 additions & 7,344 deletions choreo.chor

This file was deleted.

34 changes: 13 additions & 21 deletions src/main/cpp/str/Camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ Camera::Camera(std::string cameraName, frc::Transform3d robotToCamera,
nt->GetDoubleTopic(cameraName + "StdDevsRot").Publish()) {
photonEstimator = std::make_unique<photon::PhotonPoseEstimator>(
consts::yearSpecific::aprilTagLayout,
photon::PoseStrategy::MULTI_TAG_PNP_ON_COPROCESSOR,
std::move(photon::PhotonCamera(cameraName)), robotToCamera);
camera = photonEstimator->GetCamera();
photon::PoseStrategy::MULTI_TAG_PNP_ON_COPROCESSOR, robotToCamera);
camera = std::make_unique<photon::PhotonCamera>(cameraName);
camera->SetVersionCheckEnabled(false);
photonEstimator->SetMultiTagFallbackStrategy(
photon::PoseStrategy::LOWEST_AMBIGUITY);
Expand All @@ -52,36 +51,29 @@ Camera::Camera(std::string cameraName, frc::Transform3d robotToCamera,
}

photon::PhotonPipelineResult Camera::GetLatestResult() {
return camera->GetLatestResult();
return latestResult;
}

std::optional<photon::EstimatedRobotPose> Camera::GetEstimatedGlobalPose() {
if (!simulate) {
return std::nullopt;
}

auto visionEst = photonEstimator->Update();
units::second_t latestTimestamp = camera->GetLatestResult().GetTimestamp();
std::optional<photon::EstimatedRobotPose> visionEst;

// FIXME: waiting on wpilib for fix
// account for issue with NT sync not working correctly.
units::second_t now = frc::Timer::GetFPGATimestamp();
if (latestTimestamp > now) {
latestTimestamp = now;
}
for(const auto& result : camera->GetAllUnreadResults()) {
visionEst = photonEstimator->Update(result);

bool newResult =
units::math::abs(latestTimestamp - lastEstTimestamp) > 1e-5_s;
if (visionEst.has_value()) {
posePub.Set(visionEst.value().estimatedPose.ToPose2d());
} else {
if (newResult) {
if(visionEst.has_value()) {
posePub.Set(visionEst.value().estimatedPose.ToPose2d());
}
else {
posePub.Set({});
}

latestResult = result;
}
if (newResult) {
lastEstTimestamp = latestTimestamp;
}

return visionEst;
}

Expand Down
131 changes: 0 additions & 131 deletions src/main/deploy/choreo/AlignToAmp.1.traj

This file was deleted.

131 changes: 0 additions & 131 deletions src/main/deploy/choreo/AlignToAmp.traj

This file was deleted.

Loading

0 comments on commit 75d7b58

Please sign in to comment.