Skip to content

Commit

Permalink
[examples] Fix memory over-allocation in Apriltag examples (#6517)
Browse files Browse the repository at this point in the history
Change hamming distance to 1, add comment about memory usage.
  • Loading branch information
HarryXChen3 authored Apr 22, 2024
1 parent 3c14d87 commit f26adc5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ class Robot : public frc::TimedRobot {
private:
static void VisionThread() {
frc::AprilTagDetector detector;
// look for tag36h11, correct 3 error bits
detector.AddFamily("tag36h11", 3);
// look for tag36h11, correct 1 error bit
// hamming 1 allocates 781KB, 2 allocates 27.4 MB, 3 allocates 932 MB
// max of 1 recommended for RoboRIO 1, while hamming 2 is feasible on the
// RoboRIO 2
detector.AddFamily("tag36h11", 1);

// Set up Pose Estimator - parameters are for a Microsoft Lifecam HD-3000
// (https://www.chiefdelphi.com/t/wpilib-apriltagdetector-sample-code/421411/21)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ public void robotInit() {

void apriltagVisionThreadProc() {
var detector = new AprilTagDetector();
// look for tag36h11, correct 3 error bits
detector.addFamily("tag36h11", 3);
// look for tag36h11, correct 1 error bit (hamming distance 1)
// hamming 1 allocates 781KB, 2 allocates 27.4 MB, 3 allocates 932 MB
// max of 1 recommended for RoboRIO 1, while hamming 2 is feasible on the RoboRIO 2
detector.addFamily("tag36h11", 1);

// Set up Pose Estimator - parameters are for a Microsoft Lifecam HD-3000
// (https://www.chiefdelphi.com/t/wpilib-apriltagdetector-sample-code/421411/21)
Expand Down

0 comments on commit f26adc5

Please sign in to comment.