Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

NetworkTables Communications

Mason Vogt edited this page Nov 14, 2022 · 3 revisions

To use connect to the TagTracker on the RoboRIO, you will need to read from networktables. Below is a code snippet that can be added to retrieve the estimated position of the robot.

NetworkTable table = NetworkTableInstance.getDefault().getTable("apriltag");
NetworkTableEntry position = table.getEntry("position");

And here is how to split it into X, Y, and Z components:

public double getX() {
    return position.getDoubleArray(new double[] {0,0,0})[0]
}

public double getY() {
    return position.getDoubleArray(new double[] {0,0,0})[1]
}

public double getZ() {
    return position.getDoubleArray(new double[] {0,0,0})[2]
}

Clone this wiki locally