Skip to content

add pva backend#114

Merged
charliehuang09 merged 19 commits intomainfrom
add-vpa-backend
Apr 4, 2026
Merged

add pva backend#114
charliehuang09 merged 19 commits intomainfrom
add-vpa-backend

Conversation

@charliehuang09
Copy link
Copy Markdown
Collaborator

No description provided.

Signed-off-by: Charlie Huang <charliehuang09@gmail.com>
Signed-off-by: Charlie Huang <charliehuang09@gmail.com>
Signed-off-by: Charlie Huang <charliehuang09@gmail.com>
Signed-off-by: Charlie Huang <charliehuang09@gmail.com>
Signed-off-by: Charlie Huang <charliehuang09@gmail.com>
Signed-off-by: Charlie Huang <charliehuang09@gmail.com>
Signed-off-by: Charlie Huang <charliehuang09@gmail.com>
Signed-off-by: Charlie Huang <charliehuang09@gmail.com>
Signed-off-by: Charlie Huang <charliehuang09@gmail.com>
Signed-off-by: Charlie Huang <charliehuang09@gmail.com>
Copilot AI review requested due to automatic review settings March 14, 2026 02:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an NVIDIA VPI-based AprilTag detector backend (defaulting to the PVA backend) and switches existing integration/runtime entrypoints to use it, with a small robustness tweak in pose estimation.

Changes:

  • Introduce NvidiaAprilTagDetector (VPI) and link localization against VPI.
  • Switch main_bot_main and the AprilTag integration test to use the NVIDIA detector instead of the OpenCV detector.
  • Skip detections with unknown tag IDs in SquareSolver.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
src/test/integration_test/apriltag_detect_test.cc Uses NvidiaAprilTagDetector in the integration test path.
src/main_bot_main.cc Uses NvidiaAprilTagDetector for all three camera localization threads.
src/localization/square_solver.cc Filters out detections whose tag IDs aren’t present in the field layout.
src/localization/nvidia_apriltag_detector.h Defines NVIDIA/VPI detector API + defaults.
src/localization/nvidia_apriltag_detector.cc Implements VPI AprilTag detection and VPI resource management.
src/localization/CMakeLists.txt Adds VPI discovery and links localization to VPI.
src/camera/cv_camera.cc Removes a backup-image debug log line.
scripts/deploy.sh Deploys constants with --delete to keep remote in sync.
constants/misc/apriltag2.jpg Adds a new AprilTag image asset.

You can also share your feedback on Copilot code review. Take the survey.

int max_detections = 16, bool verbose = false);
NvidiaAprilTagDetector(
int image_width, int image_height, const nlohmann::json& intrinsics,
VPIAprilTagDecodeParams params = {NULL, 0, 1, // NOLINT
Comment on lines 15 to 20
NvidiaAprilTagDetector::NvidiaAprilTagDetector(int image_width,
int image_height,
nlohmann::json intrinsics,
const nlohmann::json& intrinsics,
VPIAprilTagDecodeParams params,
VPIBackend backend,
int max_detections, bool verbose)
detection.tag_id = detections[i].id;
detection.timestamp = timestamped_frame.timestamp;
detection.confidence = detections[i].decisionMargin;
detection.confidence = 1;
@@ -1,4 +1,5 @@
cmake_minimum_required(VERSION 3.10)

find_package(VPI REQUIRED)
@@ -11,12 +11,14 @@ namespace localization {
// Nvidia's apriltag detection algorithim
Comment on lines 12 to 13
// Supports either VPA or CPU backend
// VPA and CPU are both slower than GPU we learned through benchmarks, but they can be used to offload some computation from the GPU
#include <fmt/chrono.h>
#include <vpi/Array.h>
#include <vpi/Stream.h>
#include <vpi/algo/ConvertImageFormat.h>
Comment on lines 37 to +46
cv::Mat gray;

if (timestamped_frame.frame.channels() == 1) {
gray = timestamped_frame.frame;
} else if (timestamped_frame.frame.channels() == 3) {
cv::cvtColor(timestamped_frame.frame, gray, cv::COLOR_BGR2GRAY);
}

if (input_ == nullptr) {
(vpiImageCreateWrapperOpenCVMat(gray, 0, &input_));
CHECK(!vpiImageCreateWrapperOpenCVMat(gray, 0, &input_));
Comment on lines +50 to +54
if (!localization::kapriltag_layout.GetTagPose(detection.tag_id)
.has_value()) {
LOG(WARNING) << "Got invalid tag";
continue;
}
@charliehuang09 charliehuang09 merged commit 8088560 into main Apr 4, 2026
1 check passed
@charliehuang09 charliehuang09 deleted the add-vpa-backend branch April 4, 2026 02:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants