Disclaimer: I know little of LabVIEW, I use C++ with the rest of 2200.
So I've got rectangle identification working quite smoothly in C++ but I'd like to see some target info on the LabVIEW Dashboard. Right now I'm just using the smart dashboard to print coordinates of the target.
The 2010 Vision Demonstration project in WindRiver contains code to send an arbitrarily sized array of vision targets to the dashboard using the high priority dashboard packer. I want to duplicate this for rectangles.
I know the following:
- Create a cRio Robot project in LabVIEW and make the Dashboard Datatype
- Send data in C++ (code below)
- Use the IMAQ Overlay Rectangle VI in a for loop (or a loop to iterate the results)
I've stripped down the dashboard to what I want and looked through some of the documentation in LabVIEW, but I'm missing a few concepts:
- How can I make an arbitrarily sized array of clusters (matching the below C++ code)?
- How can I loop through this in the Dashboard project to add multiple overlays?
Code:
void RectangleTracker::SendVisionData() {
Dashboard &d = DriverStation::GetInstance()->GetHighPriorityDashboardPacker();
int n = matches.size();
n = (n <= 10) ? n : 10;
d.AddCluster(); {
for (int i = 0; i < n; i++) {
d.AddCluster(); {
d.AddI32((INT32)matches[i].corner[0].y);
d.AddI32((INT32)matches[i].corner[0].x);
d.AddI32((INT32)matches[i].corner[2].y);
d.AddI32((INT32)matches[i].corner[2].x);
}
d.FinalizeCluster();
}
}
d.FinalizeCluster();
d.Finalize();
}
Thanks CD LabVIEWers. I'll continue to do my Google-ing.