Help starting with AprilTags?

I am trying to program for AprilTag 2d detection, but I am having trouble getting started. I don’t have access to a limelight or a Raspberry Pi for photonvision, but I do have a USB camera. Any idea how I might get basic 2d detection with just a USB camera?

Have you looked at the AprilTagsVision example built into WPILib?

Without a Pi for photonvision or a limelight, I think it will be extremely difficult and or slow to use april tags. Doing the processing on the rio is not a great idea because it is april tag detection is pretty expensive.

you don’t neeed a rpi you could just use a mini-computer

I come bearing data and examples.

3 Likes

I’ll risk adding to the data and examples. Risky because I see my performance figures are sensitive to just about everything and subject to very wide variation within several milliseconds even if nothing changes (a lot of jitter).

I completed my Java program to calibrate camera with ChArUco Board and Java program to compute robot pose starting with the WPILib detection example (in Github if anyone wants them).

Running on a roboRIO (the much slower original - v1) with an inexpensive ArduCam monochrome global shutter 1MP OV9281 320x240, below are my eyeball average guestimates of flashing numbers. Detection is excellent to about 9 feet at fairly rapid motion. A little more light (exposure) and slower motion gets you a few more feet of distance.

@Override
  public void teleopPeriodic()
  // enable this increases latency from 80ish to 95ish [ms]
  // and reduces fps from 20ish to 17ish (both have very wide variations)
  {
    for(int i = 1; i < 600_000; i++); // waste some cputime - the edge of 20ms overruns
  }

Use PhotonVision. You can even run it locally on your laptop to get familiar with it, then you can install it on a Raspberry Pi (or some other single board computer).

1 Like

This on an RPi would seem to be the best low-budget two camera AprilTag interpreter. I do wish one of the many electrical engineers would come up with a low-budget brownout-proof (4 to 14 v DC input) 5.1 volt 3 A or more power supply for the RPi.

My team uses Limelight 2+ which I don’t find disagreeable but they picked it mid-season over a more sophisticated RPi code that I helped the students develop. They probably thought the LL user interface was nice (our RPi user interface is Java in Visual Studio Code) and everybody was raving about LL so the team wanted one, too. LL comes in a nice box and is pretty easy to use although my team struggles with it more than the LL web site would suggest is necessary.

My motivation to develop a WPILib roboRIO solution to AprilTags was I wanted to see if we could get a no-cost camera (except for an inexpensive camera itself) on the roboRIO for backup to the LimeLight 2+ and avoid installing another expensive LL if a second camera helps next season. I suspect OP isn’t the only person to want to leverage existing roboRIO or driver station laptop for AprilTag vision.

1 Like

Use a passive PoE hat, with a passive PoE injector running at 24V.