I’m new to FRC and helping out a team with software. We’re working with Limelight for AprilTags using C++, but I’m having some pretty basic issues. Stuff like accessing NetworkTables. I found Getting Started — Limelight 1.0 documentation, which has a section for “Don’t Forget”, but doesn’t have a full example of using Limelight correctly.
Can anyone point me to a simple starter for using Limelight for C++? I would imagine there has to be one, but I’m just missing something.
Their docs have many examples from previous years (2019, 2017, etc)
Most are in C++, a couple in Java or LabView.
They also have generic examples, such as Aiming Using Vision or Getting in Range.
I haven’t done much work with AprilTags yet, but i’m pretty sure it still outputs the x and y coordinates of the target to tx
and ty
, and the area to ta
. I’m not sure how it does angle or handles multiple targets in view.
1 Like
Includes:
#include “networktables/NetworkTable.h”
#include “networktables/NetworkTableInstance.h”
Holding Variable:
std::vector botPose = {0,0,0,0,0,0};
Call to pull the arrray for april tag bot pose from the network table into your variable
botPose = nt::NetworkTableInstance::GetDefault().GetTable(“limelight”)->GetNumberArray(“botpose”,std::vector(6));
change “limelight” in the above to you limelight name if it is not the default.
botPose[0] is you X location
botPose[1] is your Y location
botPose[5] is your yaw.
You can find the complete network table information here depending on the coordinate system you are using: (shown above uses the limelight botpose, described here)
If you get to this point, we would then need to know a little more about how you intend to use the April tags information to help further (such as drive to the center of the tag, update robot pose, or other), there are not a lot of great example codes to use with the April tags being brand new this year and LL only being updated to use them a few weeks ago.
Hope this helps
1 Like
Thanks for the links and code, I’ll work through these over next couple of days.