Can you use april tags with C++?

My team has been having discourse over the fact that when we try to incorporate OpenCV it doesn’t work. This makes us wonder what languages are compatible with the system. If OpenCV doesn’t work, are there any other credible alternatives we can use. Thank you. Keep in mind C++ is our primary language.

You can use PhotonVision which is, by my team’s anecdote, extremely powerful. It saves a lot of work and has a robot-side library (PhotonLib) that I believe is compatible with C++.

Can you use AprilTags with C++? yes absolutely. “How” is a very different question though.

OpenCV is likely the answer if you want to do it through code on the Rio. I assure you, C++ with opencv on the rio absolutely can work for detecting apriltags. Depending on implementation, it may or may not be as performant as you’d like within the resource constraints of the rio, but the code will run. This is why most teams offload that workload to a coprocessor (for example, Limelight is a commercial product for that, but it’s built on a Raspberry Pi so you could natively use that as well)

You say “it doesn’t work”, but don’t mention “how”. Shall we start there?

You could use this tutorial to guide your efforts: Aruco Tag Tutorial. You can simply pass in the AprilTag family and develop your algorithm. I would most likely recommend using a coprocessor along with this. My recommendation is the Nvidia Jetson Nano, but those are difficult to come by right now. Raspberry Pi is adequate and cheaper as well. Good luck!

If you want to try doing it on the Rio, I would recommend trying the apriltagsvision example project included with WPILib 2023.2.1 (you can also look at the code online here).

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.