I know that camtran is an array that gets exported, but I have no idea how to actually pull its values, or even really the array itself. Any advice? We code in C++, the code I’m currently using is below:
double Limelight::GetTargetAngle() {
return limelight_table -> GetNumber("camtran[4]", 0.0);
}
If it’s an array in NetworkTables, you need to use GetNumberArray instead of GetNumber. This returns a std::vector<double>
.
double Limelight::GetTargetAngle()
{
std::vector<double> cameraTransform = limelight_table->GetNumberArray("camtran",std::vector<double>());
return cameraTransform[4];
}
Be a little careful with that, you should check the cameraTransform.size() first to make sure it’s at least 5 elements.
1 Like
system
Closed
February 16, 2020, 8:48am
5
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.